Guiliani  Version 2.6 revision 7293 (documentation build 12)
GUIPrimitiveButton.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 GUIPRIMITIVE_BUTTON__H_
11#define GUIPRIMITIVE_BUTTON__H_
12
13#include "GUICompositeObject.h"
14#include "GUITextResource.h"
15#include "GUICommand.h"
16
17class CGUIText;
18
23{
24public:
36 CGUICompositeObject* const pkParent,
37 const eC_Value& vX,
38 const eC_Value& vY,
39 const eC_Value& vWidth,
40 const eC_Value& vHeight,
41 const eC_String& rkText,
42 CGUICommandPtr pCommandObject,
43 const ObjectHandle_t &eID = NO_HANDLE);
44
53 CGUICompositeObject* const pkParent,
54 const CGUIRect &kRect,
55 const eC_String& rkText,
56 CGUICommandPtr pCommandObject,
57 const ObjectHandle_t &eID = NO_HANDLE);
58
70 CGUICompositeObject* const pkParent,
71 const eC_Value& vX,
72 const eC_Value& vY,
73 const eC_Value& vWidth,
74 const eC_Value& vHeight,
75 const TextResource_t &eTextID,
76 CGUICommandPtr pCommandObject,
77 const ObjectHandle_t &eID = NO_HANDLE);
78
87 CGUICompositeObject* const pkParent,
88 const CGUIRect &kRect,
89 const TextResource_t &eTextID,
90 CGUICommandPtr pCommandObject,
91 const ObjectHandle_t &eID = NO_HANDLE);
92
110 CGUICompositeObject* const pkParent,
111 const eC_Value& vX,
112 const eC_Value& vY,
113 const TextResource_t &eTextID,
114 CGUICommandPtr pCommandObject,
115 const ObjectHandle_t &eBtnStandard,
116 const ObjectHandle_t &eBtnPressed = NO_HANDLE,
117 const ObjectHandle_t &eBtnHighlighted = NO_HANDLE,
118 const ObjectHandle_t &eBtnGrayedOut = NO_HANDLE,
119 const ObjectHandle_t &eBtnFocused = NO_HANDLE,
120 const ObjectHandle_t &eID = NO_HANDLE);
121
126
132
137
140
152 ObjectHandle_t eBtnStandard,
153 ObjectHandle_t eBtnPressed,
154 ObjectHandle_t eBtnHighlighted,
155 ObjectHandle_t eBtnGrayedOut,
156 ObjectHandle_t eBtnFocused);
157
166 ObjectHandle_t& eBtnStandard,
167 ObjectHandle_t& eBtnPressed,
168 ObjectHandle_t& eBtnHighlighted,
169 ObjectHandle_t& eBtnGrayedOut,
170 ObjectHandle_t& eBtnFocused);
171
177
182 inline void SetCommand(CGUICommandPtr pCommand) { m_pkCommandObject = pCommand; }
183
189
190 virtual eC_Bool DoDraw();
191
192 virtual eC_Bool DoClick(const eC_Value& vAbsX = eC_FromInt(-1), const eC_Value& vAbsY = eC_FromInt(-1));
193
194 virtual eC_Bool DoButtonDown(const eC_Value& vAbsX = eC_FromInt(-1), const eC_Value& vAbsY = eC_FromInt(-1));
195
196 virtual eC_Bool DoButtonUp(const eC_Value& vAbsX = eC_FromInt(-1), const eC_Value& vAbsY = eC_FromInt(-1));
197
198 virtual eC_Bool DoDrag(const eC_Value& vDeltaX, const eC_Value& vDeltaY, const eC_Value& vAbsX, const eC_Value& vAbsY);
199
200 virtual eC_Bool DoDragEnd(const eC_Value& vAbsX = eC_FromInt(-1), const eC_Value& vAbsY = eC_FromInt(-1));
201
202 virtual eC_Bool DoMouseEnter(const eC_Value& vAbsX = eC_FromInt(-1), const eC_Value& vAbsY = eC_FromInt(-1));
203
204 virtual eC_Bool DoMouseLeave(const eC_Value& vAbsX = eC_FromInt(-1), const eC_Value& vAbsY = eC_FromInt(-1));
205
206 virtual eC_Bool DoMouseMove(const eC_Value& vAbsX = eC_FromInt(-1), const eC_Value& vAbs = eC_FromInt(-1));
207
208 virtual void GetFocus();
209
210 virtual void LoseFocus();
211
212 virtual void SetGrayedOut(const eC_Bool &bGrayOut);
213
214#ifdef GUILIANI_STREAM_GUI
215 virtual void ReadFromStream();
216#endif
217#ifdef GUILIANI_WRITE_GUI
218 virtual void WriteToStream(const eC_Bool bWriteClassID = false);
219#endif
220
221protected:
224 {
230 };
231
234
238 virtual void SetButtonState();
239
246
248
249private:
251 void Init(const eC_String& kText);
253 void Init(const TextResource_t &eTextID);
255 void DeInit();
256};
257#endif //GUIPRIMITIVE_BUTTON__H_
ObjectHandle_t
List of object resource ids.
Definition: GUIObjectHandleResource.h:55
Helper Macros in Guiliani
TextResource_t
List of text resource ids.
Definition: GUITextResource.h:40
This is the Guiliani base class for all composite objects.
Definition: GUICompositeObject.h:70
button which constructs from other objects (ALPHA)
Definition: GUIPrimitiveButton.h:23
virtual eC_Bool DoDragEnd(const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1))
virtual void GetFocus()
ObjectHandle_t m_eBtnHighlighted
the highlighted Object ID
Definition: GUIPrimitiveButton.h:242
CGUIPrimitiveButton(CGUICompositeObject *const pkParent, const eC_Value &vX, const eC_Value &vY, const TextResource_t &eTextID, CGUICommandPtr pCommandObject, const ObjectHandle_t &eBtnStandard, const ObjectHandle_t &eBtnPressed=NO_HANDLE, const ObjectHandle_t &eBtnHighlighted=NO_HANDLE, const ObjectHandle_t &eBtnGrayedOut=NO_HANDLE, const ObjectHandle_t &eBtnFocused=NO_HANDLE, const ObjectHandle_t &eID=NO_HANDLE)
ObjectHandle_t m_eBtnStandard
the standard Object ID
Definition: GUIPrimitiveButton.h:240
virtual eC_Bool DoDrag(const eC_Value &vDeltaX, const eC_Value &vDeltaY, const eC_Value &vAbsX, const eC_Value &vAbsY)
virtual eC_Bool DoClick(const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1))
virtual void SetButtonState()
virtual void LoseFocus()
CGUIPrimitiveButton(CGUICompositeObject *const pkParent, const CGUIRect &kRect, const TextResource_t &eTextID, CGUICommandPtr pCommandObject, const ObjectHandle_t &eID=NO_HANDLE)
ObjectHandle_t m_eBtnGrayedOut
the grayed out Object ID
Definition: GUIPrimitiveButton.h:243
virtual eC_Bool DoMouseLeave(const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1))
CGUIPrimitiveButton(CGUICompositeObject *const pkParent, const eC_Value &vX, const eC_Value &vY, const eC_Value &vWidth, const eC_Value &vHeight, const TextResource_t &eTextID, CGUICommandPtr pCommandObject, const ObjectHandle_t &eID=NO_HANDLE)
virtual eC_Bool DoButtonDown(const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1))
ObjectHandle_t m_eBtnPressed
the pressed Object ID
Definition: GUIPrimitiveButton.h:241
void GetHandles(ObjectHandle_t &eBtnStandard, ObjectHandle_t &eBtnPressed, ObjectHandle_t &eBtnHighlighted, ObjectHandle_t &eBtnGrayedOut, ObjectHandle_t &eBtnFocused)
virtual eC_Bool DoDraw()
CGUIText * m_pkLabel
Label of button.
Definition: GUIPrimitiveButton.h:247
virtual void ReadFromStream()
virtual ~CGUIPrimitiveButton()
virtual eC_Bool DoButtonUp(const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1))
virtual void WriteToStream(const eC_Bool bWriteClassID=false)
ObjectHandle_t m_eBtnFocused
the focused Object ID
Definition: GUIPrimitiveButton.h:244
virtual eC_Bool DoMouseEnter(const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbsY=eC_FromInt(-1))
virtual void SetGrayedOut(const eC_Bool &bGrayOut)
CGUIPrimitiveButton & operator=(const CGUIPrimitiveButton &kSource)
CGUIPrimitiveButton(const CGUIPrimitiveButton &kSource)
CGUIText * GetLabel() const
ButtonState_t m_eButtonState
Current button state.
Definition: GUIPrimitiveButton.h:233
CGUICommandPtr m_pkCommandObject
Holds the attached command.
Definition: GUIPrimitiveButton.h:245
void SetHandles(ObjectHandle_t eBtnStandard, ObjectHandle_t eBtnPressed, ObjectHandle_t eBtnHighlighted, ObjectHandle_t eBtnGrayedOut, ObjectHandle_t eBtnFocused)
void SetCommand(CGUICommandPtr pCommand)
Definition: GUIPrimitiveButton.h:182
CGUIPrimitiveButton(CGUICompositeObject *const pkParent, const eC_Value &vX, const eC_Value &vY, const eC_Value &vWidth, const eC_Value &vHeight, const eC_String &rkText, CGUICommandPtr pCommandObject, const ObjectHandle_t &eID=NO_HANDLE)
virtual eC_Bool DoMouseMove(const eC_Value &vAbsX=eC_FromInt(-1), const eC_Value &vAbs=eC_FromInt(-1))
ButtonState_t
Button States.
Definition: GUIPrimitiveButton.h:224
@ BUTTON_STATE_GRAYEDOUT
Grayed out state.
Definition: GUIPrimitiveButton.h:228
@ BUTTON_STATE_HIGHLIGHTED
Highlighted state.
Definition: GUIPrimitiveButton.h:226
@ BUTTON_STATE_FOCUSED
Focused state.
Definition: GUIPrimitiveButton.h:229
@ BUTTON_STATE_PRESSED
Pressed state.
Definition: GUIPrimitiveButton.h:225
@ BUTTON_STATE_STANDARD
Standard state.
Definition: GUIPrimitiveButton.h:227
CGUICommandPtr GetCommand() const
Definition: GUIPrimitiveButton.h:188
CGUIPrimitiveButton(CGUICompositeObject *const pkParent, const CGUIRect &kRect, const eC_String &rkText, CGUICommandPtr pCommandObject, const ObjectHandle_t &eID=NO_HANDLE)
Helper class to supply a platform independent rectangle implementation.
Definition: GUIRect.h:63
Class for handling a text.
Definition: GUIText.h:103