TGraphInteractive.h
1 #ifndef TGRAPH_INTERACTIVE
2 #define TGRAPH_INTERACTIVE
3 
4 #include "TGraphAligned.h"
5 #include "TCanvas.h"
6 
7 
8 namespace Acclaim{
9 
10  class TGraphInteractive;
11 
20  class GuiParent
21  {
22  public:
23 
24 
28  GuiParent(){;}
29 
30  virtual ~GuiParent();
31 
32  void deleteChildren();
33 
42  virtual void Draw(Option_t* opt) = 0;
43  virtual GuiParent* getParent() const {return NULL;}
44 
45  virtual void DrawGroup(Option_t* opt="");
46  size_t addGuiChild(TGraphInteractive* grPtr);
47  size_t addGuiChild(const TGraph& grRef, Option_t* drawOpt);
48  size_t copyChildren(const GuiParent* that);
49  const TGraphInteractive* findChild(const char* name);
50 
51  private:
52 
53  friend class TGraphInteractive;
54  void removeReference(TGraphInteractive* grChild);
55  std::vector<TGraphInteractive*> fChildren;
56  };
57 
58 
59 
60 
76  class TGraphInteractive : public TGraphAligned, public GuiParent {
77  public:
78  TGraphInteractive() {;}
79  TGraphInteractive(int n, const double* x, const double* y, Option_t* drawOpt = "");
80  TGraphInteractive(const TGraph* gr, Option_t* drawOpt);
81  virtual ~TGraphInteractive();
82 
83  virtual void ExecuteEvent(int event, int px, int py);
84 
85  GuiParent* findOriginator() const;
86  virtual void DrawGroup(Option_t* opt = "");
87 
88 
94  virtual void Draw(Option_t* opt = ""){
95  TGraphAligned::Draw(opt);
96  }
97 
104  void SetDrawOpt(Option_t* drawOpt){
105  fDrawOpt = drawOpt;
106  }
107 
113  Option_t* GetDrawOpt(){
114  return fDrawOpt;
115  }
116 
117  public:
118  friend class GuiParent;
119  virtual GuiParent* getParent() const {return fParent;}
120  private:
121  GuiParent* fParent;
122  TString fDrawOpt;
123 
124  };
125 
126 }
127 #endif
virtual void Draw(Option_t *opt="")
GuiParent * findOriginator() const
Inherit from this to draw interactive TGraphs on top of you.
Namespace which wraps everything in the library.
const TGraphInteractive * findChild(const char *name)
A minimalistic extension to TGraphAligned for some GUI bells and whistles.
virtual void DrawGroup(Option_t *opt="")
Must be overloaded by children (TGraphInteractive*) to return pointer to parent
void SetDrawOpt(Option_t *drawOpt)
virtual void Draw(Option_t *opt)=0
virtual void DrawGroup(Option_t *opt="")
Must be overloaded by children (TGraphInteractive*) to return pointer to parent