Guiliani  Version 2.5 revision 7293 (documentation build 13)
GUIListBox.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 __GUILISTBOX__H_
11#define __GUILISTBOX__H_
12
13#include "GUIScrollView.h"
14#include "eC_TList_doubleLinked.h"
16#include "GUIPropertyResource.h"
17#include "GUIColorPropertyObserver.h"
18
19class CGUIListItem;
20
22// @guiliani_doxygen toplevel_control List Box
33// @endguiliani_doxygen
103{
104public:
105
108
111
114
125 {
126 VER_EXT,
127 HOR_EXT
128 };
129
130public:
142 CGUICompositeObject* const pkParent,
143 const eC_Value& vX, const eC_Value& vY,
144 const eC_Value& vWidth, const eC_Value& vHeight,
145 const Mode_t & eMode = VER_EXT,
146 const eC_Bool & bMultipleSelection = false,
147 const ObjectHandle_t &eID = NO_HANDLE);
148
157 CGUICompositeObject* const pkParent,
158 const CGUIRect &kRect,
159 const Mode_t & eMode = VER_EXT,
160 const eC_Bool & bMultipleSelection = false,
161 const ObjectHandle_t &eID = NO_HANDLE);
162
163#ifdef GUILIANI_STREAM_GUI
166#endif
167
170
181 eC_Bool AddItem(CGUIListItem* pItem, eC_Bool bIsAutoAdjustArrange = true);
182
184
189 eC_Bool RemoveItem(CGUIListItem* pItem, eC_Bool bIsAutoAdjustArrange = true);
190
198 eC_Bool RemoveItems(eC_UInt uiStartIndex, eC_UInt uiEndIndex, eC_Bool bIsAutoAdjustArrange = true);
199
204 eC_Bool AddSelection(eC_UInt uiIndex);
205
209 void SetBgColor(const eC_UInt& uiBgColor);
210
214 void SetBgColor(const GlobalProperty_t& eBgColor);
215
219 void SetDraggedFrameBgColor(const eC_UInt& uiDraggedFrameBgColor);
220
224 void SetDraggedFrameBgColor(const GlobalProperty_t& eDraggedFrameBgColor);
225
229 eC_Int GetSelection();
230
235
240 void SetSelection(eC_UInt uiIndex);
241
245 void ReleaseSelection(eC_UInt uiIndex);
246
250
256
261
267 void SetItemSelectedColor(eC_UInt uiItemSelectedColor);
268
272 eC_UInt GetItemCount() const;
273
279 CGUIListItem* GetItem(eC_UInt uiIndex);
280
287
292 eC_Bool SelectObject(const CGUIObject* pObj);
293
298 eC_Bool IsObjectAnItemInList(const CGUIObject* pObj) const;
299
303
308 eC_Int FindItem(const eC_String& kItemStr) const;
309
316 eC_Int FindItemBySubstring(const eC_String& kSearchString) const;
317
322 void SetWidth(const eC_Value& vWidth);
323
328 void SetHeight(const eC_Value& vHeight);
329
333 virtual eC_Bool DoDraw();
334
338 eC_Bool DoPostDraw();
339
345 virtual eC_Bool DoClick(
346 const eC_Value& vAbsX = (eC_FromInt(-1)),
347 const eC_Value& vAbsY = (eC_FromInt(-1)));
348
352 virtual eC_Bool RequestFocusForSelection();
353
360 eC_Bool DoKeyDown(
361 const GUIKeyIdentifier_t& eKeyID,
362 const eC_UInt& uiModifiers);
363
371 virtual eC_Bool DoMouseEnter(
372 const eC_Value& vAbsX,
373 const eC_Value& vAbsY);
374
382
390 virtual eC_Bool DoButtonDown(const eC_Value& vAbsX, const eC_Value& vAbsY);
391
397 virtual eC_Bool DoDragEnd(const eC_Value& vAbsX, const eC_Value& vAbsY);
398
407 virtual eC_Bool DoDrag(const eC_Value& vDeltaX, const eC_Value& vDeltaY, const eC_Value& vAbsX, const eC_Value& vAbsY);
408
413 eC_Int GetItemIndexOfObject(const CGUIObject* pObj) const;
414
415
416#ifdef GUILIANI_STREAM_GUI
417 virtual void ReadFromStream();
418#endif
419
420#ifdef GUILIANI_WRITE_GUI
421 virtual void WriteToStream(const eC_Bool bWriteClassID = false);
422#endif
423
427 void SetMultipleSelection(const eC_Bool& bMultiSelection);
428
432 void SetUseKeyboard(const eC_Bool& bUseKeyboard);
433
437 void SetSelectedByHighlighting(const eC_Bool& bSelectedByHighlighting);
438
442 void SetUnifyItemSize(const eC_Bool& bUnifyItemSize);
443
447 eC_Bool FocusAny();
448
456
461
462protected:
464 void Init();
465
467 virtual void GetFocus();
468
473 void UpdateSelection(const CGUIObject* pkObject, const CGUIEvent* pEvent);
474
475private:
478 CGUIListBox(const CGUIListBox& kSource);
479
482 CGUIListBox& operator =(const CGUIListBox &kSource);
483
486 eC_Bool AddObject(CGUIListItem* pkObject);
487
490 eC_Bool AddObject(CGUIObject* pkObject);
491
494 void RemoveObject(CGUIObject* pkObject){return CGUIScrollView::RemoveObject(pkObject);}
495
499 void AdjustArrangementVER_EXT(eC_Bool bVerBarIsVisible = false);
500
504 void AdjustArrangementHOR_EXT(eC_Bool bHorBarIsVisible = false);
505
510 void DragAndSelectItems(const eC_Bool bShiftPressed, const eC_Bool bCtrlPressed);
511
514 void RegenerateIndexStringList();
515
516private:
517 static const eC_UInt INDEX_COLOR_BACKGROUND;
518 static const eC_UInt INDEX_COLOR_DRAGGEDFRAME;
519
522 ItemPtrList_t m_kItemList;
523
526 IndexList_t m_kSelIndexList;
527
530 StringList_t m_kSelStringList;
531
534 Mode_t m_eMode;
535
538 eC_Bool m_bMultipleSelection;
539
542 eC_Bool m_bUseKeyboard;
543
545 CGUIRect m_kSelectionFrame;
546
549 eC_Value m_vAbsXPosClickPoint;
550
553 eC_Value m_vAbsYPosClickPoint;
554
557 eC_Bool m_bIndexStringListDirty;
558
560 ItemPtrList_t::Iterator m_kCurAccessedItemIter;
561
563 eC_Bool m_bSelectedByHighlighting;
564
566 eC_Bool m_bUnifyItemSize;
567
569 CGUISubject m_kSelectedIndexSubject;
570};
571#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
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
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
void SetDraggedFrameBgColor(const eC_UInt &uiDraggedFrameBgColor)
~CGUIListBox()
Destructor.
void ReleaseSelection(eC_UInt uiIndex)
Mode_t
Definition: GUIListBox.h:125
void SetUnifyItemSize(const eC_Bool &bUnifyItemSize)
eC_Bool SelectObject(const CGUIObject *pObj)
virtual void GetFocus()
Reimplemented to handle selection behaviour when being operated via keyboard.
CGUIListBox(CGUICompositeObject *const pkParent, const eC_Value &vX, const eC_Value &vY, const eC_Value &vWidth, const eC_Value &vHeight, const Mode_t &eMode=VER_EXT, const eC_Bool &bMultipleSelection=false, const ObjectHandle_t &eID=NO_HANDLE)
eC_Int FindItem(const eC_String &kItemStr) const
CGUIListItem * GetItem(eC_UInt uiIndex)
eC_String GetSelectedItemStr()
void Init()
General initialization.
eC_Int GetItemIndexOfObject(const CGUIObject *pObj) const
void SetSelection(eC_UInt uiIndex)
eC_Bool FocusAny()
eC_Int GetSelection()
eC_Bool RemoveItem(CGUIListItem *pItem, eC_Bool bIsAutoAdjustArrange=true)
Removes an item from the scrolled container.
void SetWidth(const eC_Value &vWidth)
eC_Int FindItemBySubstring(const eC_String &kSearchString) const
void SetItemSelectedColor(eC_UInt uiItemSelectedColor)
CGUIListItem * GetNextItem()
eC_TListDoubleLinked< eC_UInt > IndexList_t
Type used for the index of those selected items in the list box.
Definition: GUIListBox.h:110
eC_Bool AddSelection(eC_UInt uiIndex)
virtual eC_Bool DoMouseEnter(const eC_Value &vAbsX, const eC_Value &vAbsY)
eC_Bool DoPostDraw()
CGUIListBox()
Standard constructor.
eC_TListDoubleLinked< CGUIListItem * > ItemPtrList_t
Type used for the item list that contains items.
Definition: GUIListBox.h:107
eC_UInt GetItemCount() const
eC_Bool DoKeyDown(const GUIKeyIdentifier_t &eKeyID, const eC_UInt &uiModifiers)
virtual eC_Bool DoClick(const eC_Value &vAbsX=(eC_FromInt(-1)), const eC_Value &vAbsY=(eC_FromInt(-1)))
virtual void ReadFromStream()
void RemoveSelectionObserver(CGUIObserver *pObserver)
CGUIListBox(CGUICompositeObject *const pkParent, const CGUIRect &kRect, const Mode_t &eMode=VER_EXT, const eC_Bool &bMultipleSelection=false, const ObjectHandle_t &eID=NO_HANDLE)
eC_Bool RemoveItems(eC_UInt uiStartIndex, eC_UInt uiEndIndex, eC_Bool bIsAutoAdjustArrange=true)
eC_TListDoubleLinked< eC_String > StringList_t
Type used for the string of those selected items in the list box.
Definition: GUIListBox.h:113
void ReleaseAllSelection()
virtual eC_Bool DoDragEnd(const eC_Value &vAbsX, const eC_Value &vAbsY)
virtual eC_Bool DoDraw()
void SetHeight(const eC_Value &vHeight)
eC_Bool IsObjectAnItemInList(const CGUIObject *pObj) const
void SetBgColor(const GlobalProperty_t &eBgColor)
IndexList_t GetSelectionIndexList()
void SetUseKeyboard(const eC_Bool &bUseKeyboard)
void SetDraggedFrameBgColor(const GlobalProperty_t &eDraggedFrameBgColor)
void UpdateSelection(const CGUIObject *pkObject, const CGUIEvent *pEvent)
void AdjustArrangement()
virtual eC_Bool DoDrag(const eC_Value &vDeltaX, const eC_Value &vDeltaY, const eC_Value &vAbsX, const eC_Value &vAbsY)
void SetSelectedByHighlighting(const eC_Bool &bSelectedByHighlighting)
virtual eC_Bool DoButtonDown(const eC_Value &vAbsX, const eC_Value &vAbsY)
void DeleteAllItems()
virtual eC_Bool RequestFocusForSelection()
void SetBgColor(const eC_UInt &uiBgColor)
void SetMultipleSelection(const eC_Bool &bMultiSelection)
StringList_t GetSelectedItemsStrList()
eC_Bool AddItem(CGUIListItem *pItem, eC_Bool bIsAutoAdjustArrange=true)
virtual void WriteToStream(const eC_Bool bWriteClassID=false)
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: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
Container object which can be scrolled if required.
Definition: GUIScrollView.h:66
virtual void RemoveObject(CGUIObject *pkObject)
Removes an object from the scrolled container.
Subject Base class for Observer-Design-Pattern within Guiliani.
Definition: GUISubject.h:34
eC_TIterator< CGUIListItem * > Iterator
Iterator is typedef'd as eC_TIterator ot type T.
Definition: eC_TList_doubleLinked.h:74
void AddSelectionObserver(CGUIObserver *pObserver)