#include <CSTextfield.h>
Inheritance diagram for CSTextfield:
Public Member Functions | |
CSTextfield () | |
CSTextfield (int width) | |
CSTextfield (const std::string &string) | |
virtual | ~CSTextfield () |
virtual std::string | getType () |
void | reactOnMessageTextField (CSMessage *message) |
virtual void | reactOnMessage (CSMessage *message) |
to be overloaded | |
virtual void | paint (SDL_Surface *destination, SDL_Rect *parentViewport) |
virtual void | putString (SDL_Surface *destination, SDL_Rect *parentViewport, int x1, int y1, const std::string &string) |
coordinates relativ to this element | |
virtual std::string | getText () |
virtual void | setText (std::string s) |
virtual void | layoutSetup () |
Static Public Attributes | |
const char * | CLASS = "CSTextfield" |
static element, name of this class (introsepection) | |
Protected Member Functions | |
virtual void | layoutSetupTextfield () |
|
Definition at line 13 of file CSTextfield.cpp. References CSGrafikElement::init(), LOG_ENTER, and LOG_EXIT.
00013 : CSGrafikElement(0, 0) 00014 { 00015 static char *functionName="CSTextfield"; 00016 LOG_ENTER 00017 init(""); 00018 LOG_EXIT 00019 } |
Here is the call graph for this function:
|
Definition at line 21 of file CSTextfield.cpp. References CSGrafikElement::init(), LOG_ENTER, LOG_EXIT, and CSGrafikElement::setWidth().
00021 : CSGrafikElement(0, 0) 00022 { 00023 static char *functionName="CSTextfield"; 00024 LOG_ENTER 00025 setWidth(width); 00026 init(""); 00027 LOG_EXIT 00028 } |
Here is the call graph for this function:
|
Definition at line 30 of file CSTextfield.cpp. References CSGrafikElement::init(), LOG_ENTER, and LOG_EXIT.
00030 : CSGrafikElement(0, 0) 00031 { 00032 static char *functionName="CSTextfield"; 00033 LOG_ENTER 00034 init(text); 00035 LOG_EXIT 00036 } |
Here is the call graph for this function:
|
Definition at line 36 of file CSTextfield.h.
00036 {} |
|
Here is the call graph for this function:
|
Reimplemented from CSGrafikElement. Definition at line 38 of file CSTextfield.h. References CLASS.
00038 {return (std::string) CLASS;} |
|
Definition at line 98 of file CSTextfield.cpp. References GuiMessage::actionId, FOCUS_GAINED_MESSAGE, FOCUS_LOST_MESSAGE, CSDesktop::focusedNextComponent(), CSGrafikElement::getBorder(), CSGrafikElement::getDesktop(), CSGrafikElement::getFont(), CSGrafikElement::getInset(), CSMessage::getSubtype(), CSBorder::getTotalWidth(), CSInset::getTotalWidth(), CSMessage::getType(), CSFont::getWidth(), GUI_MESSAGE, KEY_PRESSED_MESSAGE, KEY_RELEASED_MESSAGE, GuiMessage::keySymbolic, GuiMessage::keyUnicodeChar, CSMessage::mIsHandled, CSGrafikElement::reactOnMessageGrafikElement(), GuiMessage::receiver, CSMessageDispatchable::sendMessage(), and CSGrafikElement::setEnabled(). Referenced by reactOnMessage().
00099 { 00100 static char *functionName="reactOnMessage"; 00101 if (message->mIsHandled) 00102 { 00103 reactOnMessageGrafikElement(message); 00104 return; 00105 } 00106 switch (message->getType()) 00107 { 00108 case GUI_MESSAGE: 00109 { 00110 GuiMessage *gm = (GuiMessage *) message; 00111 if (gm->receiver != this) 00112 { 00113 break; 00114 } 00115 else // receiver == this 00116 { 00117 switch (message->getSubtype()) 00118 { 00119 case FOCUS_GAINED_MESSAGE: 00120 { 00121 setEnabled(true); 00122 mWorkingString = mString; 00123 gm->mIsHandled = true; 00124 break; 00125 } 00126 case FOCUS_LOST_MESSAGE: 00127 { 00128 setEnabled(false); 00129 mString = mWorkingString; 00130 gm->mIsHandled = true; 00131 break; 00132 } 00133 case KEY_RELEASED_MESSAGE: 00134 { 00135 gm->mIsHandled = false; 00136 break; 00137 } 00138 case KEY_PRESSED_MESSAGE: 00139 { 00140 int ch=gm->keyUnicodeChar; 00141 if ((gm->keySymbolic == SDLK_RETURN) || 00142 (gm->keySymbolic == SDLK_KP_ENTER) || 00143 (gm->keySymbolic == SDLK_TAB)) 00144 { 00145 getDesktop()->focusedNextComponent(); 00146 gm->mIsHandled = true; 00147 MESSAGE_TEXT_CHANGED.mIsHandled = false; 00148 MESSAGE_TEXT_CHANGED.actionId = mActionId; 00149 00150 sendMessage(MESSAGE_TEXT_CHANGED); 00151 break; 00152 } 00153 if (((ch>31)||(ch=='\b')) && (ch<128)) 00154 { 00155 int len = mWorkingString.length(); 00156 if (ch=='\b') 00157 { 00158 if (len>0) 00159 { 00160 mWorkingString.resize(len-1); 00161 } 00162 } 00163 else 00164 { 00165 mWorkingString += (char) ch; 00166 00167 len = mWorkingString.length(); 00168 int witdh = getFont()->getWidth(mWorkingString) + getFont()->getWidth("_"); 00169 if (witdh > mWidth - (getInset().getTotalWidth() + getBorder()->getTotalWidth())) 00170 { 00171 mWorkingString.resize(len-1); 00172 } 00173 } 00174 gm->mIsHandled = true; 00175 } 00176 break; 00177 } 00178 } 00179 } 00180 } 00181 } 00182 reactOnMessageGrafikElement(message); 00183 } |
Here is the call graph for this function:
|
to be overloaded
Reimplemented from CSGrafikElement. Definition at line 93 of file CSTextfield.cpp. References reactOnMessageTextField().
00094 { 00095 reactOnMessageTextField(message); 00096 } |
Here is the call graph for this function:
|
Reimplemented from CSGrafikElement. Definition at line 65 of file CSTextfield.cpp. References CSGrafikElement::getBorder(), CSGrafikElement::getFocused(), CSGrafikElement::getFont(), CSGrafikElement::getInset(), CSBorder::getSizeNorth(), CSInset::getSizeNorth(), CSBorder::getSizeWest(), CSInset::getSizeWest(), CSFont::getWidth(), and putString().
00066 { 00067 static char *functionName="paint"; 00068 int xOffset = getInset().getSizeWest() + getBorder()->getSizeWest(); 00069 int yOffset = getInset().getSizeNorth() + getBorder()->getSizeNorth(); 00070 00071 if (getFocused()) 00072 { 00073 float currentTick = SDL_GetTicks() + mCursorRate; 00074 if (currentTick > mTickTimeNext) 00075 { 00076 mTickTimeNext = currentTick + mCursorRate; 00077 mCursorShown = !mCursorShown; 00078 } 00079 00080 putString(destination, parentViewport, xOffset, yOffset, mWorkingString); 00081 if (mCursorShown) 00082 { 00083 int witdh = getFont()->getWidth(mWorkingString); 00084 putString(destination, parentViewport, xOffset + witdh, yOffset, "_"); 00085 } 00086 } 00087 else 00088 { 00089 putString(destination, parentViewport, xOffset, yOffset, mString); 00090 } 00091 } |
Here is the call graph for this function:
|
coordinates relativ to this element no clipping Reimplemented from CSGrafikElement. Definition at line 55 of file CSTextfield.cpp. References CSGrafikElement::getFont(), CSGrafikElement::getTextColor(), CSGrafikElement::getX(), CSGrafikElement::getY(), and CSFont::putString(). Referenced by paint().
00056 { 00057 static char *functionName="putString"; 00058 x1 += parentViewport->x + getX(); 00059 y1 += parentViewport->y + getY(); 00060 getFont()->putString(destination,x1,y1,getTextColor(), string); 00061 } |
Here is the call graph for this function:
|
Definition at line 45 of file CSTextfield.h.
00045 {return mString;}
|
|
Definition at line 46 of file CSTextfield.h.
00046 {mString = s;} |
|
Reimplemented from CSGrafikElement. Definition at line 47 of file CSTextfield.h. References layoutSetupTextfield().
00047 {layoutSetupTextfield();} |
Here is the call graph for this function:
|
static element, name of this class (introsepection)
Reimplemented from CSGrafikElement. Definition at line 11 of file CSTextfield.cpp. Referenced by CSLAF::getAreaInternal(), CSLAF::getBackgroundColorDisabledInternal(), CSLAF::getBackgroundColorEnabledInternal(), CSLAF::getBorderInternal(), CSLAF::getHorizontalElementSpacingInternal(), CSLAF::getTextColorDisabledInternal(), getType(), and CSLAF::getVerticalElementSpacingInternal(). |