source: trunk/MagicSoft/Mars/mgui/MGMarsMain.cc@ 571

Last change on this file since 571 was 571, checked in by harald, 24 years ago
Added the Main gui for MonteCarlo. Now there is also a gui called MGPrototyp. This can be used as the start point for the next guis.
  • Property svn:executable set to *
File size: 6.4 KB
Line 
1#include "MGMarsMain.h"
2
3#include <TApplication.h> // gROOT->GetApplication()->...
4
5#include <TGTab.h> // TGTab
6#include <TGMenu.h> // TGPopupMenu
7#include <TGMsgBox.h> // TGMsgBox
8#include <TGButton.h> // TGPictureButton
9#include <TGSplitter.h> // TGHorizontal3DLine
10
11#include "MGDataCheckMain.h"
12#include "MGMonteCarloMain.h"
13
14#include "MGPrototyp.h"
15
16ClassImp(MGMarsMain)
17
18enum CommandIdentifiers {
19 M_FILE_EXIT ,
20 M_FILE_ABOUT ,
21
22 M_PICTURE_MAGIC ,
23 M_PICTURE_MARS ,
24
25 M_BUTTON_EVTDISP ,
26 M_BUTTON_DATACHECK ,
27 M_BUTTON_ANALYSE ,
28 M_BUTTON_MONTECARLO
29} ;
30
31
32MGMarsMain::MGMarsMain(const TGWindow *p, UInt_t w, UInt_t h)
33 : TGMainFrame(p, w, h)
34{
35 // First create the MenuBar.
36
37 // Layout objects for menue.
38
39 fLayMenuBar = new TGLayoutHints ( kLHintsTop | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2 ) ;
40 fLayMenuItem = new TGLayoutHints ( kLHintsTop | kLHintsLeft , 0, 4, 0, 0 ) ;
41
42 // crate the menu bar
43
44 fFileMenu = new TGPopupMenu ( fClient->GetRoot() ) ;
45 fFileMenu->AddEntry ("Exit", M_FILE_EXIT ) ;
46 fFileMenu->Associate(this) ;
47
48 // the button messages are handled by main frame (this)
49
50 fMenuBar = new TGMenuBar ( this, 1, 1, kHorizontalFrame ) ;
51 fMenuBar->AddPopup("File", fFileMenu, fLayMenuItem ) ;
52 AddFrame(fMenuBar, fLayMenuBar ) ;
53
54 fLineSep = new TGHorizontal3DLine(this) ;
55 AddFrame(fLineSep, new TGLayoutHints(kLHintsTop | kLHintsExpandX) );
56
57 // set up the top part of the main window with the logos
58
59 fTop = new TGHorizontalFrame (this, 300, 100 ) ;
60
61 fPicMagic = new TGPictureButton(fTop,
62 gClient->GetPicture("magiclogo.xpm"), M_PICTURE_MAGIC );
63 fPicMagic->Associate(this) ;
64 fTop->AddFrame ( fPicMagic, new TGLayoutHints(kLHintsLeft, 10., 10., 20., 10.) ) ;
65
66 fPicMars = new TGPictureButton(fTop,
67 gClient->GetPicture("marslogo.xpm"), M_PICTURE_MARS );
68 fPicMars->Associate(this) ;
69 fTop->AddFrame ( fPicMars, new TGLayoutHints(kLHintsLeft, 10., 10., 10., 10.) ) ;
70
71 AddFrame(fTop, new TGLayoutHints(kLHintsTop | kLHintsExpandX ) );
72
73 // a seperator
74
75 fLineSep2 = new TGHorizontal3DLine(this) ;
76 AddFrame(fLineSep2, new TGLayoutHints(kLHintsTop | kLHintsExpandX) );
77
78 // the low part of the frame
79
80 fLow = new TGHorizontalFrame (this, 300, 100 ) ;
81
82 // create the first tab
83
84 fTab = new TGTab ( fLow, 400, 400 ) ;
85
86 TGCompositeFrame *tf = fTab->AddTab("Control") ;
87
88 fTabF1 = new TGVerticalFrame (tf, 300, 100) ;
89
90 tf->AddFrame(fTabF1, new TGLayoutHints(kLHintsTop | kLHintsExpandX) ) ;
91
92 // the buttons to go in the new window
93
94 fTabF2 = new TGVerticalFrame (tf, 300, 100) ;
95
96 fButLayout = new TGLayoutHints(kLHintsTop | kLHintsCenterX , 10, 10, 10, 10) ;
97
98 fButEvtDisp = new TGTextButton(fTabF2, "EventDisplay", M_BUTTON_EVTDISP );
99 fButEvtDisp->Associate(this) ;
100 fTabF2->AddFrame(fButEvtDisp, fButLayout ) ;
101
102 fButDataCheck = new TGTextButton(fTabF2, "Data Check", M_BUTTON_DATACHECK );
103 fButDataCheck->Associate(this) ;
104 fTabF2->AddFrame(fButDataCheck, fButLayout ) ;
105
106 fButAnalys = new TGTextButton(fTabF2, "Analysis", M_BUTTON_ANALYSE );
107 fButAnalys->Associate(this) ;
108 fTabF2->AddFrame(fButAnalys, fButLayout ) ;
109
110 fButMonteCarlo = new TGTextButton(fTabF2, "MonteCarlo", M_BUTTON_MONTECARLO );
111 fButMonteCarlo->Associate(this) ;
112 fTabF2->AddFrame(fButMonteCarlo, fButLayout ) ;
113
114
115
116
117 tf->AddFrame(fTabF2, new TGLayoutHints(kLHintsTop | kLHintsExpandX) ) ;
118
119
120
121 fLow->AddFrame ( fTab, new TGLayoutHints(kLHintsBottom | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5) );
122 AddFrame(fLow, new TGLayoutHints(kLHintsTop | kLHintsExpandX ) );
123
124 // Map the window, set up the layout, etc.
125
126 SetWMSizeHints(400, 650, 1000, 1000, 10, 10 ) ; // set the smallest and biggest size of the Main frame
127
128 MapSubwindows();
129
130 Layout();
131
132 SetWindowName("MARS Main Window");
133 SetIconName("MARS");
134
135 MapWindow();
136
137}
138
139// ======================================================================
140
141MGMarsMain::~MGMarsMain()
142{
143
144 delete fButLayout;
145 delete fLayMenuBar;
146 delete fLayMenuItem;
147 delete fButEvtDisp;
148 delete fButDataCheck;
149 delete fButAnalys;
150 delete fButMonteCarlo;
151 delete fPicMagic;
152 delete fPicMars;
153 delete fTabF1;
154 delete fTabF2;
155 delete fTab;
156 delete fLow;
157 delete fTop;
158 delete fLineSep2;
159 delete fLineSep;
160 delete fFileMenu;
161 delete fMenuBar;
162}
163// ======================================================================
164
165void MGMarsMain::CloseWindow()
166{
167 // Got close message for this MainFrame. Calls parent CloseWindow()
168 // (which destroys the window) and terminate the application.
169 // The close message is generated by the window manager when its close
170 // window menu item is selected.
171
172 TGMainFrame::CloseWindow();
173 gROOT->GetApplication()->Terminate(0) ;
174}
175
176Bool_t MGMarsMain::ProcessMessage(Long_t msg, Long_t parm1, Long_t)
177{
178 // Process events generated by the buttons in the frame.
179 // printf (" process Message \n" ) ;
180
181 Int_t buttons = 4, retval = 0 ;
182
183
184 switch (GET_MSG(msg))
185 {
186 case kC_COMMAND:
187 switch (GET_SUBMSG(msg))
188 {
189 case kCM_BUTTON:
190
191 switch (parm1)
192 {
193
194 case M_BUTTON_EVTDISP:
195
196 new TGMsgBox(fClient->GetRoot(), this,
197 "WARNING!",
198 "EventDisplay not yet implemented!",
199 kMBIconExclamation, buttons, &retval);
200 break ;
201
202 case M_BUTTON_DATACHECK:
203 new MGDataCheckMain(fClient->GetRoot(), this, 400, 650 ) ;
204 break ;
205
206 case M_BUTTON_ANALYSE:
207 new TGMsgBox(fClient->GetRoot(), this,
208 "WARNING!",
209 "Analysis not yet implemented!",
210 kMBIconExclamation, buttons, &retval);
211 break ;
212
213 case M_BUTTON_MONTECARLO:
214 new MGMonteCarloMain(fClient->GetRoot(), this, 400, 650 ) ;
215
216 break ;
217
218 case M_PICTURE_MAGIC:
219 new TGMsgBox(fClient->GetRoot(), this,
220 "WARNING!",
221 "Please open a Netscape to the MAGIC homepage",
222 kMBIconExclamation, buttons, &retval);
223 break ;
224
225 case M_PICTURE_MARS:
226 new TGMsgBox(fClient->GetRoot(), this,
227 "WARNING!",
228 "Please open a Netscape to the MARS homepage",
229 kMBIconExclamation, buttons, &retval);
230 break ;
231
232
233 default:
234 break ;
235 }
236
237
238 case kCM_MENU:
239
240 switch (parm1) {
241 case M_FILE_EXIT:
242 CloseWindow() ;
243 break;
244 }
245
246
247 default:
248 break ;
249 }
250
251 default:
252 break ;
253 }
254
255 return kTRUE;
256
257}
Note: See TracBrowser for help on using the repository browser.