Logo ROOT  
Reference Guide
TGEventHandler.h
Go to the documentation of this file.
1// @(#)root/gui:$Id: TGEventHandler.h
2// Author: Bertrand Bellenot 29/01/2008
3
4/*************************************************************************
5 * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TGEventHandler
13#define ROOT_TGEventHandler
14
15
16#include "TNamed.h"
17#include "TQObject.h"
18#include "GuiTypes.h"
19
20class TGWindow;
21
22class TGEventHandler : public TNamed, public TQObject {
23
24private:
25
28
29 Bool_t fIsActive; ///< kTRUE if handler is active, kFALSE if not active
32
33 void *GetSender() override { return this; } //used to set gTQSender
34
35public:
36 TGEventHandler(const char *name, TGWindow *w, TObject *obj, const char *title="") :
37 TNamed(name, title), fIsActive(kTRUE), fWindow(w), fObject(obj) { }
38 virtual ~TGEventHandler() { }
39
40 void Activate() { fIsActive = kTRUE; }
42 Bool_t IsActive() const { return fIsActive; }
43 virtual Bool_t HandleEvent(Event_t *ev);
45 virtual Bool_t HandleButton(Event_t *) { return kFALSE; }
46 virtual Bool_t HandleDoubleClick(Event_t *) { return kFALSE; }
47 virtual Bool_t HandleCrossing(Event_t *) { return kFALSE; }
48 virtual Bool_t HandleMotion(Event_t *) { return kFALSE; }
49 virtual Bool_t HandleKey(Event_t *) { return kFALSE; }
50 virtual Bool_t HandleFocusChange(Event_t *) { return kFALSE; }
51 virtual Bool_t HandleSelection(Event_t *) { return kFALSE; }
56 { Emit("ProcessedEvent(Event_t*)", (Longptr_t)event); } //*SIGNAL*
57
58 virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2);
60 virtual void Repaint() { }
61
62 ClassDefOverride(TGEventHandler,0) // Abstract event handler
63};
64
65#endif
66
bool Bool_t
Definition: RtypesCore.h:63
long Longptr_t
Definition: RtypesCore.h:82
const Bool_t kFALSE
Definition: RtypesCore.h:101
const Bool_t kTRUE
Definition: RtypesCore.h:100
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
char name[80]
Definition: TGX11.cxx:110
TGEventHandler & operator=(const TGEventHandler &)=delete
virtual Bool_t HandleSelection(Event_t *)
TGEventHandler(const TGEventHandler &)=delete
virtual Bool_t HandleKey(Event_t *)
virtual Bool_t HandleMotion(Event_t *)
virtual void ProcessedEvent(Event_t *event)
Bool_t IsActive() const
virtual ~TGEventHandler()
virtual Bool_t HandleEvent(Event_t *ev)
Handle the event.
virtual Bool_t HandleColormapChange(Event_t *)
virtual Bool_t HandleCrossing(Event_t *)
virtual Bool_t HandleButton(Event_t *)
virtual Bool_t HandleSelectionRequest(Event_t *)
virtual Bool_t HandleSelectionClear(Event_t *)
virtual void Repaint()
TGEventHandler(const char *name, TGWindow *w, TObject *obj, const char *title="")
virtual Bool_t HandleConfigureNotify(Event_t *)
TObject * fObject
Bool_t fIsActive
kTRUE if handler is active, kFALSE if not active
virtual Bool_t HandleDoubleClick(Event_t *)
virtual Bool_t HandleFocusChange(Event_t *)
TGWindow * fWindow
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Send message (i.e.
void * GetSender() override
virtual Bool_t ProcessMessage(Longptr_t, Longptr_t, Longptr_t)
ROOT GUI Window base class.
Definition: TGWindow.h:23
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
Mother of all ROOT objects.
Definition: TObject.h:37
This is the ROOT implementation of the Qt object communication mechanism (see also http://www....
Definition: TQObject.h:48
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
Event structure.
Definition: GuiTypes.h:174