Ignore:
Timestamp:
09/25/01 16:14:39 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mmain
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mmain/MMars.cc

    r928 r946  
    4444
    4545enum {
    46   M_FILE_EXIT  ,
    47   M_FILE_ABOUT  ,
    48 
    49   M_PICTURE_MAGIC ,
    50   M_PICTURE_MARS ,
    51 
    52   M_BUTTON_EVTDISP ,
    53   M_BUTTON_DATACHECK ,
    54   M_BUTTON_ANALYSE ,
    55   M_BUTTON_MONTECARLO 
     46  M_FILE_EXIT,
     47  M_FILE_ABOUT,
     48
     49  M_PICTURE_MAGIC,
     50  M_PICTURE_MARS,
     51
     52  M_BUTTON_EVTDISP,
     53  M_BUTTON_DATACHECK,
     54  M_BUTTON_ANALYSE,
     55  M_BUTTON_MONTECARLO
    5656} ;
    5757
     58void MMars::CreateMenuBar()
     59{
     60    TGLayoutHints *laymenubar  = new TGLayoutHints(kLHintsTop|kLHintsLeft|kLHintsExpandX, 2, 2, 2, 2);
     61    TGLayoutHints *laymenuitem = new TGLayoutHints(kLHintsTop|kLHintsLeft, 0, 4, 0, 0);
     62    TGLayoutHints *laylinesep  = new TGLayoutHints(kLHintsTop|kLHintsExpandX);
     63
     64    fList->Add(laymenubar);
     65    fList->Add(laymenuitem);
     66    fList->Add(laylinesep);
     67
     68    TGPopupMenu *filemenu = new TGPopupMenu(gClient->GetRoot());
     69    filemenu->AddEntry("Exit", M_FILE_EXIT);
     70    //fFileMenu->Associate(this);
     71
     72    TGMenuBar *menubar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
     73    menubar->AddPopup("File", filemenu, laymenuitem);
     74    AddFrame(menubar, laymenubar);
     75
     76    TGHorizontal3DLine *linesep = new TGHorizontal3DLine(this);
     77    AddFrame(linesep, laylinesep);
     78
     79    fList->Add(filemenu);
     80    fList->Add(menubar);
     81    fList->Add(linesep);
     82}
     83
     84void MMars::CreateTopFrame(TGHorizontalFrame *top)
     85{
     86    fPic1 = gClient->GetPicture("magiclogo.xpm");
     87    fPic2 = gClient->GetPicture("marslogo.xpm");
     88
     89    TGPictureButton *magic = new TGPictureButton(top, fPic1, M_PICTURE_MAGIC);
     90    TGPictureButton *mars  = new TGPictureButton(top, fPic2, M_PICTURE_MARS);
     91
     92    fList->Add(magic);
     93    fList->Add(mars);
     94
     95    magic->Associate(this);
     96    mars->Associate(this);
     97
     98    TGLayoutHints *lay1 = new TGLayoutHints(kLHintsLeft, 10., 10., 20., 10.);
     99    TGLayoutHints *lay2 = new TGLayoutHints(kLHintsLeft, 10., 10., 10., 10.);
     100
     101    fList->Add(lay1);
     102    fList->Add(lay2);
     103
     104    top->AddFrame(magic, lay1);
     105    top->AddFrame(mars,  lay1);
     106}
     107
     108void MMars::CreateBottomFrame(TGHorizontalFrame *low)
     109{
     110    //
     111    // Create Tab Container
     112    //
     113    TGLayoutHints *laytabs = new TGLayoutHints(kLHintsBottom|kLHintsExpandX|kLHintsExpandY, 5, 5, 5, 5);
     114    fList->Add(laytabs);
     115
     116    TGTab *tabs = new TGTab(low, 400, 400);
     117    fList->Add(tabs);
     118    low->AddFrame(tabs, laytabs);
     119
     120    //
     121    // Create Tab1
     122    //
     123    TGCompositeFrame *tf = tabs->AddTab("Control");
     124
     125    TGVerticalFrame *tab1 = new TGVerticalFrame(tf, 300, 100);
     126    TGVerticalFrame *tab2 = new TGVerticalFrame(tf, 300, 100);
     127
     128    fList->Add(tab1);
     129    fList->Add(tab2);
     130
     131    TGLayoutHints *laytabx = new TGLayoutHints(kLHintsTop|kLHintsExpandX);
     132    fList->Add(laytabx);
     133
     134    tf->AddFrame(tab1, laytabx);
     135    tf->AddFrame(tab2, laytabx);
     136
     137    TGTextButton *evtdisp    = new TGTextButton(tab2, "EventDisplay", M_BUTTON_EVTDISP);
     138    TGTextButton *datacheck  = new TGTextButton(tab2, "Data Check",   M_BUTTON_DATACHECK);
     139    TGTextButton *analysis   = new TGTextButton(tab2, "Analysis",     M_BUTTON_ANALYSE);
     140    TGTextButton *montecarlo = new TGTextButton(tab2, "MonteCarlo",   M_BUTTON_MONTECARLO);
     141
     142    fList->Add(evtdisp);
     143    fList->Add(datacheck);
     144    fList->Add(analysis);
     145    fList->Add(montecarlo);
     146
     147    evtdisp   ->Associate(this);
     148    datacheck ->Associate(this);
     149    analysis  ->Associate(this);
     150    montecarlo->Associate(this);
     151
     152    TGLayoutHints *laybut = new TGLayoutHints(kLHintsTop|kLHintsCenterX , 10, 10, 10, 10);
     153    fList->Add(laybut);
     154
     155    tab2->AddFrame(evtdisp,    laybut);
     156    tab2->AddFrame(datacheck,  laybut);
     157    tab2->AddFrame(analysis,   laybut);
     158    tab2->AddFrame(montecarlo, laybut);
     159}
    58160
    59161MMars::MMars(/*const TGWindow *p,*/ UInt_t w, UInt_t h)
    60162  : TGMainFrame(gClient->GetRoot(), w, h)
    61 {
    62   //    First create the MenuBar.   
    63  
    64   //     Layout objects for menue.
    65 
    66   fLayMenuBar = new TGLayoutHints ( kLHintsTop | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2 ) ;
    67   fLayMenuItem = new TGLayoutHints ( kLHintsTop | kLHintsLeft , 0, 4, 0, 0 ) ;
    68  
    69   //  crate the menu bar
    70  
    71   fFileMenu = new TGPopupMenu ( fClient->GetRoot() ) ;
    72   fFileMenu->AddEntry ("Exit", M_FILE_EXIT ) ;
    73   fFileMenu->Associate(this) ;
    74  
    75   //  the button messages are handled by main frame (this)
    76  
    77   fMenuBar = new TGMenuBar ( this, 1, 1, kHorizontalFrame ) ;
    78   fMenuBar->AddPopup("File", fFileMenu, fLayMenuItem ) ;   
    79   AddFrame(fMenuBar, fLayMenuBar ) ;
    80 
    81   fLineSep = new TGHorizontal3DLine(this) ;
    82   AddFrame(fLineSep, new TGLayoutHints(kLHintsTop | kLHintsExpandX) );
    83  
    84   //   set up the top part of the main window with the logos
    85 
    86   fTop = new TGHorizontalFrame (this, 300, 100 ) ;
    87 
    88   fPicMagic = new TGPictureButton(fTop,
    89                                   gClient->GetPicture("magiclogo.xpm"), M_PICTURE_MAGIC );
    90   fPicMagic->Associate(this) ;
    91   fTop->AddFrame ( fPicMagic, new TGLayoutHints(kLHintsLeft, 10., 10., 20., 10.) ) ;
    92 
    93   fPicMars = new TGPictureButton(fTop,
    94                                  gClient->GetPicture("marslogo.xpm"), M_PICTURE_MARS );
    95   fPicMars->Associate(this) ;
    96   fTop->AddFrame ( fPicMars, new TGLayoutHints(kLHintsLeft, 10., 10., 10., 10.) ) ;
    97 
    98   AddFrame(fTop, new TGLayoutHints(kLHintsTop | kLHintsExpandX ) ); 
    99  
    100   //  a seperator
    101 
    102   fLineSep2 = new TGHorizontal3DLine(this) ;
    103   AddFrame(fLineSep2, new TGLayoutHints(kLHintsTop | kLHintsExpandX) );
    104 
    105   //   the low part of the frame
    106 
    107   fLow = new TGHorizontalFrame (this, 300, 100 ) ;
    108 
    109   //    create the first tab
    110 
    111   fTab = new TGTab ( fLow, 400, 400 ) ;   
    112 
    113   TGCompositeFrame *tf = fTab->AddTab("Control") ;
    114  
    115   fTabF1 = new TGVerticalFrame (tf, 300, 100) ;
    116 
    117   tf->AddFrame(fTabF1, new TGLayoutHints(kLHintsTop | kLHintsExpandX) ) ;
    118 
    119   //     the buttons to go in the new window
    120 
    121   fTabF2 = new TGVerticalFrame (tf, 300, 100) ;
    122  
    123   fButLayout  = new TGLayoutHints(kLHintsTop | kLHintsCenterX , 10, 10, 10, 10) ;
    124 
    125   fButEvtDisp = new TGTextButton(fTabF2, "EventDisplay", M_BUTTON_EVTDISP  );
    126   fButEvtDisp->Associate(this) ; 
    127   fTabF2->AddFrame(fButEvtDisp, fButLayout ) ;
    128  
    129   fButDataCheck = new TGTextButton(fTabF2, "Data Check", M_BUTTON_DATACHECK  );
    130   fButDataCheck->Associate(this) ;
    131   fTabF2->AddFrame(fButDataCheck, fButLayout ) ;
    132 
    133   fButAnalys = new TGTextButton(fTabF2, "Analysis", M_BUTTON_ANALYSE  );
    134   fButAnalys->Associate(this) ;
    135   fTabF2->AddFrame(fButAnalys, fButLayout ) ;
    136 
    137   fButMonteCarlo = new TGTextButton(fTabF2, "MonteCarlo", M_BUTTON_MONTECARLO  );
    138   fButMonteCarlo->Associate(this) ;
    139   fTabF2->AddFrame(fButMonteCarlo, fButLayout ) ;
    140 
    141 
    142    
    143 
    144   tf->AddFrame(fTabF2, new TGLayoutHints(kLHintsTop | kLHintsExpandX) ) ;
    145  
    146  
    147 
    148   fLow->AddFrame ( fTab, new TGLayoutHints(kLHintsBottom | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5) );   
    149   AddFrame(fLow, new TGLayoutHints(kLHintsTop | kLHintsExpandX ) );
    150  
    151   //   Map the window, set up the layout, etc.
    152  
    153   SetWMSizeHints(400, 650, 1000, 1000, 10, 10 ) ;  // set the smallest and biggest size of the Main frame
    154  
    155   MapSubwindows();
    156  
    157   Layout();
    158  
    159   SetWindowName("MARS Main Window");
    160   SetIconName("MARS");
    161  
    162   MapWindow();
    163 
     163{
     164    //
     165    // Create the deletion list
     166    //
     167    fList = new TList;
     168    fList->SetOwner();
     169
     170    //
     171    // Create the MenuBar
     172    //
     173    CreateMenuBar();
     174
     175    //
     176    // create and layout the frame/contents
     177    //
     178    TGHorizontalFrame *top = new TGHorizontalFrame(this, 300, 100);
     179    TGHorizontalFrame *low = new TGHorizontalFrame(this, 300, 100);
     180
     181    TGHorizontal3DLine *linesep = new TGHorizontal3DLine(this);
     182
     183    fList->Add(top);
     184    fList->Add(low);
     185    fList->Add(linesep);
     186
     187    CreateTopFrame(top);
     188    CreateBottomFrame(low);
     189
     190    AddFrame(top,     new TGLayoutHints(kLHintsTop|kLHintsExpandX));
     191    AddFrame(linesep, new TGLayoutHints(kLHintsTop|kLHintsExpandX));
     192    AddFrame(low,     new TGLayoutHints(kLHintsTop|kLHintsExpandX));
     193
     194    //
     195    //   Map the window, set up the layout, etc.
     196    //
     197    SetWMSizeHints(400, 650, 1000, 1000, 10, 10 ) ;  // set the smallest and biggest size of the Main frame
     198
     199    MapSubwindows();
     200
     201    Layout();
     202
     203    SetWindowName("MARS Main Window");
     204    SetIconName("MARS");
     205
     206    MapWindow();
    164207}
    165208
     
    168211MMars::~MMars()
    169212{
    170  
    171     delete fButLayout;
    172     delete fLayMenuBar;
    173     delete fLayMenuItem;
    174     delete fButEvtDisp;
    175     delete fButDataCheck;
    176     delete fButAnalys;
    177     delete fButMonteCarlo;
    178     delete fPicMagic;
    179     delete fPicMars;
    180     delete fTabF1;
    181     delete fTabF2;
    182     delete fTab;
    183     delete fLow;
    184     delete fTop;
    185     delete fLineSep2;
    186     delete fLineSep;
    187     delete fFileMenu;
    188     delete fMenuBar;
     213    gClient->FreePicture(fPic1);
     214    gClient->FreePicture(fPic2);
     215
     216    delete fList;
    189217
    190218// ======================================================================
     
    198226
    199227   TGMainFrame::CloseWindow();
    200    gROOT->GetApplication()->Terminate(0)  ;
     228   gROOT->GetApplication()->Terminate(0);
    201229}
    202230
     
    253281                return kTRUE;
    254282
    255             CloseWindow() ;
     283            CloseWindow();
    256284            return kTRUE;
    257285        }
  • trunk/MagicSoft/Mars/mmain/MMars.h

    r765 r946  
    1010#endif
    1111
    12 class TGTab;
    13 class TGMenuBar;
    14 class TGPopupMenu;
    15 class TGTextButton;
    16 class TGPictureButton;
    17 class TGHorizontal3DLine;
     12class TList;
    1813
    19 class MMars : public TGMainFrame {
    20  private:
    21  
    22   //
    23   // Create a main frame with a number of different buttons.
    24   //
     14class MMars : public TGMainFrame
     15{
     16private:
    2517
    26   //  the things for the menu bar
    27    
    28   TGMenuBar          *fMenuBar ;
    29   TGPopupMenu        *fFileMenu ;
    30   TGLayoutHints      *fLayMenuBar;
    31   TGLayoutHints      *fLayMenuItem ;
    32   TGHorizontal3DLine *fLineSep ;
     18    TList *fList;
    3319
    34   //   divide the Window in two different parts
    35  
    36   TGHorizontalFrame  *fTop ;   // top part of the main window
    37   TGHorizontal3DLine *fLineSep2 ;
    38   TGHorizontalFrame  *fLow ;   // low part of the main window
    39   TGTab              *fTab ;   // different tabs in the low window
    40  
    41   //   the object in the top part of the frame
    42  
    43   TGPictureButton  *fPicMagic;
    44   TGPictureButton  *fPicMars ;
    45  
    46   //   the object in the low part of the frame
    47  
    48   TGVerticalFrame  *fTabF1;
    49   TGVerticalFrame  *fTabF2 ;
    50  
    51   TGTextButton     *fButEvtDisp;
    52   TGTextButton     *fButDataCheck;
    53   TGTextButton     *fButAnalys;
    54   TGTextButton     *fButMonteCarlo ;
    55   TGLayoutHints    *fButLayout ;
     20    const TGPicture *fPic1;
     21    const TGPicture *fPic2;
    5622
    57   void DisplWarning(const char *txt);
     23    void CreateMenuBar();
     24    void CreateTopFrame(TGHorizontalFrame *top);
     25    void CreateBottomFrame(TGHorizontalFrame *low);
    5826
    59  public:
    60   MMars(UInt_t w=400, UInt_t h=500) ;
    61  
    62   ~MMars();
    63  
    64   void CloseWindow()  ;
     27    void DisplWarning(const char *txt);
    6528
    66   Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
     29public:
     30    MMars(UInt_t w=400, UInt_t h=500);
    6731
    68   ClassDef(MMars, 0) // GUI: Mars - the main window
    69 } ;
     32    ~MMars();
     33
     34    void CloseWindow();
     35
     36    Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
     37
     38    ClassDef(MMars, 0) // GUI: Mars - the main window
     39};
    7040
    7141#endif
Note: See TracChangeset for help on using the changeset viewer.