Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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
35  TGWindow *fWindow;
36  TObject *fObject;
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; }
57  virtual Bool_t HandleSelectionRequest(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);
64  virtual Bool_t ProcessMessage(Long_t, Long_t, Long_t) { return kFALSE; }
65  virtual void Repaint() { }
66 
67  ClassDef(TGEventHandler,0) // Abstract event handler
68 };
69 
70 #endif
71