#include <mmsinputwidget.h>
Public Member Functions | |
MMSInputWidget (MMSWindow *root, string className, MMSTheme *theme=NULL) | |
~MMSInputWidget () | |
MMSWidget * | copyWidget () |
void | setCursorPos (int cursor_pos, bool refresh=true) |
bool | addTextAfterCursorPos (string text, bool refresh=true) |
bool | removeTextBeforeCursorPos (int textlen, bool refresh=true) |
string | getFontPath () |
string | getFontName (MMSLanguage lang=MMSLANG_NONE) |
unsigned int | getFontSize () |
MMSALIGNMENT | getAlignment () |
MMSFBColor | getColor () |
MMSFBColor | getSelColor () |
MMSFBColor | getColor_p () |
MMSFBColor | getSelColor_p () |
MMSFBColor | getColor_i () |
MMSFBColor | getSelColor_i () |
string | getText () |
void | getText (string &text) |
MMSSTATE | getCursorState () |
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 | 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, bool reset_cursor=true) |
void | setCursorState (MMSSTATE cursor_state, bool refresh=true) |
void | setShadowColor (MMSPOSITION position, MMSFBColor color, bool refresh=true) |
void | setSelShadowColor (MMSPOSITION position, MMSFBColor selcolor, bool refresh=true) |
void | updateFromThemeClass (MMSInputWidgetClass *themeClass) |
Public Attributes | |
sigc::signal< bool, MMSWidget *, string, bool, MMSFBRectangle >::accumulated < bool_accumulator > * | onBeforeChange |
Set one or more callbacks for the onBeforeChange event. | |
Private Member Functions | |
bool | create (MMSWindow *root, string className, MMSTheme *theme) |
void | initLanguage (MMSInputWidget *widget=NULL) |
void | loadFont (MMSInputWidget *widget=NULL) |
void | handleInput (MMSInputEvent *inputevent) |
bool | init () |
bool | release () |
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 | drawCursor (bool cursor_on) |
void | targetLangChanged (MMSLanguage lang) |
Internal method: Inform the widget, that the language has changed. | |
Private Attributes | |
string | className |
MMSInputWidgetClass * | inputWidgetClass |
MMSInputWidgetClass | myInputWidgetClass |
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? | |
int | cursor_pos |
bool | cursor_on |
int | scroll_x |
MMSFBRectangle | cursor_rect |
class MMSInputWidgetThread * | iwt |
bool | current_fgset |
current foreground values set? | |
MMSFBColor | current_fgcolor |
current foreground color | |
Friends | |
class | MMSWindow |
class | MMSInputWidgetThread |
You can display and edit one line of text.
Definition at line 43 of file mmsinputwidget.h.
Definition at line 38 of file mmsinputwidget.cpp.
MMSInputWidget::~MMSInputWidget | ( | ) |
Definition at line 45 of file mmsinputwidget.cpp.
Definition at line 54 of file mmsinputwidget.cpp.
void MMSInputWidget::initLanguage | ( | MMSInputWidget * | widget = NULL |
) | [private] |
Definition at line 127 of file mmsinputwidget.cpp.
void MMSInputWidget::loadFont | ( | MMSInputWidget * | widget = NULL |
) | [private] |
Definition at line 133 of file mmsinputwidget.cpp.
void MMSInputWidget::handleInput | ( | MMSInputEvent * | inputevent | ) | [private, virtual] |
bool MMSInputWidget::init | ( | ) | [private, virtual] |
bool MMSInputWidget::release | ( | ) | [private, virtual] |
void MMSInputWidget::getForeground | ( | MMSFBColor * | color | ) | [private] |
Definition at line 179 of file mmsinputwidget.cpp.
bool MMSInputWidget::enableRefresh | ( | bool | enable = true |
) | [private, virtual] |
Internal method: (re-)enable refresh status.
Reimplemented from MMSWidget.
Definition at line 211 of file mmsinputwidget.cpp.
bool MMSInputWidget::checkRefreshStatus | ( | ) | [private, virtual] |
Internal method: check drawn background against new background and (re-)enable refresh status if needed.
Reimplemented from MMSWidget.
Definition at line 220 of file mmsinputwidget.cpp.
bool MMSInputWidget::draw | ( | bool * | backgroundFilled = NULL |
) | [private, virtual] |
void MMSInputWidget::drawCursor | ( | bool | cursor_on | ) | [private] |
Definition at line 429 of file mmsinputwidget.cpp.
void MMSInputWidget::targetLangChanged | ( | MMSLanguage | lang | ) | [private] |
Internal method: Inform the widget, that the language has changed.
Definition at line 442 of file mmsinputwidget.cpp.
MMSWidget * MMSInputWidget::copyWidget | ( | ) | [virtual] |
void MMSInputWidget::setCursorPos | ( | int | cursor_pos, | |
bool | refresh = true | |||
) |
Definition at line 451 of file mmsinputwidget.cpp.
bool MMSInputWidget::addTextAfterCursorPos | ( | string | text, | |
bool | refresh = true | |||
) |
Definition at line 472 of file mmsinputwidget.cpp.
bool MMSInputWidget::removeTextBeforeCursorPos | ( | int | textlen, | |
bool | refresh = true | |||
) |
Definition at line 493 of file mmsinputwidget.cpp.
string MMSInputWidget::getFontPath | ( | ) |
Definition at line 793 of file mmsinputwidget.cpp.
string MMSInputWidget::getFontName | ( | MMSLanguage | lang = MMSLANG_NONE |
) |
Definition at line 797 of file mmsinputwidget.cpp.
unsigned int MMSInputWidget::getFontSize | ( | ) |
Definition at line 801 of file mmsinputwidget.cpp.
MMSALIGNMENT MMSInputWidget::getAlignment | ( | ) |
Definition at line 805 of file mmsinputwidget.cpp.
MMSFBColor MMSInputWidget::getColor | ( | ) |
Definition at line 809 of file mmsinputwidget.cpp.
MMSFBColor MMSInputWidget::getSelColor | ( | ) |
Definition at line 813 of file mmsinputwidget.cpp.
MMSFBColor MMSInputWidget::getColor_p | ( | ) |
Definition at line 817 of file mmsinputwidget.cpp.
MMSFBColor MMSInputWidget::getSelColor_p | ( | ) |
Definition at line 821 of file mmsinputwidget.cpp.
MMSFBColor MMSInputWidget::getColor_i | ( | ) |
Definition at line 825 of file mmsinputwidget.cpp.
MMSFBColor MMSInputWidget::getSelColor_i | ( | ) |
Definition at line 829 of file mmsinputwidget.cpp.
string MMSInputWidget::getText | ( | ) |
Definition at line 833 of file mmsinputwidget.cpp.
void MMSInputWidget::getText | ( | string & | text | ) |
Definition at line 837 of file mmsinputwidget.cpp.
MMSSTATE MMSInputWidget::getCursorState | ( | ) |
Definition at line 841 of file mmsinputwidget.cpp.
MMSFBColor MMSInputWidget::getShadowColor | ( | MMSPOSITION | position | ) |
Definition at line 845 of file mmsinputwidget.cpp.
MMSFBColor MMSInputWidget::getSelShadowColor | ( | MMSPOSITION | position | ) |
Definition at line 849 of file mmsinputwidget.cpp.
void MMSInputWidget::setFontPath | ( | string | fontpath, | |
bool | load = true , |
|||
bool | refresh = true | |||
) |
Definition at line 857 of file mmsinputwidget.cpp.
void MMSInputWidget::setFontName | ( | MMSLanguage | lang, | |
string | fontname, | |||
bool | load = true , |
|||
bool | refresh = true | |||
) |
Definition at line 870 of file mmsinputwidget.cpp.
void MMSInputWidget::setFontName | ( | string | fontname, | |
bool | load = true , |
|||
bool | refresh = true | |||
) |
Definition at line 883 of file mmsinputwidget.cpp.
void MMSInputWidget::setFontSize | ( | unsigned int | fontsize, | |
bool | load = true , |
|||
bool | refresh = true | |||
) |
Definition at line 887 of file mmsinputwidget.cpp.
void MMSInputWidget::setFont | ( | MMSLanguage | lang, | |
string | fontpath, | |||
string | fontname, | |||
unsigned int | fontsize, | |||
bool | load = true , |
|||
bool | refresh = true | |||
) |
Definition at line 900 of file mmsinputwidget.cpp.
void MMSInputWidget::setFont | ( | string | fontpath, | |
string | fontname, | |||
unsigned int | fontsize, | |||
bool | load = true , |
|||
bool | refresh = true | |||
) |
Definition at line 915 of file mmsinputwidget.cpp.
void MMSInputWidget::setAlignment | ( | MMSALIGNMENT | alignment, | |
bool | refresh = true | |||
) |
Definition at line 919 of file mmsinputwidget.cpp.
void MMSInputWidget::setColor | ( | MMSFBColor | color, | |
bool | refresh = true | |||
) |
Definition at line 928 of file mmsinputwidget.cpp.
void MMSInputWidget::setSelColor | ( | MMSFBColor | selcolor, | |
bool | refresh = true | |||
) |
Definition at line 937 of file mmsinputwidget.cpp.
void MMSInputWidget::setColor_p | ( | MMSFBColor | color_p, | |
bool | refresh = true | |||
) |
Definition at line 946 of file mmsinputwidget.cpp.
void MMSInputWidget::setSelColor_p | ( | MMSFBColor | selcolor_p, | |
bool | refresh = true | |||
) |
Definition at line 955 of file mmsinputwidget.cpp.
void MMSInputWidget::setColor_i | ( | MMSFBColor | color_i, | |
bool | refresh = true | |||
) |
Definition at line 964 of file mmsinputwidget.cpp.
void MMSInputWidget::setSelColor_i | ( | MMSFBColor | selcolor_i, | |
bool | refresh = true | |||
) |
Definition at line 973 of file mmsinputwidget.cpp.
void MMSInputWidget::setText | ( | string | text, | |
bool | refresh = true , |
|||
bool | reset_cursor = true | |||
) |
Definition at line 982 of file mmsinputwidget.cpp.
void MMSInputWidget::setCursorState | ( | MMSSTATE | cursor_state, | |
bool | refresh = true | |||
) |
Definition at line 998 of file mmsinputwidget.cpp.
void MMSInputWidget::setShadowColor | ( | MMSPOSITION | position, | |
MMSFBColor | color, | |||
bool | refresh = true | |||
) |
Definition at line 1007 of file mmsinputwidget.cpp.
void MMSInputWidget::setSelShadowColor | ( | MMSPOSITION | position, | |
MMSFBColor | selcolor, | |||
bool | refresh = true | |||
) |
Definition at line 1016 of file mmsinputwidget.cpp.
void MMSInputWidget::updateFromThemeClass | ( | MMSInputWidgetClass * | themeClass | ) |
Definition at line 1025 of file mmsinputwidget.cpp.
friend class MMSWindow [friend] |
friend class MMSInputWidgetThread [friend] |
Definition at line 188 of file mmsinputwidget.h.
string MMSInputWidget::className [private] |
Definition at line 46 of file mmsinputwidget.h.
Definition at line 47 of file mmsinputwidget.h.
Definition at line 48 of file mmsinputwidget.h.
MMSLanguage MMSInputWidget::lang [private] |
MMSFBFont* MMSInputWidget::font [private] |
string MMSInputWidget::fontpath [private] |
string MMSInputWidget::fontname [private] |
unsigned int MMSInputWidget::fontsize [private] |
bool MMSInputWidget::load_font [private] |
int MMSInputWidget::cursor_pos [private] |
Definition at line 68 of file mmsinputwidget.h.
bool MMSInputWidget::cursor_on [private] |
Definition at line 69 of file mmsinputwidget.h.
int MMSInputWidget::scroll_x [private] |
Definition at line 70 of file mmsinputwidget.h.
MMSFBRectangle MMSInputWidget::cursor_rect [private] |
Definition at line 71 of file mmsinputwidget.h.
class MMSInputWidgetThread* MMSInputWidget::iwt [private] |
Definition at line 73 of file mmsinputwidget.h.
bool MMSInputWidget::current_fgset [private] |
MMSFBColor MMSInputWidget::current_fgcolor [private] |
sigc::signal<bool, MMSWidget*, string, bool, MMSFBRectangle>::accumulated<bool_accumulator>* MMSInputWidget::onBeforeChange |
Set one or more callbacks for the onBeforeChange event.
The connected callbacks will be called during handleInput() if user changes the text. If at least one of the callbacks returns false, the user input will be ignored and the text will not be changed.
A callback method must be defined like this:
bool myclass::mycallbackmethod(MMSWidget *widget, string text, bool add, MMSFBRectangle rect);
Parameters:
widget -> is the pointer to the input widget which is to be changed text -> string to be added or removed add -> true: string is to be added, false: string is to be removed rect -> affected rectangle within the widget
Returns:
true if the user input is accepted, else false if the input is to be ignored
To connect your callback to onBeforeChange do this:
sigc::connection connection; connection = mywindow->onBeforeChange->connect(sigc::mem_fun(myobject,&myclass::mycallbackmethod));
To disconnect your callback do this:
connection.disconnect();
Please note:
You HAVE TO disconnect myobject from onBeforeChange BEFORE myobject will be deleted!!! Else an abnormal program termination can occur. You HAVE TO call the disconnect() method of sigc::connection explicitly. The destructor will NOT do this!!!
Definition at line 147 of file mmsinputwidget.h.