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

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