Guiliani  Version 2.5 revision 7293 (documentation build 13)
GUIGauge.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 GUIGAUGE__H_
11#define GUIGAUGE__H_
12
13#include "GUIAbstractBar.h"
14#include "GUIImageResource.h"
15#include "GUIColorPropertyObserver.h"
16#include "GUIPropertyResource.h"
17
19// @guiliani_doxygen toplevel_control Gauge
30// @endguiliani_doxygen
98{
99public:
115 CGUICompositeObject* const pkParent,
116 const eC_Value& vX, const eC_Value& vY,
117 const eC_Value& vWidth, const eC_Value& vHeight,
118 const eC_Int iMin, const eC_Int iMax,
119 const eC_Value vMinAngle, const eC_Value vMaxAngle,
120 const ImageResource_t eGaugeImage,
121 const eC_Value& vNeedleLength,
122 const ObjectHandle_t &eID = NO_HANDLE);
123
139 CGUICompositeObject* const pkParent,
140 const eC_Value& vX, const eC_Value& vY,
141 const eC_Value& vWidth, const eC_Value& vHeight,
142 const eC_Int iMin, const eC_Int iMax,
143 const eC_Value vMinAngle, const eC_Value vMaxAngle,
144 const ImageResource_t eGaugeImage,
145 const ImageResource_t eNeedleImage,
146 const ObjectHandle_t &eID = NO_HANDLE);
147
148 virtual ~CGUIGauge();
149
150 virtual eC_Bool DoDraw();
151
159 void SetMinAngle(const eC_Value vMinAngle);
160
168 eC_Value GetMinAngle() const;
169
174 void SetMaxAngle(const eC_Value vMaxAngle);
175
179 eC_Value GetMaxAngle() const;
180
184 void SetSimulate(const eC_Bool bSimulate);
185
186 virtual void DoAnimate(const eC_Value& vTimes = eC_FromInt(1));
187
192 void SetNeedleLength(const eC_Value vLength);
193
197 eC_Value GetNeedleLength() const;
198
203 void SetNeedleWidth(const eC_Value vWidth);
204
208 eC_Value GetNeedleWidth() const;
209
215 void SetNeedleImage(const ImageResource_t eNeedleImageID);
216
221
225 void SetNeedleColor(const eC_UInt& uiNeedleColor);
226
230 void SetNeedleColor(const GlobalProperty_t& eNeedleColor);
231
235 eC_UInt GetNeedleColor() const;
236
240 void SetShadowColor(const eC_UInt& uiShadowColor);
241
245 void SetShadowColor(const GlobalProperty_t& eShadowColor);
246
250 eC_UInt GetShadowColor() const;
251
255 void SetGaugeImage(const ImageResource_t eGaugeImageID);
256
261
262 virtual eC_Bool IsHighlightable() const { return false; }
263
264#ifdef GUILIANI_WRITE_GUI
265 virtual void WriteToStream(const eC_Bool bWriteClassID);
266#endif
267#ifdef GUILIANI_STREAM_GUI
268 CGUIGauge();
269 virtual void ReadFromStream();
270#endif
271
272protected:
280 void Init(const eC_Int iMin, const eC_Int iMax, const eC_Value vMinAngle, const eC_Value vMaxAngle, const ImageResource_t eGaugeImage);
281
286 virtual eC_Bool OnValueChange();
287
289 virtual void DrawGauge();
290
292 virtual void DrawNeedle();
293
296
299
302
303private:
304 static const eC_UInt INDEX_COLOR_NEEDLE;
305 static const eC_UInt INDEX_COLOR_SHADOW;
306
308 eC_Value m_vMinAngle;
310 eC_Value m_vMaxAngle;
312 eC_Value m_vAngle;
314 eC_Value m_vEndX;
316 eC_Value m_vEndY;
318 eC_Value m_vNeedleLength;
320 eC_Value m_vNeedleWidth;
322 ImageResource_t m_eGaugeImage;
324 ImageResource_t m_eNeedleImage;
326 eC_Bool m_bSimulate;
327};
328
329#endif
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
Helper Macros in Guiliani
GlobalProperty_t
List of property resource ids.
Definition: GUIPropertyResource.h:67
Base class for bars.
Definition: GUIAbstractBar.h:33
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
Basic gauge control, which visualizes values on a meter using a needle.
Definition: GUIGauge.h:98
void SetShadowColor(const eC_UInt &uiShadowColor)
void SetNeedleLength(const eC_Value vLength)
CGUIGauge(CGUICompositeObject *const pkParent, const eC_Value &vX, const eC_Value &vY, const eC_Value &vWidth, const eC_Value &vHeight, const eC_Int iMin, const eC_Int iMax, const eC_Value vMinAngle, const eC_Value vMaxAngle, const ImageResource_t eGaugeImage, const ImageResource_t eNeedleImage, const ObjectHandle_t &eID=NO_HANDLE)
eC_UInt GetNeedleColor() const
eC_UInt GetShadowColor() const
virtual eC_Bool OnValueChange()
void SmartInvalidation()
Improved invalidation method, which does not simply invalidate the entire object, but instead only th...
void SetShadowColor(const GlobalProperty_t &eShadowColor)
void SetMinAngle(const eC_Value vMinAngle)
ImageResource_t GetNeedleImage() const
void SetGaugeImage(const ImageResource_t eGaugeImageID)
void Init(const eC_Int iMin, const eC_Int iMax, const eC_Value vMinAngle, const eC_Value vMaxAngle, const ImageResource_t eGaugeImage)
virtual void ReadFromStream()
virtual void DoAnimate(const eC_Value &vTimes=eC_FromInt(1))
void SetNeedleImage(const ImageResource_t eNeedleImageID)
void SetNeedleColor(const GlobalProperty_t &eNeedleColor)
eC_Value GetNeedleWidth() const
void SetMaxAngle(const eC_Value vMaxAngle)
void SetNeedleWidth(const eC_Value vWidth)
eC_Value GetMinAngle() const
virtual eC_Bool IsHighlightable() const
Definition: GUIGauge.h:262
eC_Value GetMaxAngle() const
virtual void DrawGauge()
Helper method for drawing the gauge.
virtual void DrawNeedle()
Helper method for drawing the needle.
ImageResource_t GetGaugeImage() const
void CalculateEndpoint()
Calculates the endpoint of the needle's tip after rotation.
CGUIGauge(CGUICompositeObject *const pkParent, const eC_Value &vX, const eC_Value &vY, const eC_Value &vWidth, const eC_Value &vHeight, const eC_Int iMin, const eC_Int iMax, const eC_Value vMinAngle, const eC_Value vMaxAngle, const ImageResource_t eGaugeImage, const eC_Value &vNeedleLength, const ObjectHandle_t &eID=NO_HANDLE)
eC_Value GetNeedleLength() const
void SetNeedleColor(const eC_UInt &uiNeedleColor)
void SetSimulate(const eC_Bool bSimulate)
void UpdateNeedleAngle()
Updates the needle's rotationangle with respect to Min/Max Value and Min/Max Angle.
virtual eC_Bool DoDraw()
virtual void WriteToStream(const eC_Bool bWriteClassID)