Guiliani  Version 2.6 revision 7293 (documentation build 12)
GUITouchScrollView.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#if !defined(GUI_TOUCH_SCROLL_VIEW_H)
11#define GUI_TOUCH_SCROLL_VIEW_H
12
13// Touchscreen-optimized scrollview
14#include "GUIScrollView.h"
15#include "SafeGUIObjectPtr.h"
16#include "GUIEasing.h"
17
18#include "GUICommonEnums.h"
19
20// @guiliani_doxygen toplevel_control Touch Scroll View
31// @endguiliani_doxygen
95{
96public:
106 CGUICompositeObject* const pkParent,
107 const eC_Value& vX, const eC_Value& vY,
108 const eC_Value& vWidth, const eC_Value& vHeight,
109 const ObjectHandle_t &eID = NO_HANDLE);
110
111#ifdef GUILIANI_STREAM_GUI
114#endif
115
120 void SetKineticScrolling(const eC_Bool bVertical, const eC_Bool bHorizontal)
121 {
123 }
124
131
138
141
148 void SetDestination(const CGUICommonEnums::AxisAlignment_t eDestinationDirection, const eC_Value vRelDestinationPos = eC_FromInt(-1))
149 {
150 m_eDestinationDirection = eDestinationDirection;
151 m_vDestination = vRelDestinationPos;
152 }
153
156
158 eC_Value GetDestinationPosition() const { return m_vDestination; }
159
161 eC_Value GetBounceBackFactor() const { return m_vBounceBackFactor; }
162
170 void SetBounceBackFactor(const eC_Value vBounceBackFactor) { m_vBounceBackFactor = vBounceBackFactor; }
171
178
186 void SetScrollToImmediateChildrenOnly(const eC_Bool bOnlyImmediateChildren) { m_bScrollToImmediateChildrenOnly = bOnlyImmediateChildren; }
187
194 virtual void ScrollToObject(CGUIObject* pkObjectToScrollTo);
195
200 virtual void ScrollToObjectAnimated(CGUIObject* pkObjectToScrollTo);
201
202#ifdef GUILIANI_STREAM_GUI
203 virtual void ReadFromStream();
204#endif
205
206#ifdef GUILIANI_WRITE_GUI
207 virtual void WriteToStream(const eC_Bool bWriteClassID = false);
208#endif
209
212
216 eC_Value GetAbsDestinationPosX() const;
217
221 eC_Value GetAbsDestinationPosY() const;
222
231 CGUIObject* FindClosestObjectToPosition(const CGUICompositeObject* pSearchInObject, const eC_Value& vAbsPosInXDirection, const eC_Value& vAbsPosInYDirection) const;
232
240 void SetActiveObjectDistanceFactor(const eC_Value vActiveObjectDistanceFactor) { m_vActiveObjectDistanceFactor = vActiveObjectDistanceFactor; }
241
242protected:
245
255
259 virtual void DoAnimate(const eC_Value& vTimes = eC_FromInt(1));
260
263
264 virtual eC_Bool DoClick(const eC_Value& vAbsX, const eC_Value& vAbsY);
265
266 virtual eC_Bool DoDragEnd(const eC_Value& vAbsX, const eC_Value& vAbsY);
267
268 virtual eC_Bool DoButtonDown(const eC_Value& vAbsX, const eC_Value& vAbsY);
269
270 virtual eC_Bool DoDrag(const eC_Value& vDeltaX, const eC_Value& vDeltaY, const eC_Value& vAbsX, const eC_Value& vAbsY);
271
273 eC_Bool HasTargetPosition() const;
278
286 eC_Value CalcDistanceToObject(const CGUIObject* pkObject, const eC_Value& vAbsPosInXDirection, const eC_Value& vAbsPosInYDirection) const;
287
288protected:
290
291 eC_UInt m_uiLastDrag;
296
297 eC_Value m_vDestination;
299
302
307
312
315
318
321
325
328
331
333};
334
335#endif
ObjectHandle_t
List of object resource ids.
Definition: GUIObjectHandleResource.h:55
AxisAlignment_t
Axis-alignment for freedom of control.
Definition: GUICommonEnums.h:23
This is the Guiliani base class for all composite objects.
Definition: GUICompositeObject.h:70
EasingType_t
The differnet easing types.
Definition: GUIEasing.h:50
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
Container object which can be scrolled if required.
Definition: GUIScrollView.h:66
This ScrollView implementation is optimized for touch screens and supports scrolling by dragging.
Definition: GUITouchScrollView.h:95
CGUITouchScrollView()
Default constructor for streaming.
CGUICommonEnums::AxisAlignment_t GetDestinationDirection() const
Definition: GUITouchScrollView.h:155
CGUIObject * GetValidScrollTarget(CGUIObject *pActiveObject)
eC_UInt m_uiDragTimeStamp
Timestamp of last received DoDrag()-Event.
Definition: GUITouchScrollView.h:320
eC_Bool HasTargetPositionInDragDirection() const
virtual eC_Bool DoButtonDown(const eC_Value &vAbsX, const eC_Value &vAbsY)
eC_Value GetAbsDestinationPosX() const
eC_Value GetAbsDestinationPosY() const
eC_Value GetBounceBackFactor() const
Definition: GUITouchScrollView.h:161
virtual void ScrollToObject(CGUIObject *pkObjectToScrollTo)
void SetKineticScrolling(const eC_Bool bVertical, const eC_Bool bHorizontal)
Definition: GUITouchScrollView.h:120
eC_Value m_vStartScrollSpeedX
Speed of animation at the beginning of a kinetic animation.
Definition: GUITouchScrollView.h:323
eC_Value m_vActiveObjectDistanceFactor
Factor by which the active object's distance to the target position is multiplied.
Definition: GUITouchScrollView.h:317
virtual void StopScrollingAnimation()
Called by DoAnimate when the animation is over. Sets the focus to active object. Overriding methods s...
eC_Value m_vEasingDuration
Duration of easing animation for kinetic scrolling.
Definition: GUITouchScrollView.h:330
eC_Value m_vScrollSpeedX
The scroll speed of the ongoing animation.
Definition: GUITouchScrollView.h:293
void SetScrollToImmediateChildrenOnly(const eC_Bool bOnlyImmediateChildren)
Definition: GUITouchScrollView.h:186
eC_Value m_vScrollSpeedY
The scroll speed of the ongoing animation.
Definition: GUITouchScrollView.h:294
virtual eC_Bool DoClick(const eC_Value &vAbsX, const eC_Value &vAbsY)
eC_Bool ScrollsToImmediateChildrenOnly() const
Definition: GUITouchScrollView.h:177
CGUICommonEnums::AxisAlignment_t m_eCurrentDragDirection
Holds the drag direction. DRAG_NONE when no drag is ongoing.
Definition: GUITouchScrollView.h:314
virtual eC_Bool DoDragEnd(const eC_Value &vAbsX, const eC_Value &vAbsY)
CSafeGUIObjectPtr m_pActiveObject
The active object which is scrolled to the destination point.
Definition: GUITouchScrollView.h:289
virtual void DoAnimate(const eC_Value &vTimes=eC_FromInt(1))
virtual void WriteToStream(const eC_Bool bWriteClassID=false)
void ScrollToFocussedObject()
Overloaded to scroll animated to the currently focused object.
eC_Value m_vBounceBackFactor
The bounce back factor used when the upper or lower edge of the scroll view is reached while an anima...
Definition: GUITouchScrollView.h:295
CGUIObject * GetActiveObject() const
Definition: GUITouchScrollView.h:211
virtual eC_Bool DoDrag(const eC_Value &vDeltaX, const eC_Value &vDeltaY, const eC_Value &vAbsX, const eC_Value &vAbsY)
eC_Value GetDestinationPosition() const
Definition: GUITouchScrollView.h:158
eC_Int GetElementIndexOfActiveObject() const
eC_Bool HasKineticScrollingHorizontal() const
Definition: GUITouchScrollView.h:137
eC_Bool HasKineticScrollingVertical() const
Definition: GUITouchScrollView.h:130
CGUIPoint m_kDragStart
Holds the start point of a drag.
Definition: GUITouchScrollView.h:292
eC_Value m_vDestination
The relative destination position for the object center.
Definition: GUITouchScrollView.h:297
CGUITouchScrollView(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_bKineticScrollingVertical
Determines if kinetic scrolling is activated in vertical scroll direction.
Definition: GUITouchScrollView.h:304
eC_Bool m_bScrollToImmediateChildrenOnly
Determines which objects are scrolled to the target position. Only direct children of the scroll view...
Definition: GUITouchScrollView.h:301
CGUICommonEnums::AxisAlignment_t m_eDestinationDirection
The destination direction is used to determine if m_vDestination is the XPos or the YPos.
Definition: GUITouchScrollView.h:298
CGUIObject * FindClosestObjectToPosition(const CGUICompositeObject *pSearchInObject, const eC_Value &vAbsPosInXDirection, const eC_Value &vAbsPosInYDirection) const
CGUIEasing::EasingType_t m_eEasingType
EasingType used for kinetic animation.
Definition: GUITouchScrollView.h:327
eC_UInt m_uiLastDrag
Holds the time when the last drag was started. Used to calculate the drag speed.
Definition: GUITouchScrollView.h:291
eC_Bool m_bKineticScrollingHorizontal
Determines if kinetic scrolling is activated in horizontal scroll direction.
Definition: GUITouchScrollView.h:306
eC_Value m_vStartScrollSpeedY
scrollspeed y
Definition: GUITouchScrollView.h:324
void SetDestination(const CGUICommonEnums::AxisAlignment_t eDestinationDirection, const eC_Value vRelDestinationPos=eC_FromInt(-1))
Definition: GUITouchScrollView.h:148
eC_Bool HasTargetPositionInScrollDirection() const
virtual void ReadFromStream()
eC_Bool HasTargetPosition() const
eC_Bool m_bDragActive
drag active
Definition: GUITouchScrollView.h:332
CGUICommonEnums::AxisAlignment_t m_eScrollAnimationDirection
Definition: GUITouchScrollView.h:311
virtual void ScrollToObjectAnimated(CGUIObject *pkObjectToScrollTo)
void SetActiveObjectDistanceFactor(const eC_Value vActiveObjectDistanceFactor)
Definition: GUITouchScrollView.h:240
eC_Value CalcDistanceToObject(const CGUIObject *pkObject, const eC_Value &vAbsPosInXDirection, const eC_Value &vAbsPosInYDirection) const
void SetBounceBackFactor(const eC_Value vBounceBackFactor)
Definition: GUITouchScrollView.h:170
Smart pointer to a CGUIObject which will automatically be set to NULL if the corresponding GUIObject ...
Definition: SafeGUIObjectPtr.h:44