Guiliani  Version 2.5 revision 7293 (documentation build 13)
GUIAbstractBar.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 GUIABSTRACTBAR__H_
11#define GUIABSTRACTBAR__H_
12
13#include "GUIObject.h"
14#include "GUIRange.h"
15
17
33{
34public:
40 virtual eC_Bool SetValue(const CGUIValue& rkValue)
41 {
42 m_kRange.SetValue(rkValue.ToInt());
43 CheckForValueChange(); // This will call NotifyValueObservers
44 return true;
45 }
46
53 inline const CGUIRange& GetRange() const
54 {
55 return m_kRange;
56 }
57
61 inline void SetLevel(eC_Value vPercent)
62 {
63 m_kRange.SetLevel(vPercent);
64 CheckForValueChange();
65 }
66
70 inline void SetLevelPercentage(eC_UInt uiPercentage)
71 {
72 m_kRange.SetLevelPercentage(uiPercentage);
73 CheckForValueChange();
74 }
75
79 inline void SetMinValue(eC_Int iMinValue)
80 {
81 m_kRange.SetMinValue(iMinValue);
82 CheckForValueChange();
83 }
84
88 inline void SetMaxValue(eC_Int iMaxValue)
89 {
90 m_kRange.SetMaxValue(iMaxValue);
91 CheckForValueChange();
92 }
93
98 void SetRange(eC_Int iMinValue, eC_Int iMaxValue)
99 {
100 m_kRange.SetRange(iMinValue, iMaxValue);
101 CheckForValueChange();
102 }
103
107 inline void SetStepSizeLevelPercentage(eC_UInt uiPercentage)
108 {
109 m_kRange.SetStepSizeLevelPercentage(uiPercentage);
110 CheckForValueChange();
111 }
112
116 inline void SetStepSizeLevel(eC_Value vPercent)
117 {
118 m_kRange.SetStepSizeLevel(vPercent);
119 CheckForValueChange();
120 }
121
125 inline void SetStepSize(eC_UInt uiIntValues)
126 {
127 m_kRange.SetStepSize(uiIntValues);
128 CheckForValueChange();
129 }
130
134 eC_Bool Increase()
135 {
136 if (m_kRange.Increase())
137 {
138 CheckForValueChange();
139 }
140 return false;
141 }
142
146 eC_Bool Decrease()
147 {
148 if (m_kRange.Decrease())
149 {
150 CheckForValueChange();
151 }
152 return false;
153 }
154
158 inline void SetBase(CGUIRange::Base_t eBase)
159 {
160 m_kRange.SetBase(eBase);
161 CheckForValueChange();
162 }
163
167 inline void SetMaximumLevelIsAlwaysValid(eC_Bool bNotOnlyMultiplesOfStepSize)
168 {
169 m_kRange.SetMaximumLevelIsAlwaysValid(bNotOnlyMultiplesOfStepSize);
170 CheckForValueChange();
171 }
172
185 virtual eC_Bool OnValueChange()
186 {
187 return false;
188 }
189
194 inline void SetAnimationSpeed(const eC_UInt &ruiAnimationSpeed) { m_uiAnimationSpeed = ruiAnimationSpeed; }
195
199 inline eC_UInt GetAnimationSpeed() const { return m_uiAnimationSpeed; }
200
204 inline void SetAnimationInterval(const eC_UInt &ruiAnimationInterval) { m_uiAnimationInterval = ruiAnimationInterval; }
205
209 inline eC_UInt GetAnimationInterval() const { return m_uiAnimationInterval; }
210
216 void AnimateToValue(const eC_Int iTargetValue);
217
218 virtual void DoAnimate(const eC_Value& vTimes = eC_FromInt(1));
219
220protected:
225
235 CGUICompositeObject* const pkParent,
236 const eC_Value& vX,
237 const eC_Value& vY,
238 const eC_Value& vWidth,
239 const eC_Value& vHeight,
240 const ObjectHandle_t &eID = NO_HANDLE);
241
248 CGUICompositeObject* const pkParent,
249 const CGUIRect &kRect,
250 const ObjectHandle_t &eID = NO_HANDLE);
251
256
262
263#ifdef GUILIANI_STREAM_GUI
264 virtual void ReadFromStream();
265#endif
266#ifdef GUILIANI_WRITE_GUI
267 virtual void WriteToStream(const eC_Bool bWriteClassID = false);
268#endif
269
270private:
272 void Init();
273
278 void CopyAttributes(const CGUIAbstractBar& kSource);
279
281 void CheckForValueChange();
282
284 CGUIRange m_kRange;
285
287 eC_Int m_iOldValue;
288
290 eC_UInt m_uiAnimationSpeed;
291
293 eC_UInt m_uiAnimationInterval;
294
296 eC_Int m_iTargetValue;
297};
298#endif
ObjectHandle_t
List of object resource ids.
Definition: GUIObjectHandleResource.h:55
Base class for bars.
Definition: GUIAbstractBar.h:33
void SetMaximumLevelIsAlwaysValid(eC_Bool bNotOnlyMultiplesOfStepSize)
Definition: GUIAbstractBar.h:167
CGUIAbstractBar(const CGUIAbstractBar &kSource)
virtual void WriteToStream(const eC_Bool bWriteClassID=false)
void SetMinValue(eC_Int iMinValue)
Definition: GUIAbstractBar.h:79
void SetMaxValue(eC_Int iMaxValue)
Definition: GUIAbstractBar.h:88
virtual eC_Bool SetValue(const CGUIValue &rkValue)
Definition: GUIAbstractBar.h:40
eC_Bool Decrease()
Definition: GUIAbstractBar.h:146
const CGUIRange & GetRange() const
Definition: GUIAbstractBar.h:53
CGUIAbstractBar(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 SetStepSize(eC_UInt uiIntValues)
Definition: GUIAbstractBar.h:125
eC_UInt GetAnimationInterval() const
Definition: GUIAbstractBar.h:209
void SetAnimationInterval(const eC_UInt &ruiAnimationInterval)
Definition: GUIAbstractBar.h:204
void SetLevel(eC_Value vPercent)
Definition: GUIAbstractBar.h:61
CGUIAbstractBar & operator=(const CGUIAbstractBar &kSource)
void AnimateToValue(const eC_Int iTargetValue)
void SetAnimationSpeed(const eC_UInt &ruiAnimationSpeed)
Definition: GUIAbstractBar.h:194
eC_UInt GetAnimationSpeed() const
Definition: GUIAbstractBar.h:199
virtual void DoAnimate(const eC_Value &vTimes=eC_FromInt(1))
void SetLevelPercentage(eC_UInt uiPercentage)
Definition: GUIAbstractBar.h:70
void SetBase(CGUIRange::Base_t eBase)
Definition: GUIAbstractBar.h:158
CGUIAbstractBar(CGUICompositeObject *const pkParent, const CGUIRect &kRect, const ObjectHandle_t &eID=NO_HANDLE)
eC_Bool Increase()
Definition: GUIAbstractBar.h:134
void SetRange(eC_Int iMinValue, eC_Int iMaxValue)
Definition: GUIAbstractBar.h:98
void SetStepSizeLevelPercentage(eC_UInt uiPercentage)
Definition: GUIAbstractBar.h:107
void SetStepSizeLevel(eC_Value vPercent)
Definition: GUIAbstractBar.h:116
virtual void ReadFromStream()
virtual eC_Bool OnValueChange()
Definition: GUIAbstractBar.h:185
This is the Guiliani base class for all composite objects.
Definition: GUICompositeObject.h:70
This is the Guiliani base class all controls are derived from.
Definition: GUIObject.h:79
Helper class to supply a platform independent range implementation.
Definition: GUIRange.h:67
void SetValue(eC_Int iNewValue)
void SetStepSizeLevel(eC_Value vPercent)
void SetMaximumLevelIsAlwaysValid(eC_Bool bNotOnlyMultiplesOfStepSize)
Definition: GUIRange.h:377
void SetStepSizeLevelPercentage(eC_UInt uiPercentage)
eC_Bool Increase()
void SetLevelPercentage(eC_UInt uiPercentage)
void SetBase(Base_t eBase)
void SetMinValue(eC_Int iMinValue)
Definition: GUIRange.h:269
void SetRange(eC_Int iMinValue, eC_Int iMaxValue)
eC_Bool Decrease()
void SetLevel(eC_Value vPercent)
void SetStepSize(eC_UInt uiIntValues)
Base_t
Whether base is at minimum or maximum of the range.
Definition: GUIRange.h:72
void SetMaxValue(eC_Int iMaxValue)
Definition: GUIRange.h:288
Helper class to supply a platform independent rectangle implementation.
Definition: GUIRect.h:63
CGUIValue stores a single value in one specific type.
Definition: GUIValue.h:25
eC_Int ToInt() const