ROOTANA
TMainDisplayWindow.hxx
Go to the documentation of this file.
1 #ifndef _WaveformDisplayWindowRUNWINDOW_H_
2 #define _WaveformDisplayWindowRUNWINDOW_H_
3 
4 #include <TGClient.h>
5 #include <TCanvas.h>
6 #include <TGButton.h>
7 #include <TGFrame.h>
8 #include <TRootEmbeddedCanvas.h>
9 #include <TGObject.h>
10 #include <TGTab.h>
11 #include <TGNumberEntry.h>
12 #include <TGLabel.h>
13 #include <TBrowser.h>
14 #include <TFile.h>
15 #include <TApplication.h>
16 //#include <TGTextButton.h>
17 
18 
20 
21  private:
22 
23 
25  TGTab *fTab;
26 
27  // We have option to have a whole vector of subtabs; this is list of sub-tabs that hang off the main tab...
28  TGFrame *fFrame;
29  TGHorizontalFrame *fHframe;
30 
31  /// Variables to keep track of state of display
32  /// Are we processing offline?
33  bool fIsOffline;
34  /// Is processing paused? (online)
36 
37  /// Is processing free-running? (offline)
39 
40  /// Buttons to make plots of current pad/canvas
44 
45  // Button to go to next event
47 
48  // Button to go to next interesting event
50 
51  // Button to reset histograms.
53 
54  // Button to quit
56 
57  // Button to pause updating (online)
59 
60  // Button to start free running (offline)
62 
63  // Button to set how many events to skip before plotting
64  TGNumberEntry *fNumberSkipEventButton;
65 
66  // save tbrowser to be able to delete.
67  TBrowser* fTBrowser;
68 
69  // Add a couple methods for dealing with sub-tabs
70 
71  // Helper: get TGTab for a particular tab index.
72  TGTab* GetTab(std::pair<int,int> tabindex);
73 
74  // Helper: get the current tab for particular tab group
75  // If index is unset, get name for the current tab.
76  std::string GetTabName(TGTab *tab, int index = -1);
77 
78  // Returns the number of sub-tabs for the given tab index.
79  // If there are no sub-tabs (ie, this tab actually has a
80  // display), then returns 0.
81  int GetNumberSubTabs(int i);
82 
83  // Helper : get a particular embedded canvas, based on name.
84  TRootEmbeddedCanvas* GetEmbeddedCanvas(const char *name);
85 
88 
89  public:
90 
92 
94 
96 
98 
99  TGNumberEntry* GetSkipEventButton(){ return fNumberSkipEventButton;}
100 
101  TMainDisplayWindow(const TGWindow *p,UInt_t w,UInt_t h, bool isOffline, bool updatingBasedSeconds);
102  virtual ~TMainDisplayWindow();
103 
104 
105  /// Method to call when 'save pad' button is pressed.
106  void SavePadButtonAction();
107 
108  /// Method to call when 'save canvas' button is pressed.
109  void SaveCanvasButtonAction();
110 
111  // Method to call when 'open tbrowser' button is pressed.
113 
114  /// Method to call when 'pause/resume' button is pressed.
116 
117  /// Method to call when 'free-running/resume' button is pressed.
119 
120  // Is the display paused?
122  return fProcessingPaused;
123  }
124 
125  // Is the display free running
127  return fProcessingFreeRunning;
128  }
129 
130  std::pair<int,int> AddSingleTab(std::string name, TGTab * tab= 0, int mainTabIndex = -1);
131 
132  std::pair<int,int> AddCanvas(std::string subtabname, std::string tabname=std::string(""));
133 
134  /// This method should be called just once, after you have added all
135  /// the canvases and tabs that you want.
136  void BuildWindow();
137 
138  void ResetSize();
139 
140  // Need this function to be able to delete TBrowser if we created one, before shutting down.
141  void CleanTBrowser(){ if(fTBrowser) delete fTBrowser;};
142 
143  /// Get a particular canvas based on canvas name.
144  TCanvas* GetCanvas(const char *name);
145 
146 
147  /// Return the current embedded canvas.
148  TRootEmbeddedCanvas* GetCurrentEmbeddedCanvas();
149 
150  // REturn the current composite frame.
151  TGCompositeFrame* GetCurrentCompositeFrame();
152 
153  // Return the composite frame for a particular tab index.
154  TGCompositeFrame* GetCompositeFrame(std::pair<int,int> index);
155 
156  /// Return an pair<int> index for current tab/sub-tab;
157  std::pair<int,int> GetCurrentTabIndex();
158 
159  /// Return the canvas name for the current tab.
160  std::string GetCurrentTabName();
161 
162  // Return the sub-tab-group for a particular tab.
163  // Returns 0 if that tab doesn't have a sub-tab group.
164  TGTab* GetSubTab(int index);
165 
166  // Get the main window.
167  TGMainFrame* GetMain(){return fMain;};
168  TGTab* GetTab(){return fTab;};
169 
170 
171 #ifndef NO_CINT
172  ClassDef(TMainDisplayWindow,1)
173 #endif
174 };
175 
176 
177 #endif
TGTextButton * fNextButton
std::pair< int, int > AddSingleTab(std::string name, TGTab *tab=0, int mainTabIndex=-1)
bool fProcessingFreeRunning
Is processing free-running? (offline)
std::string GetTabName(TGTab *tab, int index=-1)
TGTextButton * fNextInterestingButton
void SavePadButtonAction()
Method to call when 'save pad' button is pressed.
std::pair< int, int > GetCurrentTabIndex()
Return an pair<int> index for current tab/sub-tab;.
TGTextButton * fPauseButton
TMainDisplayWindow(const TGWindow *p, UInt_t w, UInt_t h, bool isOffline, bool updatingBasedSeconds)
TGTextButton * fOpenNewTBrowser
std::pair< int, int > AddCanvas(std::string subtabname, std::string tabname=std::string(""))
TCanvas * GetCanvas(const char *name)
Get a particular canvas based on canvas name.
void SaveCanvasButtonAction()
Method to call when 'save canvas' button is pressed.
std::string GetCurrentTabName()
Return the canvas name for the current tab.
bool fProcessingPaused
Is processing paused? (online)
TGTab * GetSubTab(int index)
TGTextButton * GetQuitButton()
TRootEmbeddedCanvas * GetEmbeddedCanvas(const char *name)
TGTextButton * GetResetButton()
TGTextButton * GetNextButton()
TGTextButton * GetNextInterestingButton()
TRootEmbeddedCanvas * GetCurrentEmbeddedCanvas()
Return the current embedded canvas.
void FreeRunningButtonAction()
Method to call when 'free-running/resume' button is pressed.
TGTextButton * fSavePadButton
Buttons to make plots of current pad/canvas.
TGCompositeFrame * GetCompositeFrame(std::pair< int, int > index)
TGHorizontalFrame * fHframe
TGTextButton * fFreeRunningButton
TGTextButton * fResetButton
TGNumberEntry * fNumberSkipEventButton
TGCompositeFrame * GetCurrentCompositeFrame()
TGNumberEntry * GetSkipEventButton()
void PauseResumeButtonAction()
Method to call when 'pause/resume' button is pressed.
TGTextButton * fSaveCanvasButton
TGTextButton * fQuitButton