guitest.h

Go to the documentation of this file.
00001 #ifndef GUITEST_H
00002 #define GUITEST_H
00003 
00004 #include <stdlib.h>
00005 
00006 #include <TROOT.h>
00007 #include <TApplication.h>
00008 #include <TVirtualX.h>
00009 
00010 #include <TGListBox.h>
00011 #include <TGClient.h>
00012 #include <TGFrame.h>
00013 #include <TGIcon.h>
00014 #include <TGLabel.h>
00015 #include <TGButton.h>
00016 #include <TGTextEntry.h>
00017 #include <TGMsgBox.h>
00018 #include <TGMenu.h>
00019 #include <TGCanvas.h>
00020 #include <TGComboBox.h>
00021 #include <TGTab.h>
00022 #include <TGSlider.h>
00023 #include <TGDoubleSlider.h>
00024 #include <TGFileDialog.h>
00025 #include <TGTextEdit.h>
00026 #include <TGShutter.h>
00027 #include <TGProgressBar.h>
00028 #include <TRootEmbeddedCanvas.h>
00029 #include <TCanvas.h>
00030 #include <TH1.h>
00031 #include <TH2.h>
00032 #include <TRandom.h>
00033 #include <TSystem.h>
00034 #include <TEnv.h>
00035 
00036 
00037 enum ETestCommandIdentifiers {
00038    M_FILE_OPEN,
00039    M_FILE_SAVE,
00040    M_FILE_SAVEAS,
00041    M_FILE_EXIT,
00042 
00043    M_TEST_DLG,
00044    M_TEST_MSGBOX,
00045    M_TEST_SLIDER,
00046    M_TEST_SHUTTER,
00047    M_TEST_PROGRESS,
00048 
00049    M_HELP_CONTENTS,
00050    M_HELP_SEARCH,
00051    M_HELP_ABOUT,
00052 
00053    M_CASCADE_1,
00054    M_CASCADE_2,
00055    M_CASCADE_3,
00056 
00057    VId1,
00058    HId1,
00059    VId2,
00060    HId2,
00061 
00062    VSId1,
00063    HSId1,
00064    VSId2,
00065    HSId2
00066 };
00067 
00068 
00069 struct shutterData_t {
00070    const char *pixmap_name;
00071    const char *tip_text;
00072    Int_t       id;
00073    TGButton   *button;
00074 };
00075 
00076 
00077 
00078 
00079 
00080 
00081 class TileFrame : public TGCompositeFrame {
00082 
00083 private:
00084    TGCanvas *fCanvas;
00085 
00086 public:
00087    TileFrame(const TGWindow *p);
00088    virtual ~TileFrame() { }
00089 
00090    void SetCanvas(TGCanvas *canvas) { fCanvas = canvas; }
00091    Bool_t HandleButton(Event_t *event);
00092 };
00093 
00094 
00095 
00096 class TestMainFrame : public TGMainFrame {
00097 
00098 private:
00099    TGCompositeFrame   *fStatusFrame;
00100    TGCanvas           *fCanvasWindow;
00101    TileFrame          *fContainer;
00102    TGTextEntry        *fTestText;
00103    TGButton           *fTestButton;
00104 
00105    TGMenuBar          *fMenuBar;
00106    TGPopupMenu        *fMenuFile, *fMenuTest, *fMenuHelp;
00107    TGPopupMenu        *fCascadeMenu, *fCascade1Menu, *fCascade2Menu;
00108    TGLayoutHints      *fMenuBarLayout, *fMenuBarItemLayout, *fMenuBarHelpLayout;
00109 
00110 public:
00111    TestMainFrame(const TGWindow *p, UInt_t w, UInt_t h);
00112    virtual ~TestMainFrame();
00113 
00114    virtual void CloseWindow();
00115    virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t);
00116 };
00117 
00118 
00119 class TestDialog : public TGTransientFrame {
00120 
00121 private:
00122    TGCompositeFrame    *fFrame1, *fF1, *fF2, *fF3, *fF4, *fF5, *fF6, *fF7;
00123    TGButton            *fOkButton, *fCancelButton, *fStartB, *fStopB;
00124    TGButton            *fBtn1, *fBtn2, *fChk1, *fChk2, *fRad1, *fRad2;
00125    TGPictureButton     *fPicBut1;
00126    TGRadioButton       *fRadio1, *fRadio2;
00127    TGCheckButton       *fCheck1;
00128    TGCheckButton       *fCheckMulti;
00129    TGListBox           *fListBox;
00130    TGComboBox          *fCombo;
00131    TGTab               *fTab;
00132    TGTextEntry         *fTxt1, *fTxt2;
00133    TGLayoutHints       *fL1, *fL2, *fL3, *fL4;
00134    TRootEmbeddedCanvas *fEc1, *fEc2;
00135    Int_t                fFirstEntry;
00136    Int_t                fLastEntry;
00137    Bool_t               fFillHistos;
00138    TH1F                *fHpx;
00139    TH2F                *fHpxpy;
00140    TList               *fCleanup;
00141 
00142    void FillHistos();
00143 
00144 public:
00145    TestDialog(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h,
00146                UInt_t options = kVerticalFrame);
00147    virtual ~TestDialog();
00148 
00149    virtual void CloseWindow();
00150    virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
00151 };
00152 
00153 
00154 class TestMsgBox : public TGTransientFrame {
00155 
00156 private:
00157    TGCompositeFrame     *f1, *f2, *f3, *f4, *f5;
00158    TGButton             *fTestButton, *fCloseButton;
00159    TGPictureButton      *fPictButton;
00160    TGRadioButton        *fR[4];
00161    TGCheckButton        *fC[9];
00162    TGGroupFrame         *fG1, *fG2;
00163    TGLayoutHints        *fL1, *fL2, *fL3, *fL4, *fL5, *fL6, *fL21;
00164    TGTextEntry          *fTitle, *fMsg;
00165    TGTextBuffer         *fTbtitle, *fTbmsg;
00166    TGLabel              *fLtitle, *fLmsg;
00167    TGGC                  fRedTextGC;
00168 
00169 public:
00170    TestMsgBox(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h,
00171               UInt_t options = kVerticalFrame);
00172    virtual ~TestMsgBox();
00173 
00174    virtual void CloseWindow();
00175    virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
00176 };
00177 
00178 
00179 class TestSliders : public TGTransientFrame {
00180 
00181 private:
00182    TGVerticalFrame   *fVframe1, *fVframe2;
00183    TGLayoutHints     *fBly, *fBfly1;
00184    TGHSlider         *fHslider1, *fHslider2;
00185    TGVSlider         *fVslider1;
00186    TGDoubleVSlider   *fVslider2;
00187    TGTextEntry       *fTeh1, *fTev1, *fTeh2, *fTev2;
00188    TGTextBuffer      *fTbh1, *fTbv1, *fTbh2, *fTbv2;
00189 
00190 public:
00191    TestSliders(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h);
00192    virtual ~TestSliders();
00193 
00194    virtual void CloseWindow();
00195    virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
00196 };
00197 
00198 
00199 class TestShutter : public TGTransientFrame {
00200 
00201 private:
00202    TGShutter       *fShutter;
00203    TGLayoutHints   *fLayout;
00204    const TGPicture *fDefaultPic;
00205    TList           *fTrash;
00206 
00207 public:
00208    TestShutter(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h);
00209    ~TestShutter();
00210 
00211    void AddShutterItem(const char *name, shutterData_t data[]);
00212    virtual void CloseWindow();
00213    virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
00214 };
00215 
00216 
00217 class TestProgress : public TGTransientFrame {
00218 
00219 private:
00220    TGHorizontalFrame *fHframe1;
00221    TGVerticalFrame   *fVframe1;
00222    TGLayoutHints     *fHint1, *fHint2, *fHint3, *fHint4, *fHint5;
00223    TGHProgressBar    *fHProg1, *fHProg2, *fHProg3;
00224    TGVProgressBar    *fVProg1, *fVProg2;
00225    TGTextButton      *fGO;
00226 
00227 public:
00228    TestProgress(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h);
00229    virtual ~TestProgress();
00230 
00231    virtual void CloseWindow();
00232    virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
00233 };
00234 
00235 
00236 class Editor : public TGTransientFrame {
00237 
00238 private:
00239    TGTextEdit       *fEdit;   // text edit widget
00240    TGTextButton     *fOK;     // OK button
00241    TGLayoutHints    *fL1;     // layout of TGTextEdit
00242    TGLayoutHints    *fL2;     // layout of OK button
00243 
00244 public:
00245    Editor(const TGWindow *main, UInt_t w, UInt_t h);
00246    virtual ~Editor();
00247 
00248    void   LoadBuffer(const char *buffer);
00249    void   LoadFile(const char *file);
00250 
00251    TGTextEdit *GetEditor() const { return fEdit; }
00252 
00253    void   SetTitle();
00254    void   Popup();
00255    void   CloseWindow();
00256    Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
00257 };
00258 
00259 
00260 #endif

Generated on Tue Jul 5 14:22:21 2011 for ROOT_528-00b_version by  doxygen 1.5.1