Guiliani  Version 2.5 revision 7293 (documentation build 13)
GUIWheelContainer.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 GUIWHEELCONTAINER_H
11#define GUIWHEELCONTAINER_H
12
13#include "GUICompositeObject.h"
14#include "GUIEasing.h"
15#include "GUIImageResource.h"
16#include "GUINinePatch.h"
17
18#include "GUICommonEnums.h"
19
20// @guiliani_doxygen toplevel_control Wheel-Container
34// @endguiliani_doxygen
35
46{
47public:
57 CGUICompositeObject* const pkParent,
58 const eC_Value& vX, const eC_Value& vY,
59 const eC_Value& vWidth, const eC_Value& vHeight,
60 const ObjectHandle_t &eID = NO_HANDLE);
61
64
69
75
76 virtual ~CGUIWheelContainer();
77
80 virtual void AdaptWheel();
81
82 virtual eC_Bool AddObject(CGUIObject* pkObject);
83
84 virtual void RemoveObject(CGUIObject* pkObject);
85
89 virtual void ScrollTo(eC_UInt uiNodeIndex);
90
94 virtual void ScrollToAnimated(eC_UInt uiNodeIndex);
95
99 virtual eC_UInt GetCurrentIndex();
100
101 // Methods derived from CGUIObject
102 virtual eC_Bool DoDraw();
103 virtual void DoAnimate(const eC_Value& vTimes = eC_FromInt(1));
104 //virtual eC_Bool DoClick(const eC_Value& vAbsX, const eC_Value& vAbsY);
105 virtual eC_Bool DoButtonDown(const eC_Value& vAbsX, const eC_Value& vAbsY);
106 virtual eC_Bool DoDrag(const eC_Value& vDeltaX, const eC_Value& vDeltaY, const eC_Value& vAbsX, const eC_Value& vAbsY);
107 virtual eC_Bool DoDragEnd(const eC_Value& vAbsX, const eC_Value& vAbsY);
108 virtual eC_Bool SetValue(const CGUIValue& rkValue);
109
110 virtual void SetWidth(const eC_Value& vX);
111 virtual void SetHeight(const eC_Value& vY);
112
115 void SetCyclic(eC_Bool bCyclic);
116
119 eC_Bool IsCyclic() const;
120
125
130
134 void SetTargetSnappingPosition(const eC_Value& vTargetSnappingPos);
135
140
145 void SetMinimumDragDistance(const eC_Value& vMinimumDragDistance);
146
150 eC_Value GetMinimumDragDistance() const;
151
156 void SetSwipeDistance(const eC_Value& vSwipeDistance);
157
161 eC_Value GetSwipeDistance() const;
162
167 void SetCenterChildren(const eC_Bool& bCenterChildren);
168
172 eC_Bool GetCenterChildren() const;
173
177 void SetBGImage(const ImageResource_t& eBGImage);
178
183
189 const CGUIEasing::EasingType_t& eEasing,
190 const eC_Value& vEasingTime);
191
198 eC_Value& vEasingTime) const;
199
200#if defined(GUILIANI_STREAM_GUI)
205 virtual void ReadFromStream();
206#endif
207
208#if defined(GUILIANI_WRITE_GUI)
214 virtual void WriteToStream(const eC_Bool bWriteClassID = false);
215#endif
216
221 {
222 return m_kNinePatch;
223 }
224
225protected:
228 virtual void AdjustNodesPosition();
229
233
237 virtual void SetCurrentNode(eC_UInt uiNodeIndex);
238
242 virtual eC_UInt GetCurrentNode();
243
248
253 virtual eC_UInt GetNodeIndexFromIter(const ObjectPtrList::Iterator &kNodeIter);
254
258 virtual void SetCurrentNodeSafeIter(const ObjectPtrList::SafeIterator &kNodeSafeIter);
259
266
272
277
281 virtual void SetCurrentScrollPosForCurrentDirection(eC_Value vCurrentScrollPos);
282
286
290
294 void SetScrollPosition(const eC_Value& vScrollPosition);
295
302 void GetNodeIndexForPosition(const eC_Value& vOffset, eC_Int &iIndex, eC_Int &iCycle, eC_Value& vScrollPos);
303
310 eC_Value GetPositionForNodeIndex(const eC_Int &iIndex, const eC_Int &iCycle, const eC_Value& vScrollPos);
311
312private:
313 void Init();
314 void DeInit();
315
316 eC_Value GetTotalSize();
317
318private:
319 ObjectPtrList::SafeIterator m_kCurrentNodeSafeIter;
320 eC_UInt m_uiCurrentNodeIndex;
321 eC_Value m_vCurrentScrollPosX;
322 eC_Value m_vCurrentScrollPosY;
323
324 eC_Value m_vTargetPos;
325
326 // Used for animation
327 // Animation start position
328 eC_Int m_iAniStartNodeIndex;
329 eC_Int m_iAniStartNodeCycle;
330 eC_Value m_vAniStartScrollPos;
331 // Animation target position
332 eC_Int m_iAniTargetNodeIndex;
333 eC_Int m_iAniTargetNodeCycle;
334 eC_Value m_vAniTargetScrollPos;
335
336 eC_Bool m_bCyclic;
337
338 eC_UInt m_uiDragTimeStamp;
339 eC_UInt m_uiDragStarted;
340 CGUIPoint m_kDragStart;
341 eC_Value m_vDistance;
342
343 ImageResource_t m_eBGImage;
344
345 CGUICommonEnums::Orientation_t m_eDirection;
346
348 CGUIEasing::EasingType_t m_eEasingType;
349
351 eC_Value m_vEasingDuration;
352
353 CGUINinePatch m_kNinePatch;
354
355 eC_Value m_vTargetSnappingPos;
356 eC_Value m_vMinimumDragDistance;
357 eC_Value m_vSwipeDistance;
358
359 eC_Value m_vScrollPos;
360
361 eC_Bool m_bCenterChildren;
362};
363
364#endif // GUIWHEEL_H
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
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:79
CGUIPoint class to hold two values (x, y) like a vector.
Definition: GUIPoint.h:18
CGUIValue stores a single value in one specific type.
Definition: GUIValue.h:25
Definition: GUIWheelContainer.h:46
virtual eC_Bool SetValue(const CGUIValue &rkValue)
eC_Bool GetCenterChildren() const
virtual void AdjustCurrentScrollPosAndNode()
virtual void SetCurrentNode(eC_UInt uiNodeIndex)
CGUINinePatch & GetNinePatch()
Definition: GUIWheelContainer.h:220
virtual eC_Bool DoButtonDown(const eC_Value &vAbsX, const eC_Value &vAbsY)
virtual ObjectPtrList::Iterator GetNextNodeCyclic(ObjectPtrList::Iterator kIter, eC_Bool &bWrapped)
ImageResource_t GetBGImage() const
virtual eC_Bool DoDraw()
virtual void ScrollTo(eC_UInt uiNodeIndex)
virtual eC_Value GetCurrentScrollPosForCurrentDirection()
virtual ObjectPtrList::SafeIterator GetCurrentNodeSafeIter()
virtual eC_Bool AddObject(CGUIObject *pkObject)
void GetNodeIndexForPosition(const eC_Value &vOffset, eC_Int &iIndex, eC_Int &iCycle, eC_Value &vScrollPos)
virtual void RemoveObject(CGUIObject *pkObject)
void SetEasing(const CGUIEasing::EasingType_t &eEasing, const eC_Value &vEasingTime)
CGUIWheelContainer(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)
void SetScrollPosition(const eC_Value &vScrollPosition)
void SetBGImage(const ImageResource_t &eBGImage)
CGUIWheelContainer(const CGUIWheelContainer &kToBeCopied)
CGUICommonEnums::Orientation_t GetDirection() const
eC_Value GetTargetSnappingPosition() const
eC_Value GetMinimumDragDistance() const
virtual eC_UInt GetNodeIndexFromIter(const ObjectPtrList::Iterator &kNodeIter)
void SetCenterChildren(const eC_Bool &bCenterChildren)
virtual void SetWidth(const eC_Value &vX)
virtual eC_Bool DoDrag(const eC_Value &vDeltaX, const eC_Value &vDeltaY, const eC_Value &vAbsX, const eC_Value &vAbsY)
virtual eC_UInt GetCurrentNode()
virtual void AdjustNodesPosition()
void SetSwipeDistance(const eC_Value &vSwipeDistance)
void SetTargetSnappingPosition(const eC_Value &vTargetSnappingPos)
eC_Value GetSwipeDistance() const
virtual void SetCurrentNodeSafeIter(const ObjectPtrList::SafeIterator &kNodeSafeIter)
virtual void SetHeight(const eC_Value &vY)
void SetMinimumDragDistance(const eC_Value &vMinimumDragDistance)
void SetCyclic(eC_Bool bCyclic)
eC_Bool IsCyclic() const
virtual void WriteToStream(const eC_Bool bWriteClassID=false)
virtual ObjectPtrList::Iterator GetPreviousNodeCyclic(ObjectPtrList::Iterator kIter)
virtual void ReadFromStream()
virtual void StopScrollingAnimation()
virtual void ScrollToAnimated(eC_UInt uiNodeIndex)
virtual void AdaptWheel()
virtual void SetCurrentScrollPosForCurrentDirection(eC_Value vCurrentScrollPos)
void SetDirection(const CGUICommonEnums::Orientation_t &eDirection)
CGUIWheelContainer & operator=(const CGUIWheelContainer &kSource)
eC_Value GetPositionForNodeIndex(const eC_Int &iIndex, const eC_Int &iCycle, const eC_Value &vScrollPos)
virtual void StartScrollingAnimation()
virtual eC_Bool DoDragEnd(const eC_Value &vAbsX, const eC_Value &vAbsY)
virtual eC_UInt GetCurrentIndex()
CGUIWheelContainer()
Default constructor.
virtual void DoAnimate(const eC_Value &vTimes=eC_FromInt(1))
void GetEasing(CGUIEasing::EasingType_t &eEasing, eC_Value &vEasingTime) const