Logo ROOT   6.12/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 #include "TNamed.h"
22 #include "TQObject.h"
23 #include "GuiTypes.h"
24 
25 class TGWindow;
26 
27 class TGEventHandler : public TNamed, public TQObject {
28 
29 private:
30 
31  TGEventHandler(const TGEventHandler&); // Not implemented
32  TGEventHandler& operator=(const TGEventHandler&); // Not implemented
33 
34  Bool_t fIsActive; // kTRUE if handler is active, kFALSE if not active
37 
38  void *GetSender() { return this; } //used to set gTQSender
39 
40 public:
41  TGEventHandler(const char *name, TGWindow *w, TObject *obj, const char *title="") :
42  TNamed(name, title), fIsActive(kTRUE), fWindow(w), fObject(obj) { };
43  virtual ~TGEventHandler() { }
44 
45  void Activate() { fIsActive = kTRUE; }
46  void DeActivate() { fIsActive = kFALSE; }
47  Bool_t IsActive() const { return fIsActive; }
48  virtual Bool_t HandleEvent(Event_t *ev);
49  virtual Bool_t HandleConfigureNotify(Event_t *) { return kFALSE; }
50  virtual Bool_t HandleButton(Event_t *) { return kFALSE; }
51  virtual Bool_t HandleDoubleClick(Event_t *) { return kFALSE; }
52  virtual Bool_t HandleCrossing(Event_t *) { return kFALSE; }
53  virtual Bool_t HandleMotion(Event_t *) { return kFALSE; }
54  virtual Bool_t HandleKey(Event_t *) { return kFALSE; }
55  virtual Bool_t HandleFocusChange(Event_t *) { return kFALSE; }
56  virtual Bool_t HandleSelection(Event_t *) { return kFALSE; }
58  virtual Bool_t HandleSelectionClear(Event_t *) { return kFALSE; }
59  virtual Bool_t HandleColormapChange(Event_t *) { return kFALSE; }
60  virtual void ProcessedEvent(Event_t *event)
61  { Emit("ProcessedEvent(Event_t*)", (Long_t)event); } //*SIGNAL*
62 
63  virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2);
65  virtual void Repaint() { }
66 
67  ClassDef(TGEventHandler,0) // Abstract event handler
68 };
69 
70 #endif
71 
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:49
TObject * fObject
virtual void Repaint()
void * GetSender()
bool Bool_t
Definition: RtypesCore.h:59
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:320
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
virtual Bool_t HandleDoubleClick(Event_t *)
virtual Bool_t HandleSelectionClear(Event_t *)
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 *)
const Bool_t kFALSE
Definition: RtypesCore.h:88
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.
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:165
virtual void ProcessedEvent(Event_t *event)
const Bool_t kTRUE
Definition: RtypesCore.h:87
char name[80]
Definition: TGX11.cxx:109