histaction.h

Go to the documentation of this file.
00001 #ifndef HISTACTION_H
00002 #define HISTACTION_H
00003 
00004 //--------------------------------------------------------------
00005 //
00006 //  An example of a control panel with ROOT GUI classes
00007 //  for different actions with 1d histogrammes
00008 //
00009 //  Author: Dmitry Vasiliev (LNS, Catania)
00010 //
00011 //--------------------------------------------------------------
00012 
00013 #include <TObjArray.h>
00014 #include <TGFrame.h>
00015 #include <TGButton.h>
00016 #include <TGListBox.h>
00017 #include <TGTextEntry.h>
00018 #include <TGTextBuffer.h>
00019 #include <TGLabel.h>
00020 #include <TRootEmbeddedCanvas.h>
00021 #include <TGTab.h>
00022 #include <TGFSContainer.h>
00023 #include <TGComboBox.h>
00024 
00025 enum CommandsId {
00026 
00027   M_CLOSE = 100,
00028 
00029   M_DRAW,
00030   M_SELECT,
00031   M_CLEAR_A,
00032   M_SAVE,
00033   M_EDIT,
00034   M_NEXT_A,
00035   M_PREV_A,
00036 
00037   M_IMPORT,
00038   M_CLEAR_B,
00039   M_NEXT_B,
00040   M_PREV_B,
00041 
00042   M_MULTI,
00043 
00044   M_LIST_A,
00045   M_LIST_B,
00046 
00047   M_CDUP,
00048   M_LIST_MODE,
00049   M_DETAIL_MODE,
00050 
00051   M_FILTER
00052 };
00053 
00054 
00055 class TPad;
00056 
00057 class HistAction : public TGMainFrame {
00058 
00059 private:
00060    enum { kMaxHist = 1000 };
00061    TGCompositeFrame     *fF0, *fFA, *fFB;
00062    TRootEmbeddedCanvas  *fCanvasA, *fCanvasB;
00063    TGListBox            *fListBoxA, *fListBoxB;
00064    TGCompositeFrame     *fA1, *fA2, *fA3, *fA4, *fA5;
00065    TGCompositeFrame     *fB1, *fB2, *fB3, *fB4, *fB5;
00066    TGButton             *fCloseButton;
00067    TGButton             *fSaveButton, *fEditButton;
00068    TGButton             *fDrawButton, *fSelectButton, *fClearButtonA;
00069    TGButton             *fPrevButtonA, *fNextButtonA;
00070    TGButton             *fGetButton,*fClearButtonB,*fPrevButtonB,*fNextButtonB;
00071    TGButton             *fLayoutButton[16];
00072    TGCheckButton        *fMultiButton;
00073    TGTextEntry          *fName, *fTitle, *fChan, *fRange, *fEntries;
00074    TGTextBuffer         *fNameBuf, *fTitleBuf,*fChanBuf,*fRangeBuf,*fEntriesBuf;
00075    TGTextEntry          *fBinCont, *fBinRange;
00076    TGTextBuffer         *fBinContBuf, *fBinRangeBuf;
00077    TGTab                *fTab;
00078    TGCompositeFrame     *fC1, *fC2;
00079    const TGPicture      *fPcdup;
00080    const TGPicture      *fPlist;
00081    const TGPicture      *fPdetail;
00082    TGPictureButton      *fCdup, *fListMode, *fDetailMode;
00083    TGListBox            *fDir;
00084    TGListView           *fFileView;
00085    TGFileContainer      *fFileCont;
00086    TGComboBox           *fFilterBox;
00087 
00088    TObjArray            *fHisto; //histo container
00089    Int_t                 position; //current position in array "fHisto"
00090    Bool_t                flags[kMaxHist]; //true for highlighted histos (ListBoxA)
00091    TPad                 *pads[16];//addresses of pads in 4x4 matrix
00092                                  //(display layout for CanvasA)
00093    Int_t                 histInd[16];//indices of histos drawn in CanvasA
00094    Int_t                 horLay[4];//horizontal display layout
00095    Int_t                 verLay[4];//vertical display layout
00096    Int_t                 cursorIter;//current true position in array "flags"
00097    Int_t                 xDiv, yDiv;//parameters for CanvasA division in case
00098                                    //of automatic display layout
00099 
00100    Bool_t toGreen(Window_t id);
00101    Bool_t toDefault(Window_t id);
00102    Bool_t isOverlap();
00103    Bool_t isLayout();
00104 
00105    void toScan();
00106 
00107 public:
00108    HistAction(const TGWindow *p, UInt_t w, UInt_t h);
00109    virtual ~HistAction();
00110    virtual void CloseWindow();
00111    virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
00112    Int_t getNextTrueIndex(); //returns -1 in case of no index found
00113    void resetIter() {cursorIter = -1;}
00114    void resetFlags() { for (int i = 0; i < kMaxHist; i++) flags[i] = kFALSE; }
00115    void setCanvasDivision(Int_t number);
00116    void drawHist();//draws a histo in case of automatic display layout
00117    void processBoxB(Int_t par);
00118    void doubleclickedBoxA(const char *text);
00119    Bool_t importHist(const char *name);
00120    Bool_t importFromFile(const char *filename);
00121    void clearScan();
00122    void paintHist();//draws a histo in case of user defined display layout
00123 
00124    ClassDef(HistAction,0)
00125 };
00126 
00127 #endif

Generated on Tue Jul 5 15:15:03 2011 for ROOT_528-00b_version by  doxygen 1.5.1