Guiliani  Version 2.6 revision 7293 (documentation build 12)
GUIComboBox.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 GUICOMBOBOX__H_
11#define GUICOMBOBOX__H_
12
13#include "GUICompositeObject.h"
14#include "GUICommand.h"
15#include "GUIComboBoxHeader.h"
16#include "GUIListBox.h"
17#include "GUIColorPropertyObserver.h"
18
19class CGUIListItem;
20
22// @guiliani_doxygen toplevel_control Combo Box
35// @endguiliani_doxygen
105{
106public:
110 {
113 };
114
115public:
120
131 CGUICompositeObject* const pkParent,
132 const eC_Value& vX, const eC_Value& vY,
133 const eC_Value& vWidth, const eC_Value& vHeight,
134 const eC_Value& vHeaderButtonWidth,
135 const ObjectHandle_t &eID = NO_HANDLE);
136
138 virtual ~CGUIComboBox();
139
140#ifndef GUILIANI_NO_DATAPOOL
147 virtual eC_Bool SetValue(CDataPoolEntry& rkValue);
148#endif
149
155 virtual eC_Bool SetValue(const CGUIValue& rkValue);
156
167 virtual void Open();
168
175 virtual void Close();
176
180 eC_Bool IsOpen() const;
181
189 eC_Bool AddItem(CGUIListItem* pItem, eC_Bool bIsAutoAdjustArrange = true);
190
197 eC_Bool AddItem(const eC_String& kText, eC_Bool bIsAutoAdjustArrange = true);
198
207 eC_Bool RemoveItem(CGUIListItem* pItem, eC_Bool bIsAutoAdjustArrange = true);
208
218 eC_Bool RemoveItem(const eC_String& kItemStr, eC_Bool bIsAutoAdjustArrange = true);
219
222 void Reset();
223
228 virtual eC_Bool DoDraw();
229
233 eC_Int GetSelection() const;
234
239 void SetSelection(eC_Int iIndex);
240
245 void SetItemSelectedColor(eC_UInt uiItemSelectedColor) const;
246
250 eC_UInt GetItemCount() const;
251
256 CGUIListItem* GetItem(eC_UInt uiIndex) const;
257
261 eC_String GetSelectedItemStr() const;
262
267
272 eC_Int FindItem(const eC_String& kItemStr) const;
273
277 void SetHeaderButtonWidth(const eC_Value& vHeaderButtonWidth) const;
278
288 const ImageResource_t &eBtnStandard,
289 const ImageResource_t &eBtnPressed,
290 const ImageResource_t &eBtnHighlighted,
291 const ImageResource_t &eBtnGrayedOut,
292 const ImageResource_t &eBtnFocused) const;
293
297 void SetHeaderEditable(const eC_Bool& bEditable) const;
298
301 void SetHeaderText(const eC_String& kStr) const;
302
305 eC_String GetHeaderText() const;
306
311
316 void SetHeaderSelectedTextColor(eC_UInt uiCol) const;
317
322 eC_UInt GetSelectedTextColor() const;
323
329
334 void SetLabel(CGUIEditableText* pkText) const;
335
340 void SetCommand(CGUICommandPtr pkCommand);
341
346 virtual eC_Bool DoUserEvent(CGUIEvent* const pEvent);
347
354 virtual eC_Bool DoKeyDown(const GUIKeyIdentifier_t& eKeyID, const eC_UInt& uiModifiers);
355
363 virtual eC_Bool DoChar(const eC_UInt &uiKey, const GUIKeyIdentifier_t &eKeyIdentifier, const eC_UInt &uiModifiers);
364
371 virtual void OnNotification(const CGUIValue& kObservedValue, const CGUIObject* const pkUpdatedObject, const eC_UInt uiX = 0, const eC_UInt uiY = 0);
372
377 virtual void SetWidth(const eC_Value& vWidth);
378
383 virtual void SetHeight(const eC_Value& vHeight);
384
388 eC_String GetPreviousSelection() const;
389
393 void SetInputActionType(const InputActionType_t& eInputActionType);
394
399
403 virtual void LoseFocus();
404
412
417
422 void SetFrameBorderWidth(const eC_Value& vFrameBorderWidth);
423
427 eC_UInt GetFrameBorderColor() const;
428
432 void SetFrameBorderColor(const eC_UInt& uiFrameBorderColor);
433
437 void SetFrameBorderColor(const GlobalProperty_t& eFrameBorderColor);
438
441 eC_Bool FocusAny();
442
446
451 void SetGrayedOut(const eC_Bool &bGrayedOut);
456 void SetDisabled(const eC_Bool& bDisabled);
457
464
471 void SetForceVisible(const eC_Bool& bForceVisible);
472
477 eC_Bool GetForceVisible() const;
478
479#ifdef GUILIANI_STREAM_GUI
480 virtual void ReadFromStream();
481#endif // GUILIANI_STREAM_GUI
482#ifdef GUILIANI_WRITE_GUI
483 virtual void WriteToStream(const eC_Bool bWriteClassID = false);
484#endif // GUILIANI_WRITE_GUI
485
486protected:
496 virtual eC_Bool DoClick(
497 const eC_Value& vAbsX = eC_FromInt(-1),
498 const eC_Value& vAbsY = eC_FromInt(-1));
499
503 virtual void RemoveObject(CGUIObject* pkObject);
504
505private:
507 enum ListPosition_t
508 {
509 UNDER_HEADER,
510 ABOVE_HEADER
511 };
512
513private:
518 void UpdateHeaderString();
519
523 void DetermineListDirection();
524
530 CGUIComboBox(const CGUIComboBox& kSource);
531
537 CGUIComboBox& operator=(const CGUIComboBox& kSource);
538
540 void Init(const eC_Value& vHeaderButtonWidth);
541
542private:
546 CGUIComboBoxHeader* m_pkHeader;
547
551 CGUIListBox* m_pkListBox;
552
554 CGUICommandPtr m_pkCommand;
555
557 eC_String m_kPrevSelectedStr;
558
563 InputActionType_t m_eInputActionType;
564
566 eC_Bool m_bEditing;
567
569 CGUISubject m_kSelectedIndexSubject;
570
572 eC_Value m_vFrameBorderWidth;
573
574 CGUICompositeObject* m_pkOriginalParent;
575 eC_Value m_vOriginalRelXPos;
576 eC_Value m_vOriginalRelYPos;
577
578 eC_Bool m_bForceVisible;
579
580 eC_Int m_iSelectionIndex;
581};
582
583#endif
GUIKeyIdentifier_t
Platform independent key identifiers.
Definition: GUIEventTypeResource.h:207
ImageResource_t
Enumeration of image resource ids.
Definition: GUIImageResource.h:126
ObjectHandle_t
List of object resource ids.
Definition: GUIObjectHandleResource.h:55
GlobalProperty_t
List of property resource ids.
Definition: GUIPropertyResource.h:67
A single entry in the DataPool. The DataPoolEntry class represents a single entry (unique id + a valu...
Definition: GUIDataPool.h:108
This observer provides the base-interface for controls when using color-properties.
Definition: GUIColorPropertyObserver.h:23
Represents the header part of a combo box control.
Definition: GUIComboBoxHeader.h:49
Class for construction of a combo box control.
Definition: GUIComboBox.h:105
virtual eC_Bool DoChar(const eC_UInt &uiKey, const GUIKeyIdentifier_t &eKeyIdentifier, const eC_UInt &uiModifiers)
eC_UInt GetSelectedTextColor() const
virtual eC_Bool DoClick(const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1))
eC_Int FindItem(const eC_String &kItemStr) const
eC_Bool AddItem(const eC_String &kText, eC_Bool bIsAutoAdjustArrange=true)
virtual void ReadFromStream()
eC_Bool RemoveItem(const eC_String &kItemStr, eC_Bool bIsAutoAdjustArrange=true)
InputActionType_t
Definition: GUIComboBox.h:110
@ INPUT_SEARCHED
The typed input string is searched and the matched string is selected into header.
Definition: GUIComboBox.h:112
@ INPUT_INSERTED
The input string is inserted to the list after the user finishes typing.
Definition: GUIComboBox.h:111
void SetHeaderButtonImages(const ImageResource_t &eBtnStandard, const ImageResource_t &eBtnPressed, const ImageResource_t &eBtnHighlighted, const ImageResource_t &eBtnGrayedOut, const ImageResource_t &eBtnFocused) const
void SetHeaderText(const eC_String &kStr) const
virtual ~CGUIComboBox()
This destructor is automatically virtual, as the base class destructor is virtual.
void SetHeaderSelectedTextColor(eC_UInt uiCol) const
virtual void OnNotification(const CGUIValue &kObservedValue, const CGUIObject *const pkUpdatedObject, const eC_UInt uiX=0, const eC_UInt uiY=0)
void SetItemSelectedColor(eC_UInt uiItemSelectedColor) const
InputActionType_t GetInputActionType() const
virtual eC_Bool DoKeyDown(const GUIKeyIdentifier_t &eKeyID, const eC_UInt &uiModifiers)
void SetLabel(CGUIEditableText *pkText) const
void SetHeaderEditable(const eC_Bool &bEditable) const
eC_String GetHeaderText() const
virtual void Close()
virtual void SetWidth(const eC_Value &vWidth)
void SetFrameBorderColor(const GlobalProperty_t &eFrameBorderColor)
CGUIComboBoxHeader * GetHeader() const
CGUIEditableText * GetHeaderLabel() const
virtual eC_Bool SetValue(CDataPoolEntry &rkValue)
virtual void Open()
eC_Bool FocusSelectedItem()
eC_Bool FocusAny()
eC_Int GetSelection() const
void SetCommand(CGUICommandPtr pkCommand)
eC_String GetSelectedItemStr() const
CGUIListBox * GetListBox() const
void AdjustComboBox()
void RemoveSelectionObserver(CGUIObserver *pObserver)
virtual void RemoveObject(CGUIObject *pkObject)
eC_Bool GetForceVisible() const
CGUIComboBox(CGUICompositeObject *const pkParent, const eC_Value &vX, const eC_Value &vY, const eC_Value &vWidth, const eC_Value &vHeight, const eC_Value &vHeaderButtonWidth, const ObjectHandle_t &eID=NO_HANDLE)
virtual eC_Bool DoUserEvent(CGUIEvent *const pEvent)
void SetForceVisible(const eC_Bool &bForceVisible)
eC_Bool RemoveItem(CGUIListItem *pItem, eC_Bool bIsAutoAdjustArrange=true)
void SetGrayedOut(const eC_Bool &bGrayedOut)
eC_UInt GetFrameBorderColor() const
eC_Bool IsOpen() const
eC_String GetPreviousSelection() const
virtual void SetHeight(const eC_Value &vHeight)
virtual eC_Bool SetValue(const CGUIValue &rkValue)
void SetDisabled(const eC_Bool &bDisabled)
virtual void WriteToStream(const eC_Bool bWriteClassID=false)
eC_UInt GetItemCount() const
void SetFrameBorderColor(const eC_UInt &uiFrameBorderColor)
virtual void LoseFocus()
virtual eC_Bool DoDraw()
CGUIListItem * GetItem(eC_UInt uiIndex) const
void SetFrameBorderWidth(const eC_Value &vFrameBorderWidth)
void SetInputActionType(const InputActionType_t &eInputActionType)
eC_Bool AddItem(CGUIListItem *pItem, eC_Bool bIsAutoAdjustArrange=true)
void SetSelection(eC_Int iIndex)
void SetHeaderButtonWidth(const eC_Value &vHeaderButtonWidth) const
This is the Guiliani base class for all composite objects.
Definition: GUICompositeObject.h:70
Specialization of CGUIText that allows for modification and selection of text.
Definition: GUIEditableText.h:62
Base class for Guiliani Events.
Definition: GUIEvent.h:26
Contains list items and can be scrolled if there is not enough space.
Definition: GUIListBox.h:103
A list item is a control that is shown in a list as an element.
Definition: GUIListItem.h:64
This is the Guiliani base class all controls are derived from.
Definition: GUIObject.h:81
Observer Base class for Observer-Design-Pattern within Guiliani.
Definition: GUIObserver.h:28
Subject Base class for Observer-Design-Pattern within Guiliani.
Definition: GUISubject.h:34
CGUIValue stores a single value in one specific type.
Definition: GUIValue.h:25
void AddSelectionObserver(CGUIObserver *pObserver)