Guiliani  Version 2.5 revision 7293 (documentation build 13)
GUIBaseCheckBox.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 GUIBASECHECKBOX__H_
11#define GUIBASECHECKBOX__H_
12
13#include "GUIBaseButton.h"
14
16
65 : public CGUIBaseButton
66{
67public:
68
71 {
78 };
79
80
85
96 CGUICompositeObject* const pkParent,
97 const eC_Value& vX,
98 const eC_Value& vY,
99 const eC_Value& vWidth,
100 const eC_Value& vHeight,
101 const eC_Bool &bSelected = false,
102 const ObjectHandle_t &eID = NO_HANDLE);
103
111 CGUICompositeObject* const pkParent,
112 const CGUIRect &kRect,
113 const eC_Bool &bSelected = false,
114 const ObjectHandle_t &eID = NO_HANDLE);
115
120
126
129
135 virtual eC_Bool SetValue(const CGUIValue& rkValue)
136 {
137 SetSelected(rkValue.ToBool());
138 CGUIObject::SetValue(rkValue);
139 return true;
140 }
141
142 virtual eC_Bool DoClick(const eC_Value& vAbsX, const eC_Value& vAbsY);
143
144 virtual eC_Bool DoDraw();
145
149 virtual void SetSelected(eC_Bool bSelect)
150 {
151 if (m_bIsSelected != bSelect)
152 {
153 m_bIsSelected = bSelect;
155 m_kSelectionSubject.NotifyObservers(CGUIValue(m_bIsSelected), this);
156 NotifyValueObservers(m_bIsSelected);
157 }
158 }
159
163 virtual eC_Bool IsSelected() const
164 {
165 return m_bIsSelected;
166 }
167
175
180
181#ifdef GUILIANI_STREAM_GUI
182 virtual void ReadFromStream();
183#endif
184
185#ifdef GUILIANI_WRITE_GUI
186 virtual void WriteToStream(const eC_Bool bWriteClassID = false);
187#endif
188
194
200 virtual CGUIRect CalculateLabelRect(const CGUIRect &kIconRect);
201
206
210 void SetIconRect(const CGUIRect& kRect);
211
212protected:
216 void Init(const eC_Bool &bSelected);
217
220
223
224private:
229 void CopyAttributes(const CGUIBaseCheckBox& kSource);
230
232 eC_Bool m_bIsSelected;
233
235 CGUISubject m_kSelectionSubject;
236};
237
238#endif
ObjectHandle_t
List of object resource ids.
Definition: GUIObjectHandleResource.h:55
Base class for button controls.
Definition: GUIBaseButton.h:69
Base class for checkboxes.
Definition: GUIBaseCheckBox.h:66
CGUIRect m_kIconRelRect
Icon size/position in relative coordinates.
Definition: GUIBaseCheckBox.h:222
void RemoveSelectionObserver(CGUIObserver *pObserver)
CheckBoxLayout_t m_eCheckBoxLayout
Position of text label relative to checkbox element.
Definition: GUIBaseCheckBox.h:219
CGUIBaseCheckBox(CGUICompositeObject *const pkParent, const eC_Value &vX, const eC_Value &vY, const eC_Value &vWidth, const eC_Value &vHeight, const eC_Bool &bSelected=false, const ObjectHandle_t &eID=NO_HANDLE)
virtual eC_Bool IsSelected() const
Definition: GUIBaseCheckBox.h:163
virtual eC_Bool DoClick(const eC_Value &vAbsX, const eC_Value &vAbsY)
CGUIBaseCheckBox(CGUICompositeObject *const pkParent, const CGUIRect &kRect, const eC_Bool &bSelected=false, const ObjectHandle_t &eID=NO_HANDLE)
CGUIBaseCheckBox & operator=(const CGUIBaseCheckBox &kSource)
virtual void WriteToStream(const eC_Bool bWriteClassID=false)
virtual void SetSelected(eC_Bool bSelect)
Definition: GUIBaseCheckBox.h:149
void SetCheckBoxLayout(const CheckBoxLayout_t eLayout)
CheckBoxLayout_t
Enumeration for checkbox layout styles.
Definition: GUIBaseCheckBox.h:71
@ ICON_RIGHT_AUTOSCALE
Icon right and scaled automatically - Text resides left.
Definition: GUIBaseCheckBox.h:74
@ ICON_LEFT_CENTERED
Icon left and not scaled - Text resides right.
Definition: GUIBaseCheckBox.h:75
@ MANUAL_LAYOUT
No automatic layout. Values set by user will remain untouched.
Definition: GUIBaseCheckBox.h:72
@ ICON_RIGHT_CENTERED
Icon right and not scaled- Text resides left.
Definition: GUIBaseCheckBox.h:76
@ ICON_FILL_OBJECT
The Icon will fill the entire area of the object.
Definition: GUIBaseCheckBox.h:77
@ ICON_LEFT_AUTOSCALE
Icon left and scaled automatically - Text resides right.
Definition: GUIBaseCheckBox.h:73
CGUIBaseCheckBox(const CGUIBaseCheckBox &kSource)
virtual CGUIRect CalculateIconRect()
virtual CGUIRect CalculateLabelRect(const CGUIRect &kIconRect)
virtual ~CGUIBaseCheckBox()
Destructor.
virtual void ReadFromStream()
virtual eC_Bool DoDraw()
virtual eC_Bool SetValue(const CGUIValue &rkValue)
Definition: GUIBaseCheckBox.h:135
void Init(const eC_Bool &bSelected)
void SetIconRect(const CGUIRect &kRect)
This is the Guiliani base class for all composite objects.
Definition: GUICompositeObject.h:70
void NotifyValueObservers(const CGUIValue &kValue, const eC_UInt uiX=0, const eC_UInt uiY=0)
Definition: GUIObject.h:1030
virtual eC_Bool SetValue(const CGUIValue &rkValue)
Definition: GUIObject.h:1059
void InvalidateArea()
Observer Base class for Observer-Design-Pattern within Guiliani.
Definition: GUIObserver.h:28
Helper class to supply a platform independent rectangle implementation.
Definition: GUIRect.h:63
Subject Base class for Observer-Design-Pattern within Guiliani.
Definition: GUISubject.h:34
void NotifyObservers()
CGUIValue stores a single value in one specific type.
Definition: GUIValue.h:25
eC_Bool ToBool() const
void AddSelectionObserver(CGUIObserver *pObserver)