Guiliani  Version 2.5 revision 7293 (documentation build 13)
GUIEventHandler.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 GUIEVENTHANDLER__H_
11#define GUIEVENTHANDLER__H_
12
13#include "eC_TList_doubleLinked.h"
14#include "eC_Types.h"
15#include "eC_Math.h"
16
18#include "GUIComponentManager.h"
19#include "GUIRect.h"
20
22#define GETEVENTHDL CGUIComponentManager::GetInstance().GetEventHandler()
23
25const eC_UInt cuiDefaultLongClickTime = 1000;
27const eC_UInt cuiDefaultDoubleClickTime = 300;
28
29class CGUIObject;
30class CGUIEvent;
31class CGUIMouseEvent;
33
35
44{
45 friend class CGUIObject;
46 friend class CGUI;
47 friend class CGUIComponentManager;
48
49public:
52 static void CreateInstance();
53
56 static void DeleteInstance();
57
61 void SetLegacyBehaviour(const eC_Bool bLegacyBehaviour);
62
67
73
78 void FocusLost();
79
84
89
94
99
105
110
118
126
132 eC_Bool IsObjModalDialog(CGUICompositeObject* const pObj) const;
133
140
145
149 eC_Bool MouseWasUsed() const;
150
154 void SetMouseWasUsed(eC_Bool bMouseUsed);
155
160 void GetLastMousePos(eC_UInt &uiMouseX, eC_UInt &uiMouseY) const;
161
166 void SetDisableEventHandling(eC_Bool bDisableEventHandling);
167
171 eC_Bool GetDisableEventHandling() const;
172
185
194 void SetScrollModifiers(eC_UInt uiScrollModifiers);
195
205 void SetDragThreshold(const eC_Int iDragThreshold);
206
210 eC_Int GetDragThreshold() const;
211
217 void SetHighlightingDisabled(const eC_Bool bDisabled);
218
221 void SetLongClickTime(const eC_UInt uiLongClickTime);
222
225 eC_UInt GetLongClickTime() const;
226
229 void SetDoubleClickTime(const eC_UInt uiDoubleClickTime);
230
233 eC_UInt GetDoubleClickTime() const;
234
237 eC_UInt GetIdleTime();
238
244 void GetDragStart(eC_Int& iDragStartX, eC_Int& iDragStartY);
245
249
254 eC_Bool ExecuteClickHandler(CGUIObject* pkObject);
255
259 eC_Bool IsWithinModalDialogIfAny(const CGUIObject* pObj) const;
260
261#ifdef USE_ZOOM
262 void SetZoom(const eC_Value& vZoomFactor, const CGUIRect& kZoomRect)
263 {
264 m_bZoomActive = true;
265 m_vZoomFactor = vZoomFactor;
266 m_kZoomArea = kZoomRect;
267 }
268
269 void ResetZoom()
270 {
271 m_bZoomActive = false;
272 m_vZoomFactor = eC_FromInt(1);
273 }
274#endif
275
276private:
278
280
283 CGUIEventHandler(const CGUIEventHandler& kSource);
284
287 CGUIEventHandler& operator=(const CGUIEventHandler& kSource);
288
292 void HandleLongClick(eC_Bool& bHandled);
293
296 void HandleFocus();
297
302 void HandleChar(CGUIEvent* pEvent, eC_Bool& bHandled);
303
308 void HandleKeyUp(CGUIEvent* pEvent, eC_Bool& bHandled);
309
314 void HandleKeyDown(CGUIEvent* pEvent, eC_Bool& bHandled);
315
320 void HandleMouseWheel(CGUIEvent* pEvent, eC_Bool& bHandled);
321
326 void HandleMouseMove(CGUIEvent* pEvent, eC_Bool& bHandled);
327
332 void HandleRButtonDown(CGUIEvent* pEvent, eC_Bool& bHandled);
333
338 void HandleLButtonDown(CGUIEvent* pEvent, eC_Bool& bHandled);
339
344 void HandleRButtonUp(CGUIEvent* pEvent, eC_Bool& bHandled);
345
350 void HandleLButtonUp(CGUIEvent* pEvent, eC_Bool& bHandled);
351
358 void HandleEvent(CGUIEvent *pEvent);
359
370 ObjectHandle_t HandleModalEvents(
371 CGUIEvent* pkEvent,
372 ObjectHandle_t eObjOK = NO_HANDLE,
373 ObjectHandle_t eObjCancel = NO_HANDLE,
374 ObjectHandle_t eObjAdditional = NO_HANDLE);
375
378 void NotifyOfDestruction(CGUIObject* pObj);
379
383 void SetPressedObject(CGUIObject* pObj, eC_Bool bOverwriteOriginal = false);
384
388 void SetHighlightedObject(CGUIObject* pHighlightedObject);
389
392 void SetFocussedObject(CGUIObject* pObj);
393
396 void SetDraggedObject(CGUIObject* pObj);
397
398private:
401 CGUIObject* m_pkFormerlyUnderMouseObject;
402
406 CGUIObject* m_pkFocussedObject;
407
413 CGUIObject* m_pkHighlightedObject;
414
418 CGUIObject* m_pkPressedObject;
419
424 CGUIObject* m_pkOriginallyPressedObject;
425
431 ObjectHandle_t m_ePressedObjectID;
432
434 CGUIObject* m_pkDraggedObject;
435
439 CGUIObject* m_pkObjectUnderMousePointer;
440
443
445 eC_TListDoubleLinked<const CGUICompositeObject*> m_kModalDialogExceptionList;
446
448 eC_Bool m_bLeftButtonPressed;
450 eC_Bool m_bRightButtonPressed;
451
453 eC_Int m_iOldMouseX;
455 eC_Int m_iOldMouseY;
456
458 eC_Bool m_bMouseUsed;
459
464 eC_Bool m_bDisableEventHandling;
465
467 CGUIObject* m_pkTempObject;
468
470 CGUIEvent* m_pkEvent;
471
474 eC_UInt m_uiScrollModifiers;
475
477 eC_TListDoubleLinked<CGUIObject*> m_kListOfObjectsToFocus;
479 CGUIObject* m_pkTempFocussedObject;
481 CGUIObject* m_pkFormerlyFocussedObject;
482
484 eC_Int m_iDragStartX;
486 eC_Int m_iDragStartY;
487
489 eC_Int m_iDragThreshold;
490
492 eC_Int m_iCurXPos;
493
495 eC_Int m_iCurYPos;
496
498 eC_Value m_vCurXPos;
499
501 eC_Value m_vCurYPos;
502
504 eC_Bool m_bHighlightingDisabled;
505
507 eC_Bool m_bIsDragging;
508
510 eC_UInt m_uiLastClickTime;
511
513 eC_UInt m_uiDoubleClickTime;
514
516 eC_UInt m_uiLastButtonDownTime;
517
520 eC_UInt m_uiLongClickTime;
521
523 eC_Bool m_bLongClickGenerated;
524
526 CGUIObject* m_pkLastClickedObject;
527
531 eC_Bool m_bForceDoButtonUpToPressedObject;
532
537 eC_Bool m_bIgnorePressedObjectRect;
538
542 eC_Bool m_bDragAndClick;
543
544#ifdef USE_ZOOM
545 eC_Bool m_bZoomActive;
546 eC_Value m_vZoomFactor;
547 CGUIRect m_kZoomArea;
548#endif
549};
550
551#endif
Helper Macros in Guiliani
ObjectHandle_t
List of object resource ids.
Definition: GUIObjectHandleResource.h:55
central component-manager
Definition: GUIComponentManager.h:62
This is the Guiliani base class for all composite objects.
Definition: GUICompositeObject.h:70
This is the event handler.
Definition: GUIEventHandler.h:44
void SetHighlightingDisabled(const eC_Bool bDisabled)
CGUIObject * GetHighlightedObject() const
const CGUIEvent * GetCurrentEvent() const
void GetDragStart(eC_Int &iDragStartX, eC_Int &iDragStartY)
void SetModalDialog(CGUICompositeObject *pModalDialog)
void RemoveModalDialogException(CGUICompositeObject *pkException)
CGUIObject * GetFocussedObject() const
CGUIObject * GetObjectUnderMousePointer() const
void SetDisableEventHandling(eC_Bool bDisableEventHandling)
void SetDragThreshold(const eC_Int iDragThreshold)
eC_Bool GetDisableEventHandling() const
void SetScrollModifiers(eC_UInt uiScrollModifiers)
static void CreateInstance()
eC_Bool IsWithinModalDialogIfAny(const CGUIObject *pObj) const
void SetMouseWasUsed(eC_Bool bMouseUsed)
eC_Bool IsObjModalDialog(CGUICompositeObject *const pObj) const
eC_Bool ExecuteClickHandler(CGUIObject *pkObject)
void GetLastMousePos(eC_UInt &uiMouseX, eC_UInt &uiMouseY) const
void AddModalDialogException(CGUICompositeObject *pkException)
void ReleaseModalDialog(CGUICompositeObject *pModalDialog)
CGUIObject * GetDraggedObject() const
eC_UInt GetDoubleClickTime() const
void SetDoubleClickTime(const eC_UInt uiDoubleClickTime)
eC_UInt GetLongClickTime() const
void SetLongClickTime(const eC_UInt uiLongClickTime)
eC_Bool MouseWasUsed() const
CGUIObject * GetPressedObject() const
static void DeleteInstance()
void SetLegacyBehaviour(const eC_Bool bLegacyBehaviour)
CGUIObject * GetFormerlyUnderMouseObject() const
CGUIObject * GetFormerlyFocussedObject() const
CGUICompositeObject * GetCurrentModalDialog() const
eC_Int GetDragThreshold() const
eC_UInt GetIdleTime()
eC_UInt GetLastButtonDownTime()
Base class for Guiliani Events.
Definition: GUIEvent.h:26
GUI base class for any Guiliani application.
Definition: GUI.h:47
Represents platform-independent mouse events.
Definition: GUIEvent.h:159
This is the Guiliani base class all controls are derived from.
Definition: GUIObject.h:79
Helper class to supply a platform independent rectangle implementation.
Definition: GUIRect.h:63