MMSInputWidget Class Reference

With this class you can display and edit one line text. More...

#include <mmsinputwidget.h>

Inheritance diagram for MMSInputWidget:

List of all members.


Public Member Functions

 MMSInputWidget (MMSWindow *root, string className, MMSTheme *theme=NULL)
 ~MMSInputWidget ()
MMSWidgetcopyWidget ()
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
MMSInputWidgetClassinputWidgetClass
MMSInputWidgetClass myInputWidgetClass
MMSLanguage lang
 language in which the text is to be translated
MMSFBFontfont
 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 MMSInputWidgetThreadiwt
bool current_fgset
 current foreground values set?
MMSFBColor current_fgcolor
 current foreground color

Friends

class MMSWindow
class MMSInputWidgetThread

Detailed Description

With this class you can display and edit one line text.

You can display and edit one line of text.

Author:
Jens Schneider

Definition at line 43 of file mmsinputwidget.h.


Constructor & Destructor Documentation

MMSInputWidget::MMSInputWidget ( MMSWindow root,
string  className,
MMSTheme theme = NULL 
)

Definition at line 38 of file mmsinputwidget.cpp.

MMSInputWidget::~MMSInputWidget (  ) 

Definition at line 45 of file mmsinputwidget.cpp.


Member Function Documentation

bool MMSInputWidget::create ( MMSWindow root,
string  className,
MMSTheme theme 
) [private]

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]

Reimplemented from MMSWidget.

Definition at line 530 of file mmsinputwidget.cpp.

bool MMSInputWidget::init (  )  [private, virtual]

Reimplemented from MMSWidget.

Definition at line 161 of file mmsinputwidget.cpp.

bool MMSInputWidget::release (  )  [private, virtual]

Reimplemented from MMSWidget.

Definition at line 175 of file mmsinputwidget.cpp.

void MMSInputWidget::getForeground ( MMSFBColor color  )  [private]

Definition at line 191 of file mmsinputwidget.cpp.

bool MMSInputWidget::enableRefresh ( bool  enable = true  )  [private, virtual]

Internal method: (re-)enable refresh status.

Reimplemented from MMSWidget.

Definition at line 223 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 232 of file mmsinputwidget.cpp.

bool MMSInputWidget::draw ( bool *  backgroundFilled = NULL  )  [private, virtual]

Reimplemented from MMSWidget.

Definition at line 253 of file mmsinputwidget.cpp.

void MMSInputWidget::drawCursor ( bool  cursor_on  )  [private]

Definition at line 441 of file mmsinputwidget.cpp.

void MMSInputWidget::targetLangChanged ( MMSLanguage  lang  )  [private]

Internal method: Inform the widget, that the language has changed.

Definition at line 454 of file mmsinputwidget.cpp.

MMSWidget * MMSInputWidget::copyWidget (  )  [virtual]

Implements MMSWidget.

Definition at line 86 of file mmsinputwidget.cpp.

void MMSInputWidget::setCursorPos ( int  cursor_pos,
bool  refresh = true 
)

Definition at line 462 of file mmsinputwidget.cpp.

bool MMSInputWidget::addTextAfterCursorPos ( string  text,
bool  refresh = true 
)

Definition at line 483 of file mmsinputwidget.cpp.

bool MMSInputWidget::removeTextBeforeCursorPos ( int  textlen,
bool  refresh = true 
)

Definition at line 504 of file mmsinputwidget.cpp.

string MMSInputWidget::getFontPath (  ) 

Definition at line 804 of file mmsinputwidget.cpp.

string MMSInputWidget::getFontName ( MMSLanguage  lang = MMSLANG_NONE  ) 

Definition at line 808 of file mmsinputwidget.cpp.

unsigned int MMSInputWidget::getFontSize (  ) 

Definition at line 812 of file mmsinputwidget.cpp.

MMSALIGNMENT MMSInputWidget::getAlignment (  ) 

Definition at line 816 of file mmsinputwidget.cpp.

MMSFBColor MMSInputWidget::getColor (  ) 

Definition at line 820 of file mmsinputwidget.cpp.

MMSFBColor MMSInputWidget::getSelColor (  ) 

Definition at line 824 of file mmsinputwidget.cpp.

MMSFBColor MMSInputWidget::getColor_p (  ) 

Definition at line 828 of file mmsinputwidget.cpp.

MMSFBColor MMSInputWidget::getSelColor_p (  ) 

Definition at line 832 of file mmsinputwidget.cpp.

MMSFBColor MMSInputWidget::getColor_i (  ) 

Definition at line 836 of file mmsinputwidget.cpp.

MMSFBColor MMSInputWidget::getSelColor_i (  ) 

Definition at line 840 of file mmsinputwidget.cpp.

string MMSInputWidget::getText (  ) 

Definition at line 844 of file mmsinputwidget.cpp.

void MMSInputWidget::getText ( string &  text  ) 

