Guiliani  Version 2.5 revision 7293 (documentation build 13)
GUIEdit.h
1/*
2* Copyright (C) TES Electronic Solutions GmbH,
3* All Rights Reserved.
4* Contact: info@guiliani.de
5*
6* This file is part of the Guiliani HMI framework
7* for the development of graphical user interfaces on embedded systems.
8*/
9
10#ifndef GUIEDIT_H
11#define GUIEDIT_H
12
13#include "GUIObject.h"
14#include "GUITextResource.h"
15
18
20
56// @guiliani_doxygen limitations CGUIEdit
60// @endguiliani_doxygen
65class CGUIEdit : public CGUIObject
66{
67public:
70 {
81 };
82
94 CGUICompositeObject* const pkParent,
95 const eC_Value& vX, const eC_Value& vY,
96 const eC_Value& vWidth, const eC_Value& vHeight,
97 const eC_String &rkText,
98 AcceptedChars_t eAcceptedChars = AC_ALL,
99 const ObjectHandle_t &eID = NO_HANDLE);
100
109 CGUICompositeObject* const pkParent,
110 const CGUIRect &kRect,
111 const eC_String &rkText,
112 AcceptedChars_t eAcceptedChars = AC_ALL,
113 const ObjectHandle_t &eID = NO_HANDLE);
114
118 CGUIEdit(const CGUIEdit& rkSource);
119
122
127 CGUIEdit& operator=(const CGUIEdit& rkSource);
128
129 virtual eC_Bool DoDraw();
130
131 virtual eC_Bool IsHighlightable() const { return false; }
132
134
156 eC_Bool DoKeyDown(const GUIKeyIdentifier_t &eKeyIdentifier, const eC_UInt &uiModifiers);
157
168 eC_Bool DoChar(
169 const eC_UInt &uiKey,
170 const GUIKeyIdentifier_t &eKeyIdentifier,
171 const eC_UInt &uiModifiers);
172
176 CGUIEditableText* GetLabel() { return m_pkText; }
177
183
184 void SetWidth(const eC_Value& vX);
185
190 void SetHeight(const eC_Value& vY);
191
195 void SetMaxLength(eC_Int iMaxLength);
196
198 inline eC_Int GetMaxLength() const { return m_iMaxLength; }
199
205 void SetAcceptedChars(AcceptedChars_t eAcceptedChars);
206
210 inline AcceptedChars_t GetAcceptedChars() const { return m_eAcceptedChars; }
211
216 virtual void SetTextString(const eC_String& rkTextString);
217
222 virtual void SetTextID(const TextResource_t &eTextID);
223
230 void InsertTextString(const eC_String& rkTextString);
231
236
241
244 virtual void GetFocus();
245
250 virtual void LoseFocus();
251
256
266 virtual eC_Bool DoButtonDown(const eC_Value& vAbsX, const eC_Value& vAbsY);
267
274 virtual eC_Bool DoDoubleClick(const eC_Value& vAbsX=eC_FromInt(-1), const eC_Value& vAbsY=eC_FromInt(-1));
275
283 virtual eC_Bool DoDrag(const eC_Value& vDeltaX, const eC_Value& vDeltaY, const eC_Value& vAbsX, const eC_Value& vAbsY);
284
288 virtual void DoAnimate(const eC_Value& vTimes = eC_FromInt(1));
289
297
302
309
315 void SetResetCursorWhenFocusLost(const eC_Bool bResetCursor) { m_bResetCursorWhenFocusLost = bResetCursor; }
316
317#ifdef GUILIANI_STREAM_GUI
318 virtual void ReadFromStream();
319#endif
320
321#ifdef GUILIANI_WRITE_GUI
322 virtual void WriteToStream(const eC_Bool bWriteClassID = false);
323#endif
324
325private:
327 void Init();
328
332 void CopyAttributes(const CGUIEdit& rkSource);
333
337 void StartCursorBlinking();
338
341 void StopCursorBlinking();
342
348 eC_Bool IsCharAllowed(eC_UInt uiChar) const;
349
352 CGUIEditableText *m_pkText;
353
358 eC_Bool m_bPreviousCharacterWasIntermittent;
359
361 AcceptedChars_t m_eAcceptedChars;
362
364 CGUISubject m_kTextChangedSubject;
365
367 eC_Int m_iMaxLength;
368
370 eC_Bool m_bResetCursorWhenFocusLost;
371};
372
373#endif
GUIKeyIdentifier_t
Platform independent key identifiers.
Definition: GUIEventTypeResource.h:205
ObjectHandle_t
List of object resource ids.
Definition: GUIObjectHandleResource.h:55
Helper Macros in Guiliani
TextResource_t
List of text resource ids.
Definition: GUITextResource.h:40
This is the Guiliani base class for all composite objects.
Definition: GUICompositeObject.h:70
No-frills text input control, not to be used on its own.
Definition: GUIEdit.h:66
virtual void SetTextID(const TextResource_t &eTextID)
virtual eC_Bool DoButtonDown(const eC_Value &vAbsX, const eC_Value &vAbsY)
void InsertTextString(const eC_String &rkTextString)
virtual eC_Bool DoDraw()
virtual void GetFocus()
virtual void ReadFromStream()
void EnsureCursorVisible()
void RemoveTextChangedObserver(CGUIObserver *pObserver)
void SetResetCursorWhenFocusLost(const eC_Bool bResetCursor)
Definition: GUIEdit.h:315
virtual void SetTextString(const eC_String &rkTextString)
CGUIEditableText * GetLabel()
Definition: GUIEdit.h:176
eC_String DeleteSelectedTextString()
CGUIEdit(CGUICompositeObject *const pkParent, const eC_Value &vX, const eC_Value &vY, const eC_Value &vWidth, const eC_Value &vHeight, const eC_String &rkText, AcceptedChars_t eAcceptedChars=AC_ALL, const ObjectHandle_t &eID=NO_HANDLE)
virtual eC_Bool DoDoubleClick(const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1))
virtual eC_Bool IsHighlightable() const
Definition: GUIEdit.h:131
void SetHeight(const eC_Value &vY)
AcceptedChars_t
Sets of characters that are accepted as input in a CGUIEdit.
Definition: GUIEdit.h:70
@ AC_NONE
No characters.
Definition: GUIEdit.h:80
@ AC_LETTERS
All letters of the Latin alphabet and whitespace characters.
Definition: GUIEdit.h:74
@ AC_ALL
All characters.
Definition: GUIEdit.h:72
@ AC_DIGITS
Arabic digits.
Definition: GUIEdit.h:76
@ AC_ALPHANUMERIC
Latin letters, arabic digits and whitespace characters.
Definition: GUIEdit.h:78
void SetWidth(const eC_Value &vX)
eC_Int GetMaxLength() const
Definition: GUIEdit.h:198
CGUIEdit(const CGUIEdit &rkSource)
CGUIEdit & operator=(const CGUIEdit &rkSource)
virtual void WriteToStream(const eC_Bool bWriteClassID=false)
eC_Bool DoChar(const eC_UInt &uiKey, const GUIKeyIdentifier_t &eKeyIdentifier, const eC_UInt &uiModifiers)
void SetLabel(CGUIEditableText *pkText)
AcceptedChars_t GetAcceptedChars() const
Definition: GUIEdit.h:210
void SetAcceptedChars(AcceptedChars_t eAcceptedChars)
CGUIEdit(CGUICompositeObject *const pkParent, const CGUIRect &kRect, const eC_String &rkText, AcceptedChars_t eAcceptedChars=AC_ALL, const ObjectHandle_t &eID=NO_HANDLE)
void SetMaxLength(eC_Int iMaxLength)
virtual void LoseFocus()
eC_Bool DoKeyDown(const GUIKeyIdentifier_t &eKeyIdentifier, const eC_UInt &uiModifiers)
Edits the text in reaction to keyboard events.
eC_String GetSelectedTextString()
virtual void DoAnimate(const eC_Value &vTimes=eC_FromInt(1))
virtual eC_Bool DoDrag(const eC_Value &vDeltaX, const eC_Value &vDeltaY, const eC_Value &vAbsX, const eC_Value &vAbsY)
Specialization of CGUIText that allows for modification and selection of text.
Definition: GUIEditableText.h:61
Represents platform-independent keyboard events.
Definition: GUIEvent.h:114
This is the Guiliani base class all controls are derived from.
Definition: GUIObject.h:79
Observer Base class for Observer-Design-Pattern within Guiliani.
Definition: GUIObserver.h:28
Helper class to supply a platform independent rectangle implementation.
Definition: GUIRect.h:63
Subject Base class for Observer-Design-Pattern within Guiliani.
Definition: GUISubject.h:34
void AddTextChangedObserver(CGUIObserver *pObserver)