1 #ifndef MWGUI_BOOKPAGE_HPP
2 #define MWGUI_BOOKPAGE_HPP
4 #include "MyGUI_Colour.h"
5 #include "MyGUI_Widget.h"
6 #include "MyGUI_FontManager.h"
14 #include "../mwbase/environment.hpp"
15 #include "../mwbase/windowmanager.hpp"
23 typedef std::shared_ptr <TypesetBook>
Ptr;
35 virtual std::pair <unsigned int, unsigned int>
getSize ()
const = 0;
52 MyGUI::GlyphInfo* gi = font->getGlyphInfo(ch);
55 const float scale = font->getDefaultHeight() / (float) fontHeight;
59 bearingY = (
int) gi->bearingY / scale;
61 height = (
int) gi->height / scale;
80 typedef std::shared_ptr <BookTypesetter>
Ptr;
84 typedef std::pair <Utf8Point, Utf8Point>
Utf8Span;
102 static Ptr create (
int pageWidth,
int pageHeight);
105 virtual Style*
createStyle (
const std::string& fontName,
const Colour& colour,
bool useBookFont=
true) = 0;
116 virtual void lineBreak (
float margin = 0) = 0;
140 virtual void write (Style * Style,
size_t Begin,
size_t End) = 0;
170 #endif // MWGUI_BOOKPAGE_HPP
virtual void showPage(TypesetBook::Ptr Book, size_t Page)=0
Make the widget display the specified page from the specified book.
float advance
Definition: bookpage.hpp:43
uint8_t const * Utf8Point
Definition: bookpage.hpp:83
static Ptr create(int pageWidth, int pageHeight)
A factory function for creating the default implementation of a book typesetter.
Definition: bookpage.cpp:639
Alignment
Definition: bookpage.hpp:89
static const Environment & get()
Return instance of this class.
Definition: environment.cpp:196
float height
Definition: bookpage.hpp:42
float width
Definition: bookpage.hpp:41
TypesetBook::InteractiveId InteractiveId
Definition: bookpage.hpp:152
virtual intptr_t addContent(Utf8Span Text, bool Select=true)=0
WindowManager * getWindowManager() const
Definition: environment.cpp:125
virtual Style * createStyle(const std::string &fontName, const Colour &colour, bool useBookFont=true)=0
Create a simple text style consisting of a font and a text color.
GlyphInfo(MyGUI::IFont *font, MyGUI::Char ch)
Definition: bookpage.hpp:48
virtual TypesetBook::Ptr complete()=0
Finalize the document layout, and return a pointer to it.
virtual Style * createHotStyle(Style *BaseStyle, const Colour &NormalColour, const Colour &HoverColour, const Colour &ActiveColour, InteractiveId Id, bool Unique=true)=0
Definition: bookpage.hpp:21
Definition: bookpage.hpp:92
std::shared_ptr< BookTypesetter > Ptr
Definition: bookpage.hpp:80
std::pair< Utf8Point, Utf8Point > Utf8Span
Definition: bookpage.hpp:84
virtual void setSectionAlignment(Alignment sectionAlignment)=0
Changes the alignment for the current section of text.
float bearingY
Definition: bookpage.hpp:45
static void registerMyGUIComponents()
Definition: bookpage.cpp:1332
virtual void unadviseLinkClicked()=0
Clear the hyper-link click callback.
virtual void selectContent(intptr_t contentHandle)=0
Select a previously created content block for future writes.
std::function< void(InteractiveId)> ClickCallback
Definition: bookpage.hpp:153
virtual void sectionBreak(int margin=0)=0
MyGUI::Colour Colour
Definition: bookpage.hpp:82
virtual size_t pageCount() const =0
Returns the number of pages in the document.
Definition: bookpage.hpp:91
virtual std::pair< unsigned int, unsigned int > getSize() const =0
intptr_t InteractiveId
Definition: bookpage.hpp:24
A factory class for creating a typeset book instance.
Definition: bookpage.hpp:78
std::shared_ptr< TypesetBook > Ptr
Definition: bookpage.hpp:23
Definition: bookpage.hpp:38
An interface to the BookPage widget.
Definition: bookpage.hpp:147
virtual void lineBreak(float margin=0)=0
char codePoint
Definition: bookpage.hpp:40
float bearingX
Definition: bookpage.hpp:44
MyGUI::FloatRect uvRect
Definition: bookpage.hpp:46
virtual void write(Style *Style, Utf8Span Text)=0
TypesetBook::InteractiveId InteractiveId
Definition: bookpage.hpp:81
virtual void adviseLinkClicked(ClickCallback callback)=0
Set the callback for a clicking a hyper-link in the document.
virtual int getFontHeight() const =0
Definition: bookpage.hpp:90