TMainDisplayWindow.hxx

Go to the documentation of this file.
00001 #ifndef _WaveformDisplayWindowRUNWINDOW_H_
00002 #define _WaveformDisplayWindowRUNWINDOW_H_
00003 
00004 #include <TGClient.h>
00005 #include <TCanvas.h>
00006 #include <TGButton.h>
00007 #include <TGFrame.h>
00008 #include <TRootEmbeddedCanvas.h>
00009 #include <TGObject.h>
00010 #include <TGTab.h>
00011 #include <TGNumberEntry.h>
00012 #include <TGLabel.h>
00013 #include <TFile.h>
00014 #include <TApplication.h>
00015 //#include <TGTextButton.h>
00016 
00017 
00018 class TMainDisplayWindow {
00019  
00020   private:
00021 
00022   
00023   TGMainFrame *fMain;
00024   TGTab *fTab;
00025   
00026   // We have option to have a whole vector of subtabs; this is list of sub-tabs that hang off the main tab...
00027   TGFrame *fFrame;
00028   TGHorizontalFrame *fHframe;
00029 
00030   /// Variables to keep track of state of display
00031   /// Are we processing offline?
00032   bool fIsOffline;
00033   /// Is processing paused?
00034   bool fProcessingPaused;
00035 
00036   /// Buttons to make plots of current pad/canvas
00037   TGTextButton  *fSavePadButton;
00038   TGTextButton  *fSaveCanvasButton;
00039 
00040   // Button to reset histograms.
00041   TGTextButton  *fNextButton;
00042 
00043   // Button to reset histograms.
00044   TGTextButton  *fResetButton;
00045 
00046   // Button to quit
00047   TGTextButton  *fQuitButton;
00048   
00049   // Button to pause updating (online)
00050   TGTextButton *fPauseButton;
00051 
00052   // Button to set how many events to skip before plotting
00053   TGNumberEntry *fNumberSkipEventButton;
00054 
00055 
00056   // Add a couple methods for dealing with sub-tabs
00057 
00058   // Helper: get TGTab for a particular tab index.
00059   TGTab* GetTab(std::pair<int,int> tabindex);
00060 
00061   // Helper: get the current tab for particular tab group
00062   // If index is unset, get name for the current tab.
00063   std::string GetTabName(TGTab *tab, int index = -1);
00064 
00065   // Returns the number of sub-tabs for the given tab index.
00066   // If there are no sub-tabs (ie, this tab actually has a 
00067   // display), then returns 0.
00068   int GetNumberSubTabs(int i);
00069 
00070   // Helper : get a particular embedded canvas, based on name.
00071   TRootEmbeddedCanvas* GetEmbeddedCanvas(const char *name);
00072 
00073  public:
00074 
00075   TGTextButton* GetResetButton(){ return fResetButton;}
00076   
00077   TGTextButton* GetNextButton(){ return fNextButton;}
00078   
00079   TGTextButton* GetQuitButton(){ return fQuitButton;}
00080 
00081   TGNumberEntry* GetSkipEventButton(){ return fNumberSkipEventButton;}
00082 
00083   TMainDisplayWindow(const TGWindow *p,UInt_t w,UInt_t h, bool isOffline);
00084   virtual ~TMainDisplayWindow();
00085 
00086   
00087   /// Method to call when 'save pad' button is pressed.
00088   void SavePadButtonAction();
00089 
00090   /// Method to call when 'save canvas' button is pressed.
00091   void SaveCanvasButtonAction();
00092 
00093   /// Method to call when 'pause/resume' button is pressed.
00094   void PauseResumeButtonAction();
00095 
00096   // Is the display paused?
00097   bool IsDisplayPaused(){
00098     return fProcessingPaused;
00099   }
00100 
00101   std::pair<int,int> AddSingleTab(std::string name, TGTab * tab= 0, int mainTabIndex = -1);
00102   
00103   std::pair<int,int> AddCanvas(std::string subtabname, std::string tabname=std::string(""));
00104   
00105   /// This method should be called just once, after you have added all 
00106   /// the canvases and tabs that you want.
00107   void BuildWindow();
00108 
00109   void ResetSize();
00110   
00111 
00112   /// Get a particular canvas based on canvas name.
00113   TCanvas* GetCanvas(const char *name);
00114   
00115  
00116   /// Return the current embedded canvas.
00117   TRootEmbeddedCanvas* GetCurrentEmbeddedCanvas();
00118 
00119   // REturn the current composite frame.
00120   TGCompositeFrame* GetCurrentCompositeFrame();
00121 
00122   // Return the composite frame for a particular tab index.
00123   TGCompositeFrame* GetCompositeFrame(std::pair<int,int> index);
00124 
00125   /// Return an pair<int> index for current tab/sub-tab;
00126   std::pair<int,int> GetCurrentTabIndex();
00127 
00128   /// Return the canvas name for the current tab.
00129   std::string GetCurrentTabName();
00130 
00131   // Return the sub-tab-group for a particular tab.
00132   // Returns 0 if that tab doesn't have a sub-tab group.
00133   TGTab* GetSubTab(int index);
00134 
00135   // Get the main window.
00136   TGMainFrame* GetMain(){return fMain;};
00137   TGTab* GetTab(){return fTab;};
00138 
00139 
00140 
00141   ClassDef(TMainDisplayWindow,1)
00142 };
00143 
00144 
00145 #endif

Generated on 12 Feb 2016 for ROOT Analyzer by  doxygen 1.6.1