Guiliani  Version 2.6 revision 7293 (documentation build 12)
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
192 void SetScrollModifiers(eC_UInt uiScrollModifiers);
193
203 void SetDragThreshold(const eC_Int iDragThreshold);
204
208 eC_Int GetDragThreshold() const;
209
215 void SetHighlightingDisabled(const eC_Bool bDisabled);
216
219 void SetLongClickTime(const eC_UInt uiLongClickTime);
220
223 eC_UInt GetLongClickTime() const;
224
227 void SetDoubleClickTime(const eC_UInt uiDoubleClickTime);
228
231 eC_UInt GetDoubleClickTime() const;
232
235 eC_UInt GetIdleTime();
236
242 void GetDragStart(eC_Int& iDragStartX, eC_Int& iDragStartY);
243
247
252 eC_Bool ExecuteClickHandler(CGUIObject* pkObject);
253
257 eC_Bool IsWithinModalDialogIfAny(const CGUIObject* pObj) const;
258
262 eC_Bool IsLeftMouseButtonPressed() const { return m_bLeftButtonPressed; }
263
267 eC_Bool IsRightMouseButtonPressed() const { return m_bRightButtonPressed; }
268
269private:
271
273
276 CGUIEventHandler(const CGUIEventHandler& kSource);
277
280 CGUIEventHandler& operator=(const CGUIEventHandler& kSource);
281
285 void HandleLongClick(eC_Bool& bHandled);
286
289 void HandleFocus();
290
295 void HandleChar(CGUIEvent* pkEvent, eC_Bool& bHandled);
296
301 void HandleKeyUp(CGUIEvent* pkEvent, eC_Bool& bHandled);
302
307 void HandleKeyDown(CGUIEvent* pkEvent, eC_Bool& bHandled);
308
313 void HandleMouseWheel(CGUIEvent* pkEvent, eC_Bool& bHandled);
314
319 void HandleMouseMove(CGUIEvent* pkEvent, eC_Bool& bHandled);
320
325 void HandleRButtonDown(CGUIEvent* pkEvent, eC_Bool& bHandled);
326
331 void HandleLButtonDown(CGUIEvent* pkEvent, eC_Bool& bHandled);
332
337 void HandleRButtonUp(CGUIEvent* pkEvent, eC_Bool& bHandled);
338
343 void HandleLButtonUp(CGUIEvent* pkEvent, eC_Bool& bHandled);
344
345#ifdef GUILIANI_GESTURES_ACTIVE
348 void HandleGesture(CGUIEvent* pkEvent, eC_Bool& bHandled);
349#endif
350
357 void HandleEvent(CGUIEvent *pkEvent);
358
369 ObjectHandle_t HandleModalEvents(
370 CGUIEvent* pkEvent,
371 ObjectHandle_t eObjOK = NO_HANDLE,
372 ObjectHandle_t eObjCancel = NO_HANDLE,
373 ObjectHandle_t eObjAdditional = NO_HANDLE);
374
377 void NotifyOfDestruction(CGUIObject* pObj);
378
382 void SetPressedObject(CGUIObject* pObj, eC_Bool bOverwriteOriginal = false);
383
387 void SetHighlightedObject(CGUIObject* pHighlightedObject);
388
391 void SetFocussedObject(CGUIObject* pObj);
392
395 void SetDraggedObject(CGUIObject* pObj);
396
397private:
400 CGUIObject* m_pkFormerlyUnderMouseObject;
401
405 CGUIObject* m_pkFocussedObject;
406
412 CGUIObject* m_pkHighlightedObject;
413
417 CGUIObject* m_pkPressedObject;
418
423 CGUIObject* m_pkOriginallyPressedObject;
424
430 ObjectHandle_t m_ePressedObjectID;
431
433 CGUIObject* m_pkDraggedObject;
434
438 CGUIObject* m_pkObjectUnderMousePointer;
439
442
444 eC_TListDoubleLinked<const CGUICompositeObject*> m_kModalDialogExceptionList;
445
447 eC_Bool m_bLeftButtonPressed;
449 eC_Bool m_bRightButtonPressed;
450
452 eC_Int m_iOldMouseX;
454 eC_Int m_iOldMouseY;
455
457 eC_Bool m_bMouseUsed;
458
463 eC_Bool m_bDisableEventHandling;
464
466 CGUIObject* m_pkTempObject;
467
469 CGUIEvent* m_pkEvent;
470
472 eC_UInt m_uiScrollModifiers;
473
475 eC_TListDoubleLinked<CGUIObject*> m_kListOfObjectsToFocus;
477 CGUIObject* m_pkTempFocussedObject;
479 CGUIObject* m_pkFormerlyFocussedObject;
480
482 eC_Int m_iDragStartX;
484 eC_Int m_iDragStartY;
485
487 eC_Int m_iDragThreshold;
488
490 eC_Int m_iCurXPos;
491
493 eC_Int m_iCurYPos;
494
496 eC_Value m_vCurXPos;
497
499 eC_Value m_vCurYPos;
500
502 eC_Bool m_bHighlightingDisabled;
503
505 eC_Bool m_bIsDragging;
506
508 eC_UInt m_uiLastClickTime;
509
511 eC_UInt m_uiDoubleClickTime;
512
514 eC_UInt m_uiLastButtonDownTime;
515
518 eC_UInt m_uiLongClickTime;
519
521 eC_Bool m_bLongClickGenerated;
522
524 CGUIObject* m_pkLastClickedObject;
525
529 eC_Bool m_bForceDoButtonUpToPressedObject;
530
535 eC_Bool m_bIgnorePressedObjectRect;
536
540 eC_Bool m_bDragAndClick;
541};
542
543#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)
eC_Bool IsLeftMouseButtonPressed() const
Definition: GUIEventHandler.h:262
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)
eC_Bool IsRightMouseButtonPressed() const
Definition: GUIEventHandler.h:267
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:39
Represents platform-independent mouse events.
Definition: GUIEvent.h:177
This is the Guiliani base class all controls are derived from.
Definition: GUIObject.h:81