Definition at line 848 of file mmsinputwidget.cpp.

MMSSTATE MMSInputWidget::getCursorState (  ) 

Definition at line 852 of file mmsinputwidget.cpp.

MMSFBColor MMSInputWidget::getShadowColor ( MMSPOSITION  position  ) 

Definition at line 856 of file mmsinputwidget.cpp.

MMSFBColor MMSInputWidget::getSelShadowColor ( MMSPOSITION  position  ) 

Definition at line 860 of file mmsinputwidget.cpp.

void MMSInputWidget::setFontPath ( string  fontpath,
bool  load = true,
bool  refresh = true 
)

Definition at line 868 of file mmsinputwidget.cpp.

void MMSInputWidget::setFontName ( MMSLanguage  lang,
string  fontname,
bool  load = true,
bool  refresh = true 
)

Definition at line 881 of file mmsinputwidget.cpp.

void MMSInputWidget::setFontName ( string  fontname,
bool  load = true,
bool  refresh = true 
)

Definition at line 894 of file mmsinputwidget.cpp.

void MMSInputWidget::setFontSize ( unsigned int  fontsize,
bool  load = true,
bool  refresh = true 
)

Definition at line 898 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 911 of file mmsinputwidget.cpp.

void MMSInputWidget::setFont ( string  fontpath,
string  fontname,
unsigned int  fontsize,
bool  load = true,
bool  refresh = true 
)

Definition at line 926 of file mmsinputwidget.cpp.

void MMSInputWidget::setAlignment ( MMSALIGNMENT  alignment,
bool  refresh = true 
)

Definition at line 930 of file mmsinputwidget.cpp.

void MMSInputWidget::setColor ( MMSFBColor  color,
bool  refresh = true 
)

Definition at line 939 of file mmsinputwidget.cpp.

void MMSInputWidget::setSelColor ( MMSFBColor  selcolor,
bool  refresh = true 
)

Definition at line 948 of file mmsinputwidget.cpp.

void MMSInputWidget::setColor_p ( MMSFBColor  color_p,
bool  refresh = true 
)

Definition at line 957 of file mmsinputwidget.cpp.

void MMSInputWidget::setSelColor_p ( MMSFBColor  selcolor_p,
bool  refresh = true 
)

Definition at line 966 of file mmsinputwidget.cpp.

void MMSInputWidget::setColor_i ( MMSFBColor  color_i,
bool  refresh = true 
)

Definition at line 975 of file mmsinputwidget.cpp.

void MMSInputWidget::setSelColor_i ( MMSFBColor  selcolor_i,
bool  refresh = true 
)

Definition at line 984 of file mmsinputwidget.cpp.

void MMSInputWidget::setText ( string  text,
bool  refresh = true,
bool  reset_cursor = true 
)

Definition at line 993 of file mmsinputwidget.cpp.

void MMSInputWidget::setCursorState ( MMSSTATE  cursor_state,
bool  refresh = true 
)

Definition at line 1009 of file mmsinputwidget.cpp.

void MMSInputWidget::setShadowColor ( MMSPOSITION  position,
MMSFBColor  color,
bool  refresh = true 
)

Definition at line 1018 of file mmsinputwidget.cpp.

void MMSInputWidget::setSelShadowColor ( MMSPOSITION  position,
MMSFBColor  selcolor,
bool  refresh = true 
)

Definition at line 1027 of file mmsinputwidget.cpp.

void MMSInputWidget::updateFromThemeClass ( MMSInputWidgetClass themeClass  ) 

Definition at line 1036 of file mmsinputwidget.cpp.


Friends And Related Function Documentation

friend class MMSWindow [friend]

Reimplemented from MMSWidget.

Definition at line 187 of file mmsinputwidget.h.

friend class MMSInputWidgetThread [friend]

Definition at line 188 of file mmsinputwidget.h.


Member Data Documentation

string MMSInputWidget::className [private]

Definition at line 46 of file mmsinputwidget.h.

language in which the text is to be translated

Definition at line 51 of file mmsinputwidget.h.

loaded font

Definition at line 54 of file mmsinputwidget.h.

string MMSInputWidget::fontpath [private]

path to the loaded font file

Definition at line 57 of file mmsinputwidget.h.

string MMSInputWidget::fontname [private]

name of the loaded font file

Definition at line 60 of file mmsinputwidget.h.

unsigned int MMSInputWidget::fontsize [private]

requested size of the font

Definition at line 63 of file mmsinputwidget.h.

bool MMSInputWidget::load_font [private]

have to (re)load font?

Definition at line 66 of file mmsinputwidget.h.

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.

Definition at line 71 of file mmsinputwidget.h.

Definition at line 73 of file mmsinputwidget.h.

current foreground values set?

Definition at line 76 of file mmsinputwidget.h.

current foreground color

Definition at line 79 of file mmsinputwidget.h.

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.


The documentation for this class was generated from the following files: