Guiliani  Version 2.6 revision 7293 (documentation build 12)
GUIOnscreenKeyboard.h
1#if !defined(ONSCREENKEYBOARD_H)
2#define ONSCREENKEYBOARD_H
3
4#include "GUIObject.h"
5
6#include "GUIOnscreenKeyboardLayout.h"
7
8#include "GUIColorPropertyObserver.h"
9#include "GUIImageResource.h"
10#include "GUIFontResource.h"
12#include "GUIEdit.h"
13#include "GUINinePatch.h"
14#include "GUIGeneralResourceManager.h"
15
22{
23public:
26 {
30 bSelected(false),
31 uiLineIndex(0),
32 uiKeyIndex(0),
33 bSubCharsSelected(false),
36 {}
37
42 void Set(const eC_UInt& LineIndex, const eC_UInt& KeyIndex)
43 {
44 bSelected = true;
45 uiLineIndex = LineIndex;
46 uiKeyIndex = KeyIndex;
47 }
48
51 void Reset()
52 {
53 bSelected = false;
54 uiLineIndex = 0;
55 uiKeyIndex = 0;
56 bSubCharsSelected = false;
59 }
60
65 void SetSubChars(const eC_UInt& LineIndex, const eC_UInt& KeyIndex)
66 {
67 bSubCharsSelected = true;
68 uiSubCharLineIndex = LineIndex;
69 uiSubCharsKeyIndex = KeyIndex;
70 }
71
77 eC_Bool Equals(const eC_UInt& LineIndex, const eC_UInt& KeyIndex)
78 {
79 if (bSelected)
80 {
81 if ((LineIndex == uiLineIndex) && (KeyIndex == uiKeyIndex))
82 return true;
83 }
84 return false;
85 }
86
87 eC_Bool bSelected;
88 eC_UInt uiLineIndex;
89 eC_UInt uiKeyIndex;
93 };
94
95public:
105 CGUICompositeObject* const pkParent,
106 const eC_Value& vX, const eC_Value& vY,
107 const eC_Value& vWidth, const eC_Value& vHeight,
108 const ObjectHandle_t &eID = NO_HANDLE);
109
113
117
122 void LoadLayout(const GeneralResource_t& reResource);
123
130 eC_Bool LoadLayout(eC_File* pkFile, const eC_String& kFileExtension);
131
137 eC_Bool LoadLayout(const eC_String& rkLayoutFile);
138
143
148
149 // attributes
153 void SetFont(const FontResource_t& eFont);
154
159
163 void SetFontColor(const GlobalProperty_t& eProperty);
164
168 void SetFontColor(const eC_UInt& uiColor);
169
173 eC_UInt GetFontColor() const;
174
179
183 void SetFontColorSelected(const eC_UInt& uiColor);
184
188 eC_UInt GetFontColorSelected() const;
189
194
199
203 void SetBackgroundColor(const GlobalProperty_t& eProperty);
204
208 void SetBackgroundColor(const eC_UInt& uiColor);
209
213 eC_UInt GetBackgroundColor() const;
214
219
224
229
233 void SetBackgroundColorSelected(const eC_UInt& uiColor);
234
239
243 void SetOverlayColor(const GlobalProperty_t& eProperty);
244
248 void SetOverlayColor(const eC_UInt& uiColor);
249
253 eC_UInt GetOverlayColor() const;
254
258 void SetOverlayImage(const ImageResource_t& eImage);
259
264
269
273 void SetTargetObject(const ObjectHandle_t& eObjectID);
274
279
283 void SetUseOverlay(const eC_Bool& bUseOverlay);
284
288 eC_Bool GetUseOverlay() const;
289
293 void SetAllowSubChars(const eC_Bool& bAllowSubChars);
294
298 eC_Bool GetAllowSubChars() const;
299
303 void SetPageIndex(const eC_UByte& ubPageIndex);
304
308 eC_UInt GetPageIndex() const;
309
310 virtual void SetWidth(const eC_Value& vWidth);
311 virtual void SetHeight(const eC_Value& vHeight);
312
313 virtual void DoAnimate(const eC_Value& vTimes = eC_FromInt(1));
314
315 virtual eC_Bool DoDraw();
316
317 virtual eC_Bool DoButtonDown(
318 const eC_Value& vAbsX = eC_FromInt(-1),
319 const eC_Value& vAbsY = eC_FromInt(-1));
320
321 virtual eC_Bool DoButtonUp(
322 const eC_Value& vAbsX = eC_FromInt(-1),
323 const eC_Value& vAbsY = eC_FromInt(-1));
324
325 virtual eC_Bool DoDrag(
326 const eC_Value& vDeltaX = eC_FromInt(-1),
327 const eC_Value& vDeltaY = eC_FromInt(-1),
328 const eC_Value& vAbsX = eC_FromInt(-1),
329 const eC_Value& vAbsY = eC_FromInt(-1));
330
331#if defined(GUILIANI_STREAM_GUI)
336 virtual void ReadFromStream();
337#endif
338
339#if defined(GUILIANI_WRITE_GUI)
345 virtual void WriteToStream(const eC_Bool bWriteClassID = false);
346#endif
347
348private:
349 void Init();
350 void DeInit();
351
352 void DrawKey(
353 eC_String* pkString,
354 const eC_Value& vPosX,
355 const eC_Value& vPosY,
356 const eC_Value& vWidth,
357 const eC_Value& vHeight,
358 const eC_UInt& uiColor);
359
360 void GetObject();
361
362 eC_Bool GetKeyIndex(
363 const eC_Value& vAbsX, const eC_Value& vAbsY,
364 eC_Bool& bSubChars,
365 eC_UInt& ruiLineIndex, eC_UInt& ruiKeyIndex) const;
366
367 CGUIOnscreenKeyboardLayout::KeyboardKey_t* GetSelectedKey() const;
368
369 void InsertKey();
370
371 void StartTimer(const eC_UInt& uiInterval);
372 void StopTimer();
373
374 void ExpandKeyboard(const eC_Value& vNeededHeight);
375 void ResetKeyboard();
376
377 void DrawSelectedBackground(const CGUIRect& kRect);
378
379private:
380 static const eC_UInt INDEX_FONT_COLOR;
381 static const eC_UInt INDEX_FONT_COLOR_SELECTED;
382 static const eC_UInt INDEX_BACKGROUND_COLOR;
383 static const eC_UInt INDEX_BACKGROUND_COLOR_SELECTED;
384 static const eC_UInt INDEX_BACKGROUND_COLOR_OVERLAY;
385
386 GeneralResource_t m_eLayout;
387
388 FontResource_t m_eFont;
389 ImageResource_t m_eImage;
390 ImageResource_t m_eImageSelected;
391 ImageResource_t m_eImageOverlay;
392
393 CGUINinePatch m_kNinePatch;
394
395 ObjectHandle_t m_eTargetObject;
396 CGUIEdit* m_pkEdit;
397
398 eC_UByte m_ubCurrentPageIndex;
399 CGUIOnscreenKeyboardLayout* m_pkLayout;
400
401 eC_Bool m_bShowSubChars;
402 CGUIRect m_kSubCharsRect;
403 eC_Bool m_bButtonDown;
404 SelectedButton_t m_kLastSelectedButton;
405
406 eC_Bool m_bUseOverlay;
407 eC_Bool m_bAllowSubChars;
408 eC_Bool m_bExpanded;
409 eC_Value m_vOriginalYPos;
410 eC_Value m_vOriginalHeight;
411 eC_Bool m_bTimerTriggered;
412};
413
417{
418public:
423 OnScreenKeyboardLayoutInterpreter(CGUIOnscreenKeyboard* pkObject, const eC_String& kFileExtension) :
425 m_pkObject(pkObject),
426 m_kFileExtension(kFileExtension)
427 {}
428
432 virtual void Interpret(eC_File* pkFile)
433 {
434 if (NULL != m_pkObject)
435 m_pkObject->LoadLayout(pkFile, m_kFileExtension);
436 }
437
438private:
439 CGUIOnscreenKeyboard* m_pkObject;
440 eC_String m_kFileExtension;
441};
442
443#endif
Helper Macros in Guiliani
FontResource_t
List of font resource ids.
Definition: GUIFontResource.h:54
GeneralResource_t
List of general resource ids.
Definition: GUIGeneralResource.h:52
Helper Macros in Guiliani
ImageResource_t
Enumeration of image resource ids.
Definition: GUIImageResource.h:126
Helper Macros in Guiliani
ObjectHandle_t
List of object resource ids.
Definition: GUIObjectHandleResource.h:55
GlobalProperty_t
List of property resource ids.
Definition: GUIPropertyResource.h:67
This observer provides the base-interface for controls when using color-properties.
Definition: GUIColorPropertyObserver.h:23
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
Interpreter for general resources.
Definition: GUIGeneralResourceManager.h:52
Helper class to for storing Nine-Patch images.
Definition: GUINinePatch.h:41
This is the Guiliani base class all controls are derived from.
Definition: GUIObject.h:81
This class represents an onscreenkeyboard.
Definition: GUIOnscreenKeyboard.h:22
void SetUseOverlay(const eC_Bool &bUseOverlay)
virtual eC_Bool DoButtonUp(const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1))
eC_UInt GetBackgroundColor() const
eC_UInt GetPageIndex() const
virtual eC_Bool DoButtonDown(const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1))
eC_Bool GetAllowSubChars() const
eC_UInt GetFontColor() const
virtual void ReadFromStream()
ImageResource_t GetBackgroundImageSelected() const
virtual void WriteToStream(const eC_Bool bWriteClassID=false)
void SetFontColorSelected(const eC_UInt &uiColor)
void SetFontColor(const GlobalProperty_t &eProperty)
void SetFontColorSelected(const GlobalProperty_t &eProperty)
void SetBackgroundImageSelected(const ImageResource_t &eImage)
void SetOverlayColor(const eC_UInt &uiColor)
void SetBackgroundColorSelected(const eC_UInt &uiColor)
void SetBackgroundColor(const GlobalProperty_t &eProperty)
CGUIOnscreenKeyboard(CGUICompositeObject *const pkParent, const eC_Value &vX, const eC_Value &vY, const eC_Value &vWidth, const eC_Value &vHeight, const ObjectHandle_t &eID=NO_HANDLE)
CGUIOnscreenKeyboardLayout * GetLayout() const
eC_UInt GetFontColorSelected() const
eC_Bool LoadLayout(const eC_String &rkLayoutFile)
void SetBackgroundImage(const ImageResource_t &eImage)
virtual eC_Bool DoDrag(const eC_Value &vDeltaX=eC_FromInt(-1), const eC_Value &vDeltaY=eC_FromInt(-1), const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1))
virtual void SetHeight(const eC_Value &vHeight)
ImageResource_t GetBackgroundImage() const
void SetBackgroundColor(const eC_UInt &uiColor)
virtual void SetWidth(const eC_Value &vWidth)
void SetOverlayColor(const GlobalProperty_t &eProperty)
void SetFontColor(const eC_UInt &uiColor)
void SetTargetObject(const ObjectHandle_t &eObjectID)
void SetOverlayImage(const ImageResource_t &eImage)
eC_Bool GetUseOverlay() const
FontResource_t GetFont() const
ImageResource_t GetOverlayImage() const
ObjectHandle_t GetTargetObject() const
void SetAllowSubChars(const eC_Bool &bAllowSubChars)
eC_UInt GetOverlayColor() const
virtual void DoAnimate(const eC_Value &vTimes=eC_FromInt(1))
eC_UInt GetBackgroundColorSelected() const
void LoadLayout(const GeneralResource_t &reResource)
void SetLayout(CGUIOnscreenKeyboardLayout *pkLayout)
void SetFont(const FontResource_t &eFont)
CGUINinePatch & GetNinePatch()
virtual eC_Bool DoDraw()
eC_Bool LoadLayout(eC_File *pkFile, const eC_String &kFileExtension)
void SetPageIndex(const eC_UByte &ubPageIndex)
void SetBackgroundColorSelected(const GlobalProperty_t &eProperty)
Layout for an OnScreenKeyboard.
Definition: GUIOnscreenKeyboardLayout.h:13
Helper class to supply a platform independent rectangle implementation.
Definition: GUIRect.h:63
Definition: GUIOnscreenKeyboard.h:417
OnScreenKeyboardLayoutInterpreter(CGUIOnscreenKeyboard *pkObject, const eC_String &kFileExtension)
Definition: GUIOnscreenKeyboard.h:423
virtual void Interpret(eC_File *pkFile)
Definition: GUIOnscreenKeyboard.h:432
selected button
Definition: GUIOnscreenKeyboard.h:26
eC_UInt uiSubCharLineIndex
index of line in subchar
Definition: GUIOnscreenKeyboard.h:91
eC_UInt uiLineIndex
index of line
Definition: GUIOnscreenKeyboard.h:88
void Set(const eC_UInt &LineIndex, const eC_UInt &KeyIndex)
Definition: GUIOnscreenKeyboard.h:42
eC_Bool Equals(const eC_UInt &LineIndex, const eC_UInt &KeyIndex)
Definition: GUIOnscreenKeyboard.h:77
SelectedButton_t()
Definition: GUIOnscreenKeyboard.h:29
eC_Bool bSelected
button selected
Definition: GUIOnscreenKeyboard.h:87
eC_UInt uiKeyIndex
index of key
Definition: GUIOnscreenKeyboard.h:89
eC_Bool bSubCharsSelected
subchar selected
Definition: GUIOnscreenKeyboard.h:90
void Reset()
Definition: GUIOnscreenKeyboard.h:51
eC_UInt uiSubCharsKeyIndex
index of key in subchar
Definition: GUIOnscreenKeyboard.h:92
void SetSubChars(const eC_UInt &LineIndex, const eC_UInt &KeyIndex)
Definition: GUIOnscreenKeyboard.h:65
struct for a key
Definition: GUIOnscreenKeyboardLayout.h:33