Logo ROOT   6.08/07
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-2008, 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 // //
17 // TGEventHandler //
18 // //
19 //////////////////////////////////////////////////////////////////////////
20 
21 #ifndef ROOT_TNamed
22 #include "TNamed.h"
23 #endif
24 #ifndef ROOT_TQObject
25 #include "TQObject.h"
26 #endif
27 #ifndef ROOT_GuiTypes
28 #include "GuiTypes.h"
29 #endif
30 
31 class TGWindow;
32 
33 class TGEventHandler : public TNamed, public TQObject {
34 
35 private:
36 
37  TGEventHandler(const TGEventHandler&); // Not implemented
38  TGEventHandler& operator=(const TGEventHandler&); // Not implemented
39 
40  Bool_t fIsActive; // kTRUE if handler is active, kFALSE if not active
43 
44  void *GetSender() { return this; } //used to set gTQSender
45 
46 public:
47  TGEventHandler(const char *name, TGWindow *w, TObject *obj, const char *title="") :
48  TNamed(name, title), fIsActive(kTRUE), fWindow(w), fObject(obj) { };
49  virtual ~TGEventHandler() { }
50 
51  void Activate() { fIsActive = kTRUE; }
52  void DeActivate() { fIsActive = kFALSE; }
53  Bool_t IsActive() const { return fIsActive; }
54  virtual Bool_t HandleEvent(Event_t *ev);
55  virtual Bool_t HandleConfigureNotify(Event_t *) { return kFALSE; }
56  virtual Bool_t HandleButton(Event_t *) { return kFALSE; }
57  virtual Bool_t HandleDoubleClick(Event_t *) { return kFALSE; }
58  virtual Bool_t HandleCrossing(Event_t *) { return kFALSE; }
59  virtual Bool_t HandleMotion(Event_t *) { return kFALSE; }
60  virtual Bool_t HandleKey(Event_t *) { return kFALSE; }
61  virtual Bool_t HandleFocusChange(Event_t *) { return kFALSE; }
62  virtual Bool_t HandleSelection(Event_t *) { return kFALSE; }
64  virtual Bool_t HandleSelectionClear(Event_t *) { return kFALSE; }
65  virtual Bool_t HandleColormapChange(Event_t *) { return kFALSE; }
66  virtual void ProcessedEvent(Event_t *event)
67  { Emit("ProcessedEvent(Event_t*)", (Long_t)event); } //*SIGNAL*
68 
69  virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2);
71  virtual void Repaint() { }
72 
73  ClassDef(TGEventHandler,0) // Abstract event handler
74 };
75 
76 #endif
77 
TGEventHandler & operator=(const TGEventHandler &)
virtual ~TGEventHandler()
virtual Bool_t HandleColormapChange(Event_t *)
Bool_t IsActive() const
virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2)
Send message (i.e.
This is the ROOT implementation of the Qt object communication mechanism (see also http://www...
Definition: TQObject.h:53
TObject * fObject
virtual void Repaint()
void * GetSender()
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual Bool_t HandleSelection(Event_t *)
virtual Bool_t HandleConfigureNotify(Event_t *)
virtual Bool_t HandleButton(Event_t *)
#define ClassDef(name, id)
Definition: Rtypes.h:254
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
virtual Bool_t HandleDoubleClick(Event_t *)
virtual Bool_t HandleSelectionClear(Event_t *)
void Emit(const char *signal)
Acitvate signal without args.
Definition: TQObject.cxx:561
virtual Bool_t HandleCrossing(Event_t *)
virtual Bool_t HandleKey(Event_t *)
TGEventHandler(const char *name, TGWindow *w, TObject *obj, const char *title="")
virtual Bool_t HandleFocusChange(Event_t *)
long Long_t
Definition: RtypesCore.h:50
TGEventHandler(const TGEventHandler &)
virtual Bool_t ProcessMessage(Long_t, Long_t, Long_t)
Mother of all ROOT objects.
Definition: TObject.h:37
TGWindow * fWindow
virtual Bool_t HandleMotion(Event_t *)
virtual Bool_t HandleSelectionRequest(Event_t *)
virtual Bool_t HandleEvent(Event_t *ev)
Handle the event.
virtual void ProcessedEvent(Event_t *event)
const Bool_t kTRUE
Definition: Rtypes.h:91
char name[80]
Definition: TGX11.cxx:109