#include <mmstextboxwidget.h>
Public Member Functions | |
MMSTextBoxWidget (MMSWindow *root, string className, MMSTheme *theme=NULL) | |
~MMSTextBoxWidget () | |
MMSWidget * | copyWidget () |
bool | reloadFile () |
reload the file and display it in the textbox | |
string | getFontPath () |
string | getFontName (MMSLanguage lang=MMSLANG_NONE) |
unsigned int | getFontSize () |
MMSALIGNMENT | getAlignment () |
bool | getWrap () |
bool | getSplitWords () |
MMSFBColor | getColor () |
MMSFBColor | getSelColor () |
MMSFBColor | getColor_p () |
MMSFBColor | getSelColor_p () |
MMSFBColor | getColor_i () |
MMSFBColor | getSelColor_i () |
string | getText () |
void | getText (string &text) |
bool | getTranslate () |
string | getFilePath () |
string | getFileName () |
MMSFBColor | getShadowColor (MMSPOSITION position) |
MMSFBColor | getSelShadowColor (MMSPOSITION position) |
void | setFontPath (string fontpath, bool load=true, bool refresh=true) |
void | setFontName (MMSLanguage lang, string fontname, bool load=true, bool refresh=true) |
void | setFontName (string fontname, bool load=true, bool refresh=true) |
void | setFontSize (unsigned int fontsize, bool load=true, bool refresh=true) |
void | setFont (MMSLanguage lang, string fontpath, string fontname, unsigned int fontsize, bool load=true, bool refresh=true) |
void | setFont (string fontpath, string fontname, unsigned int fontsize, bool load=true, bool refresh=true) |
void | setAlignment (MMSALIGNMENT alignment, bool refresh=true) |
void | setWrap (bool wrap, bool refresh=true) |
void | setSplitWords (bool splitwords, bool refresh=true) |
void | setColor (MMSFBColor color, bool refresh=true) |
void | setSelColor (MMSFBColor selcolor, bool refresh=true) |
void | setColor_p (MMSFBColor color_p, bool refresh=true) |
void | setSelColor_p (MMSFBColor selcolor_p, bool refresh=true) |
void | setColor_i (MMSFBColor color_i, bool refresh=true) |
void | setSelColor_i (MMSFBColor selcolor_i, bool refresh=true) |
void | setText (string *text, bool refresh=true) |
void | setText (string text, bool refresh=true) |
void | setTranslate (bool translate, bool refresh=true) |
void | setFilePath (string filepath, bool load=true, bool refresh=true) |
void | setFileName (string filename, bool load=true, bool refresh=true) |
void | setShadowColor (MMSPOSITION position, MMSFBColor color, bool refresh=true) |
void | setSelShadowColor (MMSPOSITION position, MMSFBColor selcolor, bool refresh=true) |
void | updateFromThemeClass (MMSTextBoxWidgetClass *themeClass) |
Private Member Functions | |
bool | create (MMSWindow *root, string className, MMSTheme *theme) |
void | initLanguage (MMSTextBoxWidget *widget=NULL) |
void | loadFont (MMSTextBoxWidget *widget=NULL) |
bool | setSurfaceGeometry (unsigned int width=0, unsigned int height=0) |
bool | calcWordGeom (string &text, unsigned int startWidth, unsigned int startHeight, unsigned int *realWidth, unsigned int *realHeight, unsigned int *scrollDX, unsigned int *scrollDY, unsigned int *lines, unsigned int *paragraphs, bool wrap=true, bool splitwords=true, MMSALIGNMENT alignment=MMSALIGNMENT_CENTER, unsigned int *minWidth=NULL, unsigned int *minHeight=NULL, bool force_recalc=false) |
bool | init () |
bool | release () |
bool | prepareText (int *width, int *height, bool recalc=false) |
void | calcContentSize () |
Internal method: Should be overridden by widgets which have a dynamic size based on content. | |
void | getForeground (MMSFBColor *color) |
bool | enableRefresh (bool enable=true) |
Internal method: (re-)enable refresh status. | |
bool | checkRefreshStatus () |
Internal method: check drawn background against new background and (re-)enable refresh status if needed. | |
bool | draw (bool *backgroundFilled=NULL) |
void | targetLangChanged (MMSLanguage lang) |
Internal method: Inform the widget, that the language has changed. | |
bool | loadFile (bool refresh) |
Private Attributes | |
string | className |
MMSTextBoxWidgetClass * | textBoxWidgetClass |
MMSTextBoxWidgetClass | myTextBoxWidgetClass |
MMSLanguage | lang |
language in which the text is to be translated | |
MMSFBFont * | font |
loaded font | |
string | fontpath |
path to the loaded font file | |
string | fontname |
name of the loaded font file | |
unsigned int | fontsize |
requested size of the font | |
bool | load_font |
have to (re)load font? | |
vector< TEXTBOX_WORDGEOM * > | wordgeom |
string | lasttext |
bool | surfaceChanged |
string | translated_text |
the translated text will be stored here, this is used in the draw() method | |
bool | translated |
if true the translated_text is valid | |
bool | swap_left_right |
swap left-right alignment | |
MMSFile * | file |
used to load text from a file | |
bool | current_fgset |
current foreground values set? | |
MMSFBColor | current_fgcolor |
current foreground color | |
Friends | |
class | MMSWindow |
Classes | |
struct | TEXTBOX_WORDGEOM |
The textbox is focusable. So the user can scroll in it. Line breaks will be done with the normal line feed (
(0x0a)). Specify as line feed within XML. If you want to display only one line of static text, you should use the MMSLabel widget.
Definition at line 46 of file mmstextboxwidget.h.
Definition at line 37 of file mmstextboxwidget.cpp.
MMSTextBoxWidget::~MMSTextBoxWidget | ( | ) |
Definition at line 41 of file mmstextboxwidget.cpp.
Definition at line 50 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::initLanguage | ( | MMSTextBoxWidget * | widget = NULL |
) | [private] |
Definition at line 120 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::loadFont | ( | MMSTextBoxWidget * | widget = NULL |
) | [private] |
Definition at line 126 of file mmstextboxwidget.cpp.
bool MMSTextBoxWidget::setSurfaceGeometry | ( | unsigned int | width = 0 , |
|
unsigned int | height = 0 | |||
) | [private, virtual] |
bool MMSTextBoxWidget::calcWordGeom | ( | string & | text, | |
unsigned int | startWidth, | |||
unsigned int | startHeight, | |||
unsigned int * | realWidth, | |||
unsigned int * | realHeight, | |||
unsigned int * | scrollDX, | |||
unsigned int * | scrollDY, | |||
unsigned int * | lines, | |||
unsigned int * | paragraphs, | |||
bool | wrap = true , |
|||
bool | splitwords = true , |
|||
MMSALIGNMENT | alignment = MMSALIGNMENT_CENTER , |
|||
unsigned int * | minWidth = NULL , |
|||
unsigned int * | minHeight = NULL , |
|||
bool | force_recalc = false | |||
) | [private] |
Definition at line 161 of file mmstextboxwidget.cpp.
bool MMSTextBoxWidget::init | ( | ) | [private, virtual] |
bool MMSTextBoxWidget::release | ( | ) | [private, virtual] |
bool MMSTextBoxWidget::prepareText | ( | int * | width, | |
int * | height, | |||
bool | recalc = false | |||
) | [private] |
Definition at line 507 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::calcContentSize | ( | ) | [private, virtual] |
Internal method: Should be overridden by widgets which have a dynamic size based on content.
Reimplemented from MMSWidget.
Definition at line 641 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::getForeground | ( | MMSFBColor * | color | ) | [private] |
Definition at line 651 of file mmstextboxwidget.cpp.
bool MMSTextBoxWidget::enableRefresh | ( | bool | enable = true |
) | [private, virtual] |
Internal method: (re-)enable refresh status.
Reimplemented from MMSWidget.
Definition at line 683 of file mmstextboxwidget.cpp.
bool MMSTextBoxWidget::checkRefreshStatus | ( | ) | [private, virtual] |
Internal method: check drawn background against new background and (re-)enable refresh status if needed.
Reimplemented from MMSWidget.
Definition at line 692 of file mmstextboxwidget.cpp.
bool MMSTextBoxWidget::draw | ( | bool * | backgroundFilled = NULL |
) | [private, virtual] |
void MMSTextBoxWidget::targetLangChanged | ( | MMSLanguage | lang | ) | [private] |
Internal method: Inform the widget, that the language has changed.
Definition at line 790 of file mmstextboxwidget.cpp.
bool MMSTextBoxWidget::loadFile | ( | bool | refresh | ) | [private] |
Definition at line 800 of file mmstextboxwidget.cpp.
MMSWidget * MMSTextBoxWidget::copyWidget | ( | ) | [virtual] |
bool MMSTextBoxWidget::reloadFile | ( | ) |
string MMSTextBoxWidget::getFontPath | ( | ) |
Definition at line 873 of file mmstextboxwidget.cpp.
string MMSTextBoxWidget::getFontName | ( | MMSLanguage | lang = MMSLANG_NONE |
) |
Definition at line 877 of file mmstextboxwidget.cpp.
unsigned int MMSTextBoxWidget::getFontSize | ( | ) |
Definition at line 881 of file mmstextboxwidget.cpp.
MMSALIGNMENT MMSTextBoxWidget::getAlignment | ( | ) |
Definition at line 885 of file mmstextboxwidget.cpp.
bool MMSTextBoxWidget::getWrap | ( | ) |
Definition at line 889 of file mmstextboxwidget.cpp.
bool MMSTextBoxWidget::getSplitWords | ( | ) |
Definition at line 893 of file mmstextboxwidget.cpp.
MMSFBColor MMSTextBoxWidget::getColor | ( | ) |
Definition at line 897 of file mmstextboxwidget.cpp.
MMSFBColor MMSTextBoxWidget::getSelColor | ( | ) |
Definition at line 901 of file mmstextboxwidget.cpp.
MMSFBColor MMSTextBoxWidget::getColor_p | ( | ) |
Definition at line 905 of file mmstextboxwidget.cpp.
MMSFBColor MMSTextBoxWidget::getSelColor_p | ( | ) |
Definition at line 909 of file mmstextboxwidget.cpp.
MMSFBColor MMSTextBoxWidget::getColor_i | ( | ) |
Definition at line 913 of file mmstextboxwidget.cpp.
MMSFBColor MMSTextBoxWidget::getSelColor_i | ( | ) |
Definition at line 917 of file mmstextboxwidget.cpp.
string MMSTextBoxWidget::getText | ( | ) |
Definition at line 921 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::getText | ( | string & | text | ) |
Definition at line 925 of file mmstextboxwidget.cpp.
bool MMSTextBoxWidget::getTranslate | ( | ) |
Definition at line 929 of file mmstextboxwidget.cpp.
string MMSTextBoxWidget::getFilePath | ( | ) |
Definition at line 933 of file mmstextboxwidget.cpp.
string MMSTextBoxWidget::getFileName | ( | ) |
Definition at line 937 of file mmstextboxwidget.cpp.
MMSFBColor MMSTextBoxWidget::getShadowColor | ( | MMSPOSITION | position | ) |
Definition at line 941 of file mmstextboxwidget.cpp.
MMSFBColor MMSTextBoxWidget::getSelShadowColor | ( | MMSPOSITION | position | ) |
Definition at line 945 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::setFontPath | ( | string | fontpath, | |
bool | load = true , |
|||
bool | refresh = true | |||
) |
Definition at line 953 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::setFontName | ( | MMSLanguage | lang, | |
string | fontname, | |||
bool | load = true , |
|||
bool | refresh = true | |||
) |
Definition at line 966 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::setFontName | ( | string | fontname, | |
bool | load = true , |
|||
bool | refresh = true | |||
) |
Definition at line 979 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::setFontSize | ( | unsigned int | fontsize, | |
bool | load = true , |
|||
bool | refresh = true | |||
) |
Definition at line 983 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::setFont | ( | MMSLanguage | lang, | |
string | fontpath, | |||
string | fontname, | |||
unsigned int | fontsize, | |||
bool | load = true , |
|||
bool | refresh = true | |||
) |
Definition at line 996 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::setFont | ( | string | fontpath, | |
string | fontname, | |||
unsigned int | fontsize, | |||
bool | load = true , |
|||
bool | refresh = true | |||
) |
Definition at line 1011 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::setAlignment | ( | MMSALIGNMENT | alignment, | |
bool | refresh = true | |||
) |
Definition at line 1015 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::setWrap | ( | bool | wrap, | |
bool | refresh = true | |||
) |
Definition at line 1024 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::setSplitWords | ( | bool | splitwords, | |
bool | refresh = true | |||
) |
Definition at line 1033 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::setColor | ( | MMSFBColor | color, | |
bool | refresh = true | |||
) |
Definition at line 1042 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::setSelColor | ( | MMSFBColor | selcolor, | |
bool | refresh = true | |||
) |
Definition at line 1051 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::setColor_p | ( | MMSFBColor | color_p, | |
bool | refresh = true | |||
) |
Definition at line 1060 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::setSelColor_p | ( | MMSFBColor | selcolor_p, | |
bool | refresh = true | |||
) |
Definition at line 1069 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::setColor_i | ( | MMSFBColor | color_i, | |
bool | refresh = true | |||
) |
Definition at line 1078 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::setSelColor_i | ( | MMSFBColor | selcolor_i, | |
bool | refresh = true | |||
) |
Definition at line 1087 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::setText | ( | string * | text, | |
bool | refresh = true | |||
) |
Definition at line 1097 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::setText | ( | string | text, | |
bool | refresh = true | |||
) |
Definition at line 1109 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::setTranslate | ( | bool | translate, | |
bool | refresh = true | |||
) |
Definition at line 1113 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::setFilePath | ( | string | filepath, | |
bool | load = true , |
|||
bool | refresh = true | |||
) |
Definition at line 1123 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::setFileName | ( | string | filename, | |
bool | load = true , |
|||
bool | refresh = true | |||
) |
Definition at line 1134 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::setShadowColor | ( | MMSPOSITION | position, | |
MMSFBColor | color, | |||
bool | refresh = true | |||
) |
Definition at line 1145 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::setSelShadowColor | ( | MMSPOSITION | position, | |
MMSFBColor | selcolor, | |||
bool | refresh = true | |||
) |
Definition at line 1154 of file mmstextboxwidget.cpp.
void MMSTextBoxWidget::updateFromThemeClass | ( | MMSTextBoxWidgetClass * | themeClass | ) |
Definition at line 1164 of file mmstextboxwidget.cpp.
friend class MMSWindow [friend] |
string MMSTextBoxWidget::className [private] |
Definition at line 55 of file mmstextboxwidget.h.
Definition at line 56 of file mmstextboxwidget.h.
Definition at line 57 of file mmstextboxwidget.h.
MMSLanguage MMSTextBoxWidget::lang [private] |
MMSFBFont* MMSTextBoxWidget::font [private] |
string MMSTextBoxWidget::fontpath [private] |
string MMSTextBoxWidget::fontname [private] |
unsigned int MMSTextBoxWidget::fontsize [private] |
bool MMSTextBoxWidget::load_font [private] |
vector<TEXTBOX_WORDGEOM *> MMSTextBoxWidget::wordgeom [private] |
Definition at line 78 of file mmstextboxwidget.h.
string MMSTextBoxWidget::lasttext [private] |
Definition at line 80 of file mmstextboxwidget.h.
bool MMSTextBoxWidget::surfaceChanged [private] |
Definition at line 81 of file mmstextboxwidget.h.
string MMSTextBoxWidget::translated_text [private] |
the translated text will be stored here, this is used in the draw() method
Definition at line 84 of file mmstextboxwidget.h.
bool MMSTextBoxWidget::translated [private] |
bool MMSTextBoxWidget::swap_left_right [private] |
MMSFile* MMSTextBoxWidget::file [private] |
bool MMSTextBoxWidget::current_fgset [private] |
MMSFBColor MMSTextBoxWidget::current_fgcolor [private] |