Guiliani  Version 2.6 revision 7293 (documentation build 12)
GUIWheel.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 __GUIWHEEL_H__
11#define __GUIWHEEL_H__
12
13#include "GUIObject.h"
14#include "GUIEasing.h"
15#include "GUIImageResource.h"
16#include "GUINinePatch.h"
17#include "GUIColorPropertyObserver.h"
18
19#include "GUICommonEnums.h"
20#include "GUIText.h"
21
23// @guiliani_doxygen toplevel_control Wheel
36// @endguiliani_doxygen
56{
57protected:
58 struct NodeInfo;
59
60public:
63
73 CGUICompositeObject* const pkParent,
74 const eC_Value& vX, const eC_Value& vY,
75 const eC_Value& vWidth, const eC_Value& vHeight,
76 const ObjectHandle_t &eID = NO_HANDLE);
77
80
84 CGUIWheel(const CGUIWheel& kToBeCopied);
85
90 CGUIWheel& operator=(const CGUIWheel& kSource);
91
92 virtual ~CGUIWheel();
93
97 void Init();
98
102 void DeInit();
103
106 void SetMinValue(eC_Int iMinValue);
107
110 eC_Int GetMinValue();
111
114 void SetMaxValue(eC_Int iMaxValue);
115
118 eC_Int GetMaxValue();
119
122 void SetStepSize(eC_Int iStepSize);
123
126 eC_Int GetStepSize() const;
127
130 void SetPostfixString(const eC_String& kPostfixString);
131
134 virtual void AdaptWheel();
135
140 virtual void AddEntry(const eC_String &kEntry, eC_Bool bSort = false);
141
145 virtual void DeleteEntry(const eC_String &kEntry);
146
149 virtual void DeleteAllEntries();
150
154 virtual void ScrollTo(eC_UInt uiNodeIndex);
155
159 virtual void ScrollTo(const eC_String &kNodeText);
160
164 virtual void ScrollToAnimated(eC_UInt uiNodeIndex);
165
169 virtual void ScrollToAnimated(const eC_String &kNodeText);
170
174 virtual eC_UInt GetCurrentIndex();
175
179 virtual const eC_String& GetCurrentValue();
180
187 virtual eC_Int SearchEntry(const eC_String &kNodeText);
188
189 // Methods derived from CGUIObject
190 virtual eC_Bool DoDraw();
191
192 virtual eC_Bool IsHighlightable() const { return false; }
193
194 virtual void DoAnimate(const eC_Value& vTimes = eC_FromInt(1));
195 virtual eC_Bool DoClick(const eC_Value& vAbsX, const eC_Value& vAbsY);
196 virtual eC_Bool DoButtonDown(const eC_Value& vAbsX, const eC_Value& vAbsY);
197 virtual eC_Bool DoDrag(const eC_Value& vDeltaX, const eC_Value& vDeltaY, const eC_Value& vAbsX, const eC_Value& vAbsY);
198 virtual eC_Bool DoDragEnd(const eC_Value& vAbsX, const eC_Value& vAbsY);
199
200 virtual void SetWidth(const eC_Value& vWidth);
201 virtual void SetHeight(const eC_Value& vHeight);
202 virtual eC_Bool SetValue(const CGUIValue& rkValue);
203
206 eC_Bool IsCyclic() const;
207
210 void SetCyclic(eC_Bool bCyclic);
211
214 eC_Bool IsUsingRange() const;
215
219 void SetUseRange(eC_Bool bUseRange);
220
224
229 virtual void NormalizeEntry(eC_String& kEntry);
230
235
240
244 void SetEntriesFont(const FontResource_t& eFontID);
245
250
254 void SetEntriesColor(const eC_UInt& uiEntriesColor);
255
259 void SetEntriesColor(const GlobalProperty_t& eEntriesColor);
260
264 eC_UInt GetEntriesColor() const;
265
270
275
279 void SetFocussedEntryColor(const eC_UInt& uiFocussedEntryColor);
280
284 void SetFocussedEntryColor(const GlobalProperty_t& eFocussedEntryColor);
285
289 eC_UInt GetFocussedEntryColor() const;
290
293 virtual void OnColorPropertyChange();
294
298 void SetAnimatedUpdate(const eC_Bool& bAnimatedUpdate);
299
303 eC_Bool GetAnimatedUpdate() const;
304
305#if defined(GUILIANI_STREAM_GUI)
310 virtual void ReadFromStream();
311#endif
312
313#if defined(GUILIANI_WRITE_GUI)
319 virtual void WriteToStream(const eC_Bool bWriteClassID = false);
320#endif
321
326 {
327 return m_kNinePatch;
328 }
329
330protected:
334 virtual void CreateNodesFromRange();
335
339
343
347
351 virtual void AdjustCurrentScrollPosAndNode(eC_Value vDragDelta);
352
355 virtual void AdjustSize();
356
363 virtual void GetNodeIndexInRelPos(eC_Value vOffset, eC_Int &iIndex, eC_Int &iCycle, eC_Value& vScrollPos);
364
368 virtual void SetCurrentNode(eC_UInt uiNodeIndex);
369
373 virtual eC_UInt GetCurrentNode();
374
379
384 virtual eC_UInt GetNodeIndexFromIter(const NodeList::Iterator &kNodeIter);
385
389 virtual void SetCurrentNodeSafeIter(const NodeList::SafeIterator &kNodeSafeIter);
390
396
402
407
411 virtual void SetCurrentScrollPosForCurrentDirection(eC_Value vCurrentScrollPos);
412
417
422 virtual void SetDefaultNodeSize(eC_Value vWidth, eC_Value vHeight);
423
427
431
435
442 virtual void PixelToIndexCycleOffset(eC_Value vPixel, eC_Int &iIndex, eC_Int &iCycle, eC_Value& vOffset);
443
450 virtual eC_Value IndexCycleOffsetToPixel(eC_Int iIndex, eC_Int iCycle, eC_Value vOffset);
451
453 struct NodeInfo
454 {
455 eC_String m_sNodeText;
457
460 NodeInfo(const NodeInfo& kToBeCopied);
461
464
473 CGUIObject* pkParent,
474 const eC_String &kNodeText,
475 eC_Value vXPos, eC_Value vYPos,
476 eC_Value vWidth, eC_Value vHeight);
477
482
486 bool operator==(const NodeInfo& kNode);
487
491 bool operator>(const NodeInfo& kNode);
492
495 };
496
497protected:
498 static const eC_UInt INDEX_COLOR_ENTRY;
499 static const eC_UInt INDEX_COLOR_FOCUSSEDENTRY;
500
502
507
508 eC_Value m_vTargetPos;
509
510 // Used for animation
511 // Animation start position
515 // Animation target position
519
522
523 eC_Bool m_bCyclic;
524 eC_Bool m_bUseRange;
529 eC_String m_kFillupString;
530 eC_String m_kPrefixString;
533
537
539
541
546
551
555 eC_Value m_vNodeX;
556 eC_Value m_vNodeY;
561
563
565};
566
567#endif // GUIWHEEL_H
FontResource_t
List of font resource ids.
Definition: GUIFontResource.h:54
Helper Macros in Guiliani
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
This observer provides the base-interface for controls when using color-properties.
Definition: GUIColorPropertyObserver.h:23
Orientation_t
orientation of controls
Definition: GUICommonEnums.h:57
This is the Guiliani base class for all composite objects.
Definition: GUICompositeObject.h:70
EasingType_t
The differnet easing types.
Definition: GUIEasing.h:50
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
CGUIPoint class to hold two values (x, y) like a vector.
Definition: GUIPoint.h:18
Class for handling a text.
Definition: GUIText.h:103
CGUIValue stores a single value in one specific type.
Definition: GUIValue.h:25
Displays a wheel in the GUI.
Definition: GUIWheel.h:56
void SetFocussedEntryFont(const FontResource_t &eFontID)
FontResource_t GetFocussedEntryFont() const
eC_UInt m_uiDragStarted
Holds the time when the last drag was started. Used to calculate the drag speed.
Definition: GUIWheel.h:535
eC_Int m_iMinValue
Smallest generated entry.
Definition: GUIWheel.h:525
virtual eC_Bool IsHighlightable() const
Definition: GUIWheel.h:192
virtual NodeList::Iterator GetPreviousNodeCyclic(NodeList::Iterator kIter)
virtual void ReadFromStream()
CGUIEasing::EasingType_t m_eEasingTypeCurrent
EasingType used for kinetic animation.
Definition: GUIWheel.h:543
virtual eC_Bool DoDraw()
virtual eC_Value IndexCycleOffsetToPixel(eC_Int iIndex, eC_Int iCycle, eC_Value vOffset)
CGUIWheel()
Default constructor.
virtual void AdjustSize()
virtual const eC_String & GetCurrentValue()
virtual void CreateNodesFromRange()
eC_Int m_iStepSize
Step size used for entry generation.
Definition: GUIWheel.h:527
FontResource_t m_eFocussedEntryFont
Font of the focused entry.
Definition: GUIWheel.h:553
eC_Value m_vEasingDurationBack
Easing duration for non-cyclic wheel if dragged further then wheel size.
Definition: GUIWheel.h:550
virtual void ScrollToAnimated(eC_UInt uiNodeIndex)
eC_String m_kFocussedValue
Current focused value.
Definition: GUIWheel.h:554
eC_UInt GetNumberOfEntries()
void SetEntriesFont(const FontResource_t &eFontID)
CGUIWheel & operator=(const CGUIWheel &kSource)
eC_Bool IsCyclic() const
virtual void ScrollToAnimated(const eC_String &kNodeText)
virtual void AdaptWheel()
void SetFocussedEntryColor(const GlobalProperty_t &eFocussedEntryColor)
CGUINinePatch & GetNinePatch()
Definition: GUIWheel.h:325
virtual eC_UInt GetCurrentIndex()
NodeList m_kNodes
List containing all nodes/entries.
Definition: GUIWheel.h:501
eC_Int GetStepSize() const
virtual void ScrollTo(const eC_String &kNodeText)
CGUIWheel(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)
eC_Bool m_bCyclic
True if wheel is cyclic. False if non-cyclic. The wheel then stops at begin/end of entries.
Definition: GUIWheel.h:523
ImageResource_t m_eBGImage
Used background image.
Definition: GUIWheel.h:538
virtual eC_Int SearchEntry(const eC_String &kNodeText)
eC_Value m_vAniTargetScrollPos
Animation target scrolling position.
Definition: GUIWheel.h:518
eC_UInt GetFocussedEntryColor() const
eC_Value m_vNodeX
Node horizontal feed rate for the gui text positions.
Definition: GUIWheel.h:555
eC_String m_kPostfixString
String will be place behind of entry. Can be used for example for units etc.
Definition: GUIWheel.h:531
eC_Bool m_bFillFromBegin
If true entries will be filled in front of entry, if false at end.
Definition: GUIWheel.h:532
virtual eC_Bool SetValue(const CGUIValue &rkValue)
eC_UInt m_CurrentNodeIndex
Index of current node.
Definition: GUIWheel.h:504
virtual eC_Value GetCurrentScrollPosForCurrentDirection()
eC_Int m_iAniStartNodeCycle
Animation start node cycle.
Definition: GUIWheel.h:513
virtual void SetCurrentNodeSafeIter(const NodeList::SafeIterator &kNodeSafeIter)
virtual eC_UInt GetCurrentNode()
void SetDirection(CGUICommonEnums::Orientation_t eDirection)
eC_String m_kPrefixString
String will be place in front of entry.
Definition: GUIWheel.h:530
eC_Value m_vAniStartScrollPos
Animation start scrolling position.
Definition: GUIWheel.h:514
eC_Bool IsUsingRange() const
virtual void DoAnimate(const eC_Value &vTimes=eC_FromInt(1))
eC_Int m_iMaxValue
Biggest generated entry.
Definition: GUIWheel.h:526
FontResource_t m_eEntriesFont
Font of all non focused entries.
Definition: GUIWheel.h:552
CGUICommonEnums::Orientation_t GetDirection() const
eC_Int m_iAniTargetNodeIndex
Animation target node.
Definition: GUIWheel.h:516
eC_Int m_iMinDigitNumber
Minimal number of digits.
Definition: GUIWheel.h:528
void SetPostfixString(const eC_String &kPostfixString)
eC_Value m_vEasingDurationCurrent
Duration of easing animation for kinetic scrolling.
Definition: GUIWheel.h:548
virtual void AdjustNodesRelativePositionsNotCyclic()
virtual eC_Bool DoDrag(const eC_Value &vDeltaX, const eC_Value &vDeltaY, const eC_Value &vAbsX, const eC_Value &vAbsY)
eC_Value m_vRemainingSpaceY
If the nodes are not fitting exactly this is the rest space.
Definition: GUIWheel.h:559
CGUIEasing::EasingType_t m_eEasingTypeBack
Easing for non-cyclic wheel if dragged further then wheel size.
Definition: GUIWheel.h:545
virtual void NormalizeEntry(eC_String &kEntry)
virtual eC_Bool DoClick(const eC_Value &vAbsX, const eC_Value &vAbsY)
CGUIWheel(const CGUIWheel &kToBeCopied)
eC_String m_kFillupString
String will be used to fill up missing digits.
Definition: GUIWheel.h:529
eC_Value m_vEasingDurationNormal
Easing duration used for all animations which will not go further then the wheel end.
Definition: GUIWheel.h:549
eC_Bool m_bUseRange
If true entries will be automatically generated with the use of below values.
Definition: GUIWheel.h:524
virtual eC_Bool DoDragEnd(const eC_Value &vAbsX, const eC_Value &vAbsY)
eC_Value m_vCurrentScrollPosY
Scrolling position of current node (offset in pixels (0-m_vNodeDefaultHeight)).
Definition: GUIWheel.h:506
CGUINinePatch m_kNinePatch
used ninepatch
Definition: GUIWheel.h:562
virtual void WriteToStream(const eC_Bool bWriteClassID=false)
eC_Value m_vNodeDefaultHeight
Entry height in pixels. Has to be > 0.
Definition: GUIWheel.h:521
eC_Int GetMinValue()
virtual void PixelToIndexCycleOffset(eC_Value vPixel, eC_Int &iIndex, eC_Int &iCycle, eC_Value &vOffset)
void SetEntriesColor(const GlobalProperty_t &eEntriesColor)
virtual void StartScrollingAnimation()
eC_Bool GetAnimatedUpdate() const
virtual void DeleteAllEntries()
eC_Value m_vRemainingSpaceX
If the nodes are not fitting exactly this is the rest space.
Definition: GUIWheel.h:558
CGUICommonEnums::Orientation_t m_eDirection
Direction of the wheel. Either horizontal or vertical.
Definition: GUIWheel.h:540
eC_Bool m_bAnimatedUpdate
if updates should animate to value, rather than jump
Definition: GUIWheel.h:564
virtual void SetWidth(const eC_Value &vWidth)
virtual void AdjustCurrentScrollPosAndNode(eC_Value vDragDelta)
virtual void SetCurrentScrollPosForCurrentDirection(eC_Value vCurrentScrollPos)
virtual void SetCurrentNode(eC_UInt uiNodeIndex)
eC_TListDoubleLinked< NodeInfo > NodeList
Type used for the nodes.
Definition: GUIWheel.h:62
eC_Value m_vAdditionalSpace
Used for positioning in DoDraw.
Definition: GUIWheel.h:560
eC_Int m_iAniStartNodeIndex
Animation start node index.
Definition: GUIWheel.h:512
void SetStepSize(eC_Int iStepSize)
eC_UInt GetEntriesColor() const
eC_Value m_vCurrentScrollPosX
Scrolling position of current node (offset in pixels (0-m_vNodeDefaultWidth)).
Definition: GUIWheel.h:505
virtual void AdjustNodesRelativePositionsCyclic()
void SetMaxValue(eC_Int iMaxValue)
eC_UInt m_uiDragTimeStamp
Time at start of animation and Timestamp of last received DoDrag()-Event.
Definition: GUIWheel.h:534
virtual void SetHeight(const eC_Value &vHeight)
eC_Int GetMaxValue()
eC_Value m_vTargetPos
Target position in pixels for animation.
Definition: GUIWheel.h:508
virtual NodeList::Iterator GetNextNodeCyclic(NodeList::Iterator kIter)
void Init()
eC_Int m_iAniTargetNodeCycle
Animation target node cycle.
Definition: GUIWheel.h:517
static const eC_UInt INDEX_COLOR_FOCUSSEDENTRY
index for focussed entry color
Definition: GUIWheel.h:499
CGUIPoint m_kDragStart
Holds the start point of a drag.
Definition: GUIWheel.h:536
void DeInit()
void SetAnimatedUpdate(const eC_Bool &bAnimatedUpdate)
void SetEntriesColor(const eC_UInt &uiEntriesColor)
static const eC_UInt INDEX_COLOR_ENTRY
index for entry-color
Definition: GUIWheel.h:498
virtual eC_Value GetDefaultNodeSizeCurrentDirection()
FontResource_t GetEntriesFont() const
virtual void SetDefaultNodeSize(eC_Value vWidth, eC_Value vHeight)
void SetFocussedEntryColor(const eC_UInt &uiFocussedEntryColor)
NodeList & GetNodes()
virtual void OnColorPropertyChange()
eC_UInt m_uiNumOfVisibleNodes
Number of visible nodes of the wheel.
Definition: GUIWheel.h:557
NodeList::SafeIterator m_CurrentNodeSafeIter
Iterator pointing to the current node/entry.
Definition: GUIWheel.h:503
virtual void ScrollTo(eC_UInt uiNodeIndex)
CGUIEasing::EasingType_t m_eEasingTypeNormal
Easing used for all animations which will not go further then the wheel end.
Definition: GUIWheel.h:544
virtual void AddEntry(const eC_String &kEntry, eC_Bool bSort=false)
virtual void StopScrollingAnimation()
virtual void GetNodeIndexInRelPos(eC_Value vOffset, eC_Int &iIndex, eC_Int &iCycle, eC_Value &vScrollPos)
virtual void AdjustNodesRelativePositions()
virtual eC_UInt GetNodeIndexFromIter(const NodeList::Iterator &kNodeIter)
void SetUseRange(eC_Bool bUseRange)
virtual eC_Bool DoButtonDown(const eC_Value &vAbsX, const eC_Value &vAbsY)
virtual void DeleteEntry(const eC_String &kEntry)
eC_Value m_vNodeY
Node vertical feed rate for the gui text positions.
Definition: GUIWheel.h:556
eC_Value m_vNodeDefaultWidth
Entry width in pixels. Has to be > 0.
Definition: GUIWheel.h:520
void SetMinValue(eC_Int iMinValue)
void SetCyclic(eC_Bool bCyclic)
virtual NodeList::SafeIterator GetCurrentNodeSafeIter()
Contains information about one node.
Definition: GUIWheel.h:454
eC_String m_sNodeText
Value of entry displayed.
Definition: GUIWheel.h:455
CGUIText * m_pkGUIText
GUIText needed to display value.
Definition: GUIWheel.h:456
NodeInfo(const NodeInfo &kToBeCopied)
bool operator==(const NodeInfo &kNode)
~NodeInfo()
Destructor.
NodeInfo(CGUIObject *pkParent, const eC_String &kNodeText, eC_Value vXPos, eC_Value vYPos, eC_Value vWidth, eC_Value vHeight)
bool operator>(const NodeInfo &kNode)
NodeInfo & operator=(const NodeInfo &kNode)
NodeInfo()
Default constructor.