3 #include "GUIUniBuffer.h" 4 #include "GUIIMEDelegate.h" 11 struct GUIFontElement;
32 ATTRIBUTE_METHOD1(
CGUIEditBox, GetCaretColor_s, DWORD*) {*p1 = cls->GetCaretColor();
return S_OK;}
33 ATTRIBUTE_METHOD1(
CGUIEditBox, SetCaretColor_s, DWORD) {cls->SetCaretColor(p1);
return S_OK;}
35 ATTRIBUTE_METHOD1(
CGUIEditBox, GetSelectedBackColor_s, DWORD*) {*p1 = cls->GetSelectedBackColor();
return S_OK;}
36 ATTRIBUTE_METHOD1(
CGUIEditBox, SetSelectedBackColor_s, DWORD) {cls->SetSelectedBackColor(p1);
return S_OK;}
38 ATTRIBUTE_METHOD1(
CGUIEditBox, GetEmptyText_s,
const char**) { *p1 = cls->GetEmptyText().c_str();
return S_OK; }
39 ATTRIBUTE_METHOD1(
CGUIEditBox, SetEmptytext_s,
const char*) { cls->SetEmptytext(p1);
return S_OK; }
51 virtual bool CanHaveFocus() {
return (m_bIsVisible && m_bIsEnabled && m_bCanHasFocus); }
52 virtual HRESULT Render(
GUIState* pGUIState ,
float fElapsedTime);
53 virtual bool OnFocusIn();
54 virtual bool OnFocusOut();
55 virtual bool OnMouseEnter();
56 virtual bool OnMouseLeave();
57 virtual bool OnChange(
const char*
code=NULL);
58 virtual void InitObject(
const char * strObjectName,
const char * alignment,
int x,
int y,
int width,
int height);
59 virtual string ToScript(
int option=0);
71 void SetTextA( LPCSTR szText,
bool bSelected );
83 virtual void SetText(
const char16_t* wszText);
90 virtual int GetTextA(std::string& out);
96 virtual const char16_t*
GetText(){
return m_Buffer.GetBuffer(); };
112 HRESULT
CPtoXY(
int nCP, BOOL bTrail,
int *pX,
int *pY,
bool absolute =
false);
115 HRESULT
XYtoCP(
int nX,
int nY,
int *pCP,
int *pnTrail,
bool absolute =
false);
138 HRESULT GetTextCopy( std::u16string& out );
141 void SetSelectedTextColor( Color Color );
142 void SetSelectedBackColor( Color Color );
143 Color GetSelectedBackColor();
144 void SetCaretColor( Color Color );
145 Color GetCaretColor();
146 void SetBorderWidth(
int nBorder ) { m_nBorder = nBorder;
UpdateRects(); }
147 const std::string& GetEmptyText();
148 void SetEmptytext(
const char* utf8Text);
150 void SetTextFloatArray(
const float *pNumbers,
int nCount );
151 bool GetReadOnly()
const{
return m_bReadOnly; }
152 void SetReadOnly(
bool readonly){m_bReadOnly=readonly;}
156 virtual const IType* GetType()
const{
return m_type;}
162 bool IsModified()
const{
return m_bIsModified;}
177 char GetPasswordChar();
185 #ifdef PARAENGINE_MOBILE 188 virtual bool attachWithIME();
189 virtual bool detachWithIME();
195 virtual void insertText(
const char * text,
size_t len);
200 static const IType* m_type;
201 void PlaceCaret(
int nCP );
202 void DeleteSelectionText();
203 void ResetCaretBlink();
204 void CopyToClipboard();
205 void PasteFromClipboard();
207 void InsertChar( WCHAR wChar,
int index=-1);
208 void InsertCharA( CHAR Char,
int index=-1);
216 double m_dfLastBlink;
224 bool m_bMultipleLine;
231 double m_last_keytime;
238 std::string m_empty_text_utf8;
HRESULT CPtoXY(int nCP, BOOL bTrail, int *pX, int *pY, bool absolute=false)
Character position to X,Y in pixel.
Definition: GUIEdit.cpp:1289
void SetPasswordChar(char PasswordChar)
The PasswordChar property specifies the character displayed in the text box.
Definition: GUIEdit.cpp:1246
IType is for type information and validating It contains type information of an object.
Definition: Type.h:75
virtual bool HasClickEvent()
return true, if this control can be clicked.
Definition: GUIEdit.cpp:1821
static void StaticInit()
Initialize the event mapping for the default CGUIEdit class All its inheritances should have a Static...
Definition: GUIEdit.cpp:132
void GetPriorWordPos(int nCP, int *pPrior)
get the prior word position
Definition: GUIEdit.cpp:1279
int GetTextSize()
return the text size in Unicode character count.
Definition: GUIEdit.cpp:1273
an attribute class is a collection of attribute fields.
Definition: AttributeClass.h:10
virtual const char * GetAttributeClassDescription()
a static string, describing the attribute class object
Definition: GUIEdit.h:28
char m_PasswordChar
The PasswordChar, by default it is '\0'.
Definition: GUIEdit.h:235
virtual bool MsgProc(MSG *event)
the procedure that handles all the events.
Definition: GUIEdit.cpp:896
virtual void didDetachWithIME()
When the delegate detaches from the IME, this method is called by IMEDispatcher.
Definition: GUIIMEDelegate.h:37
Definition: EventBinding.h:22
virtual void didAttachWithIME()
When the delegate detaches from the IME, this method is called by IMEDispatcher.
Definition: GUIIMEDelegate.h:27
different physics engine has different winding order.
Definition: EventBinding.h:32
void SetTextA(LPCSTR szText, bool bSelected)
set the text.
Definition: GUIEdit.cpp:605
virtual const char * GetAttributeClassName()
a static string, describing the attribute class object's name
Definition: GUIEdit.h:26
int GetFirstVisibleCharIndex()
if the text is longer than the edit box, the returned value is the index of the first visible charact...
Definition: GUIEdit.h:102
bool IsCaretVisible()
Flag to indicate whether caret is currently visible.
Definition: GUIEdit.cpp:513
int GetCaretPosition()
return Caret position in characters
Definition: GUIEdit.cpp:1255
virtual int GetAttributeClassID()
attribute class ID should be identical, unless one knows how overriding rules work.
Definition: GUIEdit.h:24
void GetTextLineSize(int *width, int *height)
get the text line size in pixels, supposing the current font and text will be rendered in a single li...
Definition: GUIEdit.cpp:1369
base object for all 2D GUI objects (1) 2D GUI object are not tested against view frustum, instead it is controlled by visibility tag automatically or through user input.
Definition: GUIBase.h:54
virtual void SetTextA(const char *szText)
Set the text of this object.
Definition: GUIEdit.h:77
base class for object, such as CBaseObject, IAttributeObject, GUI object.
Definition: PERef.h:287
virtual bool canAttachWithIME()
Decide if the delegate instance is ready to receive an IME message.
Definition: GUIIMEDelegate.h:22
virtual int OnHandleWinMsgChars(const std::wstring &sChars)
this function is called to handle window's latest WM_CHAR message, when the control got key focus...
Definition: GUIEdit.cpp:1771
virtual void Reset()
Resets the objects states.
Definition: GUIEdit.cpp:884
virtual int GetTextA(std::string &out)
get the text of the control
Definition: GUIEdit.cpp:1826
HRESULT XYtoCP(int nX, int nY, int *pCP, int *pnTrail, bool absolute=false)
X,Y in pixel to character position.
Definition: GUIEdit.cpp:1395
virtual void SetText(const char16_t *wszText)
Set the text of this object The control internally store everything in Unicode.
Definition: GUIEdit.cpp:615
virtual IObject * Clone() const
Clone the object's contains and return a pointer to the newly created object.
Definition: GUIEdit.cpp:125
It's used as parameter to Render method of each GUI object.
Definition: GUIState.h:16
virtual bool canDetachWithIME()
Decide if the delegate instance can stop receiving IME messages.
Definition: GUIIMEDelegate.h:32
virtual void deleteBackward()
Called by IMEDispatcher after the user clicks the backward key.
Definition: GUIIMEDelegate.h:47
void SetCaretPosition(int nCharacterPos)
Set Caret position in characters.
Definition: GUIEdit.cpp:1261
base interface for cross-platform IME and also null implementation under win32 client.
Definition: GUIIMEDelegate.h:10
Definition: inftrees.h:24
virtual const std::string & getContentText()
Called by IMEDispatcher for text stored in delegate.
Definition: GUIIMEDelegate.h:52
virtual bool IsHideCaret()
whether caret is hidden.
Definition: GUIEdit.h:131
virtual const char16_t * GetText()
get the text of the control The control internally store everything in Unicode.
Definition: GUIEdit.h:96
Null implementation.
Definition: GUIUniBuffer.h:176
void GetNextWordPos(int nCP, int *pNext)
get the next word position
Definition: GUIEdit.cpp:1284
std::u16string m_empty_text
text to show when text is empty: this is usually something like "click to enter text" ...
Definition: GUIEdit.h:237
virtual void UpdateRects()
Definition: GUIEdit.cpp:652
Definition: ParaColor.h:275
void SetCaretVisible(bool bVisible)
Flag to indicate whether caret is currently visible.
Definition: GUIEdit.cpp:508
virtual void insertText(const char *text, size_t len)
Called by IMEDispatcher when text input received from the IME.
Definition: GUIIMEDelegate.h:42
virtual int InstallFields(CAttributeClass *pClass, bool bOverride)
this class should be implemented if one wants to add new attribute.
Definition: GUIEdit.cpp:1925