Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
146 | f9daq | 1 | #include "../include/substructure.h" |
2 | #include "../include/workstation.h" |
||
3 | #include <stdio.h> |
||
4 | |||
5 | TSubStructure::TSubStructure() |
||
6 | { |
||
7 | // ID of certain objects |
||
8 | /* |
||
9 | * id = 0 -> Label + Text Entry |
||
10 | * id = 1 -> Label + Text Entry + Button |
||
11 | * id = 2 -> Label + Button |
||
12 | * id = 3 -> Label + Number Entry |
||
13 | * id = 4 -> Text Entry + Button |
||
14 | * id = 5 -> Label + Dropdown menu |
||
15 | * id = 6 -> 2 or more buttons |
||
16 | * id = 7 -> Label + 2 Number Entries |
||
17 | * id = 8 -> Checkbutton list |
||
18 | * id = 9 -> Button + horizontal progress bar |
||
19 | * id = 10 -> Label + horizontal progress bar |
||
20 | * id = 11 -> Button + horizontal progress bar + Text Entry |
||
21 | * id = 12 -> Checkbutton + Number Entry |
||
22 | * id = 13 -> Checkbutton + Text Entry |
||
23 | */ |
||
24 | } |
||
25 | |||
26 | TSubStructure::~TSubStructure() |
||
27 | { |
||
28 | // TODO (delete and new not working as they should) |
||
29 | } |
||
30 | |||
31 | // Widget with Label and Text Entry |
||
32 | bool TSubStructure::TGLabelTEntry(TGWindow *parent, int w, int h, const char *label, const char *deftext = "", const char *layout = "oneline") |
||
33 | { |
||
34 | id = 0; |
||
35 | |||
36 | f0 = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,2,2,2,2); |
||
37 | |||
38 | if(strcmp("oneline", layout) == 0) |
||
39 | { |
||
40 | outsidebox = new TGCompositeFrame(parent, w-6, h, kHorizontalFrame | kFixedWidth); |
||
41 | if(DBGSIG > 1) outsidebox->SetBackgroundColor(0); |
||
42 | f0expandX = new TGLayoutHints(kLHintsExpandX | kLHintsCenterY,6,2,2,2); |
||
43 | } |
||
44 | else if(strcmp("twoline", layout) == 0) |
||
45 | { |
||
46 | outsidebox = new TGCompositeFrame(parent, w-6, h, kVerticalFrame | kFixedWidth); |
||
47 | if(DBGSIG > 1) outsidebox->SetBackgroundColor(0); |
||
48 | f0expandX = new TGLayoutHints(kLHintsExpandX | kLHintsCenterY,0,2,2,2); |
||
49 | } |
||
50 | lab = new TGLabel(outsidebox, label); |
||
51 | outsidebox->AddFrame(lab, f0); |
||
52 | widgetTE = new TGTextEntry(outsidebox, deftext); |
||
53 | outsidebox->AddFrame(widgetTE, f0expandX); |
||
54 | |||
55 | if(DBGSIG > 1) printf("id = %d\n",id); |
||
56 | |||
57 | return true; |
||
58 | } |
||
59 | |||
60 | // Widget with Label, Text Entry and Button |
||
61 | bool TSubStructure::TGLabelTEntryButton(TGWindow *parent, int w, int h, const char *label, const char *deftext = "", const char *buttext = "Set", const char *layout = "oneline") |
||
62 | { |
||
63 | id = 1; |
||
64 | |||
65 | f0 = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,2,2,2,2); |
||
66 | |||
67 | if(strcmp("oneline", layout) == 0) |
||
68 | { |
||
69 | outsidebox = new TGCompositeFrame(parent, w-6, h, kHorizontalFrame | kFixedWidth); |
||
70 | if(DBGSIG > 1) outsidebox->SetBackgroundColor(0); |
||
71 | f0expandX = new TGLayoutHints(kLHintsExpandX | kLHintsCenterY,6,6,2,2); |
||
72 | lab = new TGLabel(outsidebox, label); |
||
73 | outsidebox->AddFrame(lab, f0); |
||
74 | widgetTE = new TGTextEntry(outsidebox, deftext); |
||
75 | widgetTE->Resize(w-12,22); |
||
76 | outsidebox->AddFrame(widgetTE, f0expandX); |
||
77 | widgetTB[0] = new TGTextButton(outsidebox, buttext); |
||
78 | widgetTB[0]->SetTextJustify(36); |
||
79 | widgetTB[0]->SetWrapLength(-1); |
||
80 | widgetTB[0]->Resize(60,22); |
||
81 | outsidebox->AddFrame(widgetTB[0], f0); |
||
82 | } |
||
83 | else if(strcmp("twoline", layout) == 0) |
||
84 | { |
||
85 | outsidebox = new TGCompositeFrame(parent, w-6, h, kVerticalFrame | kFixedWidth); |
||
86 | if(DBGSIG > 1) outsidebox->SetBackgroundColor(0); |
||
87 | f0expandX = new TGLayoutHints(kLHintsExpandX | kLHintsCenterY,0,6,2,2); |
||
88 | lab = new TGLabel(outsidebox, label); |
||
89 | outsidebox->AddFrame(lab, f0); |
||
90 | |||
91 | fH1 = new TGHorizontalFrame(outsidebox, 100, h); |
||
92 | if(DBGSIG > 1) fH1->SetBackgroundColor(200); |
||
93 | widgetTE = new TGTextEntry(fH1, deftext); |
||
94 | widgetTE->Resize(w-12,22); |
||
95 | fH1->AddFrame(widgetTE, f0expandX); |
||
96 | widgetTB[0] = new TGTextButton(fH1, buttext); |
||
97 | widgetTB[0]->SetTextJustify(36); |
||
98 | widgetTB[0]->SetWrapLength(-1); |
||
99 | widgetTB[0]->Resize(60,22); |
||
100 | fH1->AddFrame(widgetTB[0], f0); |
||
101 | outsidebox->AddFrame(fH1, f0expandX); |
||
102 | } |
||
103 | |||
104 | if(DBGSIG > 1) printf("id = %d\n",id); |
||
105 | |||
106 | return true; |
||
107 | } |
||
108 | |||
109 | // Widget with Label and Button |
||
110 | bool TSubStructure::TGLabelButton(TGWindow *parent, int w, int h, const char *label, const char *buttext = "Set", const char *pos = "left") |
||
111 | { |
||
112 | id = 2; |
||
113 | |||
114 | f0 = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,2,2,2,2); |
||
115 | f1 = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,6,2,2,2); |
||
116 | if(strcmp("left",pos) == 0) |
||
117 | f2 = new TGLayoutHints(kLHintsLeft,0,0,0,0); |
||
118 | else if(strcmp("center",pos) == 0) |
||
119 | f2 = new TGLayoutHints(kLHintsCenterX,0,0,0,0); |
||
120 | else if(strcmp("right",pos) == 0) |
||
121 | f2 = new TGLayoutHints(kLHintsRight,0,0,0,0); |
||
122 | |||
123 | outsidebox = new TGCompositeFrame(parent, w-6, h, kHorizontalFrame | kFixedWidth); |
||
124 | if(DBGSIG > 1) outsidebox->SetBackgroundColor(0); |
||
125 | fH1 = new TGHorizontalFrame(outsidebox, 100, h); |
||
126 | if(DBGSIG > 1) fH1->SetBackgroundColor(200); |
||
127 | lab = new TGLabel(fH1, label); |
||
128 | fH1->AddFrame(lab, f0); |
||
129 | widgetTB[0] = new TGTextButton(fH1, buttext); |
||
130 | widgetTB[0]->SetTextJustify(36); |
||
131 | widgetTB[0]->SetWrapLength(-1); |
||
132 | widgetTB[0]->Resize(60,22); |
||
133 | fH1->AddFrame(widgetTB[0], f1); |
||
134 | outsidebox->AddFrame(fH1, f2); |
||
135 | |||
136 | if(DBGSIG > 1) printf("id = %d\n",id); |
||
137 | |||
138 | return true; |
||
139 | } |
||
140 | |||
141 | // Widget with Label and Number Entry |
||
142 | bool TSubStructure::TGLabelNEntry(TGWindow *parent, int w, int h, const char *label, double defval, double *format, const char *pos) |
||
143 | { |
||
144 | id = 3; |
||
145 | |||
146 | TGNumberFormat::EStyle numtype; |
||
147 | TGNumberFormat::EAttribute negpos; |
||
148 | TGNumberFormat::ELimit numlim; |
||
149 | bool arelimits[] = {false,false}; |
||
150 | |||
151 | // Number type (integer, real) |
||
152 | if( (int)format[1] == 0 ) numtype = TGNumberFormat::kNESInteger; |
||
153 | else if( (int)format[1] == 1 ) numtype = TGNumberFormat::kNESRealOne; |
||
154 | else if( (int)format[1] == 2 ) numtype = TGNumberFormat::kNESRealTwo; |
||
155 | else if( (int)format[1] == 3 ) numtype = TGNumberFormat::kNESRealThree; |
||
156 | else if( (int)format[1] == 4 ) numtype = TGNumberFormat::kNESRealFour; |
||
157 | else if( (int)format[1] == -1 ) numtype = TGNumberFormat::kNESReal; |
||
158 | |||
159 | // Negative or positive |
||
160 | if( (int)format[2] == 0 ) negpos = TGNumberFormat::kNEAAnyNumber; |
||
161 | else if( (int)format[2] == 1 ) negpos = TGNumberFormat::kNEAPositive; |
||
162 | else if( (int)format[2] == 2 ) negpos = TGNumberFormat::kNEANonNegative; |
||
163 | |||
164 | // Limits |
||
165 | if( (int)format[3] == 0 ) numlim = TGNumberFormat::kNELNoLimits; |
||
166 | else if( (int)format[3] == 1 ) { numlim = TGNumberFormat::kNELLimitMax; arelimits[1] = true; } |
||
167 | else if( (int)format[3] == 2 ) { numlim = TGNumberFormat::kNELLimitMinMax; arelimits[0] = true; arelimits[1] = true; } |
||
168 | else if( (int)format[3] == -1 ) { numlim = TGNumberFormat::kNELLimitMin; arelimits[0] = true; } |
||
169 | |||
170 | f0 = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,2,2,2,2); |
||
171 | f1 = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,6,2,2,2); |
||
172 | if(strcmp("left",pos) == 0) |
||
173 | f2 = new TGLayoutHints(kLHintsLeft,0,0,0,0); |
||
174 | else if(strcmp("center",pos) == 0) |
||
175 | f2 = new TGLayoutHints(kLHintsCenterX,0,0,0,0); |
||
176 | else if(strcmp("right",pos) == 0) |
||
177 | f2 = new TGLayoutHints(kLHintsRight,0,0,0,0); |
||
178 | |||
179 | outsidebox = new TGCompositeFrame(parent, w-6, h, kHorizontalFrame | kFixedWidth); |
||
180 | if(DBGSIG > 1) outsidebox->SetBackgroundColor(0); |
||
181 | fH1 = new TGHorizontalFrame(outsidebox, 100, h); |
||
182 | if(DBGSIG > 1) fH1->SetBackgroundColor(200); |
||
183 | lab = new TGLabel(fH1, label); |
||
184 | fH1->AddFrame(lab, f0); |
||
185 | if( (int)format[1] == 0 ) |
||
186 | { |
||
187 | if( arelimits[0] && arelimits[1] ) |
||
188 | widgetNE[0] = new TGNumberEntry(fH1, (int)defval, (int)format[0], 999, numtype, negpos, numlim, (int)format[4], (int)format[5]); |
||
189 | else if( arelimits[0] ) |
||
190 | widgetNE[0] = new TGNumberEntry(fH1, (int)defval, (int)format[0], 999, numtype, negpos, numlim, (int)format[4], 0); |
||
191 | else if( arelimits[1] ) |
||
192 | widgetNE[0] = new TGNumberEntry(fH1, (int)defval, (int)format[0], 999, numtype, negpos, numlim, 0, (int)format[4]); |
||
193 | else |
||
194 | widgetNE[0] = new TGNumberEntry(fH1, (int)defval, (int)format[0], 999, numtype, negpos, numlim); |
||
195 | } |
||
196 | else if( (((int)format[1] > 0) && ((int)format[1] < 5)) || ((int)format[1] == -1) ) |
||
197 | { |
||
198 | if( arelimits[0] && arelimits[1] ) |
||
199 | widgetNE[0] = new TGNumberEntry(fH1, defval, (int)format[0], 999, numtype, negpos, numlim, format[4], format[5]); |
||
200 | else if( arelimits[0] ) |
||
201 | widgetNE[0] = new TGNumberEntry(fH1, defval, (int)format[0], 999, numtype, negpos, numlim, format[4], 0); |
||
202 | else if( arelimits[1] ) |
||
203 | widgetNE[0] = new TGNumberEntry(fH1, defval, (int)format[0], 999, numtype, negpos, numlim, 0, format[4]); |
||
204 | else |
||
205 | widgetNE[0] = new TGNumberEntry(fH1, defval, (int)format[0], 999, numtype, negpos, numlim); |
||
206 | } |
||
207 | else |
||
208 | { |
||
209 | delete outsidebox; |
||
210 | delete lab; |
||
211 | return false; |
||
212 | } |
||
213 | fH1->AddFrame(widgetNE[0], f1); |
||
214 | outsidebox->AddFrame(fH1, f2); |
||
215 | |||
216 | if(DBGSIG > 1) printf("id = %d\n",id); |
||
217 | |||
218 | return true; |
||
219 | } |
||
220 | |||
221 | // Widget with Text Entry and Button |
||
222 | bool TSubStructure::TGTEntryButton(TGWindow *parent, int w, int h, const char *deftext = "", const char *buttext = "Set") |
||
223 | { |
||
224 | id = 4; |
||
225 | |||
226 | f0 = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,2,2,2,2); |
||
227 | f0expandX = new TGLayoutHints(kLHintsExpandX | kLHintsCenterY,2,6,2,2); |
||
228 | |||
229 | outsidebox = new TGCompositeFrame(parent, w-6, h, kHorizontalFrame | kFixedWidth); |
||
230 | if(DBGSIG > 1) outsidebox->SetBackgroundColor(0); |
||
231 | widgetTE = new TGTextEntry(outsidebox, deftext); |
||
232 | widgetTE->Resize(w-12,22); |
||
233 | outsidebox->AddFrame(widgetTE, f0expandX); |
||
234 | widgetTB[0] = new TGTextButton(outsidebox, buttext); |
||
235 | widgetTB[0]->SetTextJustify(36); |
||
236 | widgetTB[0]->SetWrapLength(-1); |
||
237 | widgetTB[0]->Resize(60,22); |
||
238 | outsidebox->AddFrame(widgetTB[0], f0); |
||
239 | |||
240 | if(DBGSIG > 1) printf("id = %d\n",id); |
||
241 | |||
242 | return true; |
||
243 | } |
||
244 | |||
245 | // Widget with Label and Dropdown menu |
||
246 | bool TSubStructure::TGLabelDrop(TGWindow *parent, int w, int h, const char *label, int nrentries, const char *entrytext[512], const char *selecttext) |
||
247 | { |
||
248 | id = 5; |
||
249 | |||
250 | f0 = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,2,2,2,2); |
||
251 | f0expandX = new TGLayoutHints(kLHintsExpandX | kLHintsCenterY,6,2,2,2); |
||
252 | |||
253 | int sel = 0; |
||
254 | |||
255 | outsidebox = new TGCompositeFrame(parent, w-6, h, kHorizontalFrame | kFixedWidth); |
||
256 | if(DBGSIG > 1) outsidebox->SetBackgroundColor(0); |
||
257 | lab = new TGLabel(outsidebox, label); |
||
258 | outsidebox->AddFrame(lab, f0); |
||
259 | widgetCB = new TGComboBox(outsidebox, 200); |
||
260 | for(int i = 0; i < nrentries; i++) |
||
261 | { |
||
262 | widgetCB->AddEntry(entrytext[i], i); |
||
263 | if( strcmp(entrytext[i], selecttext) == 0 ) |
||
264 | sel = i; |
||
265 | } |
||
266 | widgetCB->Resize(50,22); |
||
267 | widgetCB->Select(sel); |
||
268 | outsidebox->AddFrame(widgetCB, f0expandX); |
||
269 | |||
270 | if(DBGSIG > 1) printf("id = %d\n",id); |
||
271 | |||
272 | return true; |
||
273 | } |
||
274 | |||
275 | // Widget with 2 or more buttons (up to 6) |
||
276 | bool TSubStructure::TGMultiButton(TGWindow *parent, int w, int h, int nrbuttons, const char *buttext[512], const char *pos) |
||
277 | { |
||
278 | id = 6; |
||
279 | |||
280 | if(nrbuttons > 6) return false; |
||
281 | |||
282 | f0 = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,2,2,2,2); |
||
283 | f1 = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,6,2,2,2); |
||
284 | if(strcmp("left",pos) == 0) |
||
285 | f2 = new TGLayoutHints(kLHintsLeft,0,0,0,0); |
||
286 | else if(strcmp("center",pos) == 0) |
||
287 | f2 = new TGLayoutHints(kLHintsCenterX,0,0,0,0); |
||
288 | else if(strcmp("right",pos) == 0) |
||
289 | f2 = new TGLayoutHints(kLHintsRight,0,0,0,0); |
||
290 | |||
291 | outsidebox = new TGCompositeFrame(parent, w-6, h, kHorizontalFrame | kFixedWidth); |
||
292 | if(DBGSIG > 1) outsidebox->SetBackgroundColor(0); |
||
293 | fH1 = new TGHorizontalFrame(outsidebox, 100, h); |
||
294 | if(DBGSIG > 1) fH1->SetBackgroundColor(200); |
||
295 | for(int i = 0; i < nrbuttons; i++) |
||
296 | { |
||
297 | widgetTB[i] = new TGTextButton(fH1, buttext[i]); |
||
298 | widgetTB[i]->SetTextJustify(36); |
||
299 | widgetTB[i]->SetWrapLength(-1); |
||
300 | widgetTB[i]->Resize((w-6-8)/nrbuttons,22); |
||
301 | if(i == 0) fH1->AddFrame(widgetTB[i], f0); |
||
302 | else fH1->AddFrame(widgetTB[i], f1); |
||
303 | } |
||
304 | outsidebox->AddFrame(fH1, f2); |
||
305 | |||
306 | if(DBGSIG > 1) printf("id = %d\n",id); |
||
307 | |||
308 | return true; |
||
309 | } |
||
310 | |||
311 | // Widget with Label and two Number Entries |
||
312 | bool TSubStructure::TGLabelDoubleNEntry(TGWindow *parent, int w, int h, const char *label, double defval1, double *format1, double defval2, double *format2, const char *pos) |
||
313 | { |
||
314 | id = 7; |
||
315 | |||
316 | TGNumberFormat::EStyle numtype1, numtype2; |
||
317 | TGNumberFormat::EAttribute negpos1, negpos2; |
||
318 | TGNumberFormat::ELimit numlim1, numlim2; |
||
319 | bool arelimits[] = {false,false,false,false}; |
||
320 | |||
321 | // Number type (integer, real) |
||
322 | if( (int)format1[1] == 0 ) numtype1 = TGNumberFormat::kNESInteger; |
||
323 | else if( (int)format1[1] == 1 ) numtype1 = TGNumberFormat::kNESRealOne; |
||
324 | else if( (int)format1[1] == 2 ) numtype1 = TGNumberFormat::kNESRealTwo; |
||
325 | else if( (int)format1[1] == 3 ) numtype1 = TGNumberFormat::kNESRealThree; |
||
326 | else if( (int)format1[1] == 4 ) numtype1 = TGNumberFormat::kNESRealFour; |
||
327 | else if( (int)format1[1] == -1 ) numtype1 = TGNumberFormat::kNESReal; |
||
328 | |||
329 | if( (int)format2[1] == 0 ) numtype2 = TGNumberFormat::kNESInteger; |
||
330 | else if( (int)format2[1] == 1 ) numtype2 = TGNumberFormat::kNESRealOne; |
||
331 | else if( (int)format2[1] == 2 ) numtype2 = TGNumberFormat::kNESRealTwo; |
||
332 | else if( (int)format2[1] == 3 ) numtype2 = TGNumberFormat::kNESRealThree; |
||
333 | else if( (int)format2[1] == 4 ) numtype2 = TGNumberFormat::kNESRealFour; |
||
334 | else if( (int)format2[1] == -1 ) numtype2 = TGNumberFormat::kNESReal; |
||
335 | |||
336 | // Negative or positive |
||
337 | if( (int)format1[2] == 0 ) negpos1 = TGNumberFormat::kNEAAnyNumber; |
||
338 | else if( (int)format1[2] == 1 ) negpos1 = TGNumberFormat::kNEAPositive; |
||
339 | else if( (int)format1[2] == 2 ) negpos1 = TGNumberFormat::kNEANonNegative; |
||
340 | |||
341 | if( (int)format2[2] == 0 ) negpos2 = TGNumberFormat::kNEAAnyNumber; |
||
342 | else if( (int)format2[2] == 1 ) negpos2 = TGNumberFormat::kNEAPositive; |
||
343 | else if( (int)format2[2] == 2 ) negpos2 = TGNumberFormat::kNEANonNegative; |
||
344 | |||
345 | // Limits |
||
346 | if( (int)format1[3] == 0 ) numlim1 = TGNumberFormat::kNELNoLimits; |
||
347 | else if( (int)format1[3] == 1 ) { numlim1 = TGNumberFormat::kNELLimitMax; arelimits[1] = true; } |
||
348 | else if( (int)format1[3] == 2 ) { numlim1 = TGNumberFormat::kNELLimitMinMax; arelimits[0] = true; arelimits[1] = true; } |
||
349 | else if( (int)format1[3] == -1 ) { numlim1 = TGNumberFormat::kNELLimitMin; arelimits[0] = true; } |
||
350 | |||
351 | if( (int)format2[3] == 0 ) numlim2 = TGNumberFormat::kNELNoLimits; |
||
352 | else if( (int)format2[3] == 1 ) { numlim2 = TGNumberFormat::kNELLimitMax; arelimits[3] = true; } |
||
353 | else if( (int)format2[3] == 2 ) { numlim2 = TGNumberFormat::kNELLimitMinMax; arelimits[2] = true; arelimits[3] = true; } |
||
354 | else if( (int)format2[3] == -1 ) { numlim2 = TGNumberFormat::kNELLimitMin; arelimits[2] = true; } |
||
355 | |||
356 | f0 = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,2,2,2,2); |
||
357 | f1 = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,6,2,2,2); |
||
358 | if(strcmp("left",pos) == 0) |
||
359 | f2 = new TGLayoutHints(kLHintsLeft,0,0,0,0); |
||
360 | else if(strcmp("center",pos) == 0) |
||
361 | f2 = new TGLayoutHints(kLHintsCenterX,0,0,0,0); |
||
362 | else if(strcmp("right",pos) == 0) |
||
363 | f2 = new TGLayoutHints(kLHintsRight,0,0,0,0); |
||
364 | |||
365 | outsidebox = new TGCompositeFrame(parent, w-6, h, kHorizontalFrame | kFixedWidth); |
||
366 | if(DBGSIG > 1) outsidebox->SetBackgroundColor(0); |
||
367 | fH1 = new TGHorizontalFrame(outsidebox, 100, h); |
||
368 | if(DBGSIG > 1) fH1->SetBackgroundColor(200); |
||
369 | lab = new TGLabel(fH1, label); |
||
370 | fH1->AddFrame(lab, f0); |
||
371 | if( (int)format1[1] == 0 ) |
||
372 | { |
||
373 | if( arelimits[0] && arelimits[1] ) |
||
374 | widgetNE[0] = new TGNumberEntry(fH1, (int)defval1, (int)format1[0], 999, numtype1, negpos1, numlim1, (int)format1[4], (int)format1[5]); |
||
375 | else if( arelimits[0] ) |
||
376 | widgetNE[0] = new TGNumberEntry(fH1, (int)defval1, (int)format1[0], 999, numtype1, negpos1, numlim1, (int)format1[4], 0); |
||
377 | else if( arelimits[1] ) |
||
378 | widgetNE[0] = new TGNumberEntry(fH1, (int)defval1, (int)format1[0], 999, numtype1, negpos1, numlim1, 0, (int)format1[4]); |
||
379 | else |
||
380 | widgetNE[0] = new TGNumberEntry(fH1, (int)defval1, (int)format1[0], 999, numtype1, negpos1, numlim1); |
||
381 | } |
||
382 | else if( (((int)format1[1] > 0) && ((int)format1[1] < 5)) || ((int)format1[1] == -1) ) |
||
383 | { |
||
384 | if( arelimits[0] && arelimits[1] ) |
||
385 | widgetNE[0] = new TGNumberEntry(fH1, defval1, (int)format1[0], 999, numtype1, negpos1, numlim1, format1[4], format1[5]); |
||
386 | else if( arelimits[0] ) |
||
387 | widgetNE[0] = new TGNumberEntry(fH1, defval1, (int)format1[0], 999, numtype1, negpos1, numlim1, format1[4], 0); |
||
388 | else if( arelimits[1] ) |
||
389 | widgetNE[0] = new TGNumberEntry(fH1, defval1, (int)format1[0], 999, numtype1, negpos1, numlim1, 0, format1[4]); |
||
390 | else |
||
391 | widgetNE[0] = new TGNumberEntry(fH1, defval1, (int)format1[0], 999, numtype1, negpos1, numlim1); |
||
392 | } |
||
393 | fH1->AddFrame(widgetNE[0], f1); |
||
394 | |||
395 | if( (int)format2[1] == 0 ) |
||
396 | { |
||
397 | if( arelimits[2] && arelimits[3] ) |
||
398 | widgetNE[1] = new TGNumberEntry(fH1, (int)defval2, (int)format2[0], 999, numtype2, negpos2, numlim2, (int)format2[4], (int)format2[5]); |
||
399 | else if( arelimits[2] ) |
||
400 | widgetNE[1] = new TGNumberEntry(fH1, (int)defval2, (int)format2[0], 999, numtype2, negpos2, numlim2, (int)format2[4], 0); |
||
401 | else if( arelimits[3] ) |
||
402 | widgetNE[1] = new TGNumberEntry(fH1, (int)defval2, (int)format2[0], 999, numtype2, negpos2, numlim2, 0, (int)format2[4]); |
||
403 | else |
||
404 | widgetNE[1] = new TGNumberEntry(fH1, (int)defval2, (int)format2[0], 999, numtype2, negpos2, numlim2); |
||
405 | } |
||
406 | else if( (((int)format2[1] > 0) && ((int)format2[1] < 5)) || ((int)format2[1] == -1) ) |
||
407 | { |
||
408 | if( arelimits[2] && arelimits[3] ) |
||
409 | widgetNE[1] = new TGNumberEntry(fH1, defval2, (int)format2[0], 999, numtype2, negpos2, numlim2, format2[4], format2[5]); |
||
410 | else if( arelimits[2] ) |
||
411 | widgetNE[1] = new TGNumberEntry(fH1, defval2, (int)format2[0], 999, numtype2, negpos2, numlim2, format2[4], 0); |
||
412 | else if( arelimits[3] ) |
||
413 | widgetNE[1] = new TGNumberEntry(fH1, defval2, (int)format2[0], 999, numtype2, negpos2, numlim2, 0, format2[4]); |
||
414 | else |
||
415 | widgetNE[1] = new TGNumberEntry(fH1, defval2, (int)format2[0], 999, numtype2, negpos2, numlim2); |
||
416 | } |
||
417 | else |
||
418 | { |
||
419 | delete outsidebox; |
||
420 | delete lab; |
||
421 | return false; |
||
422 | } |
||
423 | fH1->AddFrame(widgetNE[1], f1); |
||
424 | outsidebox->AddFrame(fH1, f2); |
||
425 | |||
426 | if(DBGSIG > 1) printf("id = %d\n",id); |
||
427 | |||
428 | return true; |
||
429 | } |
||
430 | |||
431 | // Widget with 1 or more check boxes (up to 9) |
||
432 | bool TSubStructure::TGCheckList(TGWindow *parent, int w, int h, int nrchecks, const char *labels[512], int *onoff, const char *layout, const char *pos) |
||
433 | { |
||
434 | id = 8; |
||
435 | |||
436 | if(nrchecks > 8) return false; |
||
437 | |||
438 | f0 = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,2,2,2,2); |
||
439 | f1 = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,6,2,2,2); |
||
440 | if(strcmp("left",pos) == 0) |
||
441 | f2 = new TGLayoutHints(kLHintsLeft,0,0,0,0); |
||
442 | else if(strcmp("center",pos) == 0) |
||
443 | f2 = new TGLayoutHints(kLHintsCenterX,0,0,0,0); |
||
444 | else if(strcmp("right",pos) == 0) |
||
445 | f2 = new TGLayoutHints(kLHintsRight,0,0,0,0); |
||
446 | |||
447 | if(strcmp("left",pos) == 0) |
||
448 | f3 = new TGLayoutHints(kLHintsLeft,2,2,2,2); |
||
449 | else if(strcmp("center",pos) == 0) |
||
450 | f3 = new TGLayoutHints(kLHintsCenterX,2,2,2,2); |
||
451 | else if(strcmp("right",pos) == 0) |
||
452 | f3 = new TGLayoutHints(kLHintsRight,2,2,2,2); |
||
453 | |||
454 | if(strcmp("horizontal", layout) == 0) |
||
455 | { |
||
456 | outsidebox = new TGCompositeFrame(parent, w-6, h, kHorizontalFrame | kFixedWidth); |
||
457 | if(DBGSIG > 1) outsidebox->SetBackgroundColor(0); |
||
458 | fH1 = new TGHorizontalFrame(outsidebox, 100, h); |
||
459 | if(DBGSIG > 1) fH1->SetBackgroundColor(200); |
||
460 | |||
461 | for(int i = 0; i < nrchecks; i++) |
||
462 | { |
||
463 | widgetChBox[i] = new TGCheckButton(fH1, labels[i]); |
||
464 | if(onoff[i] == 0) |
||
465 | widgetChBox[i]->SetState(kButtonUp); |
||
466 | else if(onoff[i] == 1) |
||
467 | widgetChBox[i]->SetState(kButtonDown); |
||
468 | widgetChBox[i]->Resize((w-6-8)/nrchecks,22); |
||
469 | if(i == 0) fH1->AddFrame(widgetChBox[i], f0); |
||
470 | else fH1->AddFrame(widgetChBox[i], f1); |
||
471 | } |
||
472 | |||
473 | outsidebox->AddFrame(fH1, f2); |
||
474 | } |
||
475 | else if(strcmp("vertical", layout) == 0) |
||
476 | { |
||
477 | outsidebox = new TGCompositeFrame(parent, w-6, h, kVerticalFrame | kFixedWidth); |
||
478 | if(DBGSIG > 1) outsidebox->SetBackgroundColor(0); |
||
479 | |||
480 | for(int i = 0; i < nrchecks; i++) |
||
481 | { |
||
482 | widgetChBox[i] = new TGCheckButton(outsidebox, labels[i]); |
||
483 | if(onoff[i] == 0) |
||
484 | widgetChBox[i]->SetState(kButtonUp); |
||
485 | else if(onoff[i] == 1) |
||
486 | widgetChBox[i]->SetState(kButtonDown); |
||
487 | widgetChBox[i]->Resize((w-6-8)/nrchecks,22); |
||
488 | outsidebox->AddFrame(widgetChBox[i], f3); |
||
489 | } |
||
490 | } |
||
491 | else if(strcmp("twoline", layout) == 0) |
||
492 | { |
||
493 | outsidebox = new TGCompositeFrame(parent, w-6, h, kVerticalFrame | kFixedWidth); |
||
494 | if(DBGSIG > 1) outsidebox->SetBackgroundColor(0); |
||
495 | fH1 = new TGHorizontalFrame(outsidebox, 100, h); |
||
496 | if(DBGSIG > 1) fH1->SetBackgroundColor(200); |
||
497 | |||
498 | for(int i = 0; i < TMath::Ceil(nrchecks/2.); i++) |
||
499 | { |
||
500 | widgetChBox[i] = new TGCheckButton(fH1, labels[i]); |
||
501 | if(onoff[i] == 0) |
||
502 | widgetChBox[i]->SetState(kButtonUp); |
||
503 | else if(onoff[i] == 1) |
||
504 | widgetChBox[i]->SetState(kButtonDown); |
||
505 | widgetChBox[i]->Resize((w-6-8)/nrchecks,22); |
||
506 | if(i == 0) fH1->AddFrame(widgetChBox[i], f0); |
||
507 | else fH1->AddFrame(widgetChBox[i], f1); |
||
508 | } |
||
509 | outsidebox->AddFrame(fH1, f2); |
||
510 | |||
511 | fH1 = new TGHorizontalFrame(outsidebox, 100, h); |
||
512 | if(DBGSIG > 1) fH1->SetBackgroundColor(200); |
||
513 | |||
514 | for(int i = TMath::Ceil(nrchecks/2.); i < nrchecks; i++) |
||
515 | { |
||
516 | widgetChBox[i] = new TGCheckButton(fH1, labels[i]); |
||
517 | if(onoff[i] == 0) |
||
518 | widgetChBox[i]->SetState(kButtonUp); |
||
519 | else if(onoff[i] == 1) |
||
520 | widgetChBox[i]->SetState(kButtonDown); |
||
521 | widgetChBox[i]->Resize((w-6-8)/nrchecks,22); |
||
522 | if(i == TMath::Ceil(nrchecks/2.)) fH1->AddFrame(widgetChBox[i], f0); |
||
523 | else fH1->AddFrame(widgetChBox[i], f1); |
||
524 | } |
||
525 | outsidebox->AddFrame(fH1, f2); |
||
526 | } |
||
527 | else if(strcmp("threeline", layout) == 0) |
||
528 | { |
||
529 | outsidebox = new TGCompositeFrame(parent, w-6, h, kVerticalFrame | kFixedWidth); |
||
530 | if(DBGSIG > 1) outsidebox->SetBackgroundColor(0); |
||
531 | fH1 = new TGHorizontalFrame(outsidebox, 100, h); |
||
532 | if(DBGSIG > 1) fH1->SetBackgroundColor(200); |
||
533 | |||
534 | for(int i = 0; i < TMath::Ceil(nrchecks/3.); i++) |
||
535 | { |
||
536 | widgetChBox[i] = new TGCheckButton(fH1, labels[i]); |
||
537 | if(onoff[i] == 0) |
||
538 | widgetChBox[i]->SetState(kButtonUp); |
||
539 | else if(onoff[i] == 1) |
||
540 | widgetChBox[i]->SetState(kButtonDown); |
||
541 | widgetChBox[i]->Resize((w-6-8)/nrchecks,22); |
||
542 | if(i == 0) fH1->AddFrame(widgetChBox[i], f0); |
||
543 | else fH1->AddFrame(widgetChBox[i], f1); |
||
544 | } |
||
545 | outsidebox->AddFrame(fH1, f2); |
||
546 | |||
547 | fH1 = new TGHorizontalFrame(outsidebox, 100, h); |
||
548 | if(DBGSIG > 1) fH1->SetBackgroundColor(200); |
||
549 | |||
550 | for(int i = TMath::Ceil(nrchecks/3.); i < TMath::Ceil(2.*nrchecks/3.); i++) |
||
551 | { |
||
552 | widgetChBox[i] = new TGCheckButton(fH1, labels[i]); |
||
553 | if(onoff[i] == 0) |
||
554 | widgetChBox[i]->SetState(kButtonUp); |
||
555 | else if(onoff[i] == 1) |
||
556 | widgetChBox[i]->SetState(kButtonDown); |
||
557 | widgetChBox[i]->Resize((w-6-8)/nrchecks,22); |
||
558 | if(i == TMath::Ceil(nrchecks/3.)) fH1->AddFrame(widgetChBox[i], f0); |
||
559 | else fH1->AddFrame(widgetChBox[i], f1); |
||
560 | } |
||
561 | outsidebox->AddFrame(fH1, f2); |
||
562 | |||
563 | fH1 = new TGHorizontalFrame(outsidebox, 100, h); |
||
564 | if(DBGSIG > 1) fH1->SetBackgroundColor(200); |
||
565 | |||
566 | for(int i = TMath::Ceil(2.*nrchecks/3.); i < nrchecks; i++) |
||
567 | { |
||
568 | widgetChBox[i] = new TGCheckButton(fH1, labels[i]); |
||
569 | if(onoff[i] == 0) |
||
570 | widgetChBox[i]->SetState(kButtonUp); |
||
571 | else if(onoff[i] == 1) |
||
572 | widgetChBox[i]->SetState(kButtonDown); |
||
573 | widgetChBox[i]->Resize((w-6-8)/nrchecks,22); |
||
574 | if(i == TMath::Ceil(2.*nrchecks/3.)) fH1->AddFrame(widgetChBox[i], f0); |
||
575 | else fH1->AddFrame(widgetChBox[i], f1); |
||
576 | } |
||
577 | outsidebox->AddFrame(fH1, f2); |
||
578 | } |
||
579 | else |
||
580 | return false; |
||
581 | |||
582 | if(DBGSIG > 1) printf("id = %d\n",id); |
||
583 | |||
584 | return true; |
||
585 | } |
||
586 | |||
587 | // Widget with Button and horizontal progress bar |
||
588 | bool TSubStructure::TGButtonProgress(TGWindow *parent, int w, int h, const char *buttext = "Set") |
||
589 | { |
||
590 | id = 9; |
||
591 | |||
592 | f0 = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,2,2,2,2); |
||
593 | f1 = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,20,2,2,2); |
||
594 | f2 = new TGLayoutHints(kLHintsCenterX,0,0,0,0); |
||
595 | |||
596 | outsidebox = new TGCompositeFrame(parent, w-6, h, kHorizontalFrame | kFixedWidth); |
||
597 | if(DBGSIG > 1) outsidebox->SetBackgroundColor(0); |
||
598 | fH1 = new TGHorizontalFrame(outsidebox, 100, h); |
||
599 | if(DBGSIG > 1) fH1->SetBackgroundColor(200); |
||
600 | widgetTB[0] = new TGTextButton(fH1, buttext); |
||
601 | widgetTB[0]->SetTextJustify(36); |
||
602 | widgetTB[0]->SetWrapLength(-1); |
||
603 | widgetTB[0]->Resize(60,22); |
||
604 | fH1->AddFrame(widgetTB[0], f0); |
||
605 | widgetPB = new TGHProgressBar(fH1, TGProgressBar::kStandard, w/2); |
||
606 | widgetPB->ShowPosition(); |
||
607 | widgetPB->SetRange(0,100); |
||
608 | widgetPB->SetBarColor("green"); |
||
609 | fH1->AddFrame(widgetPB, f1); |
||
610 | |||
611 | outsidebox->AddFrame(fH1, f2); |
||
612 | |||
613 | if(DBGSIG > 1) printf("id = %d\n",id); |
||
614 | |||
615 | return true; |
||
616 | } |
||
617 | |||
618 | // Widget with Button and horizontal progress bar |
||
619 | bool TSubStructure::TGButtonProgressTEntry(TGWindow *parent, int w, int h, const char *buttext = "Set", const char *deftext = "Remaining time: ") |
||
620 | { |
||
621 | id = 11; |
||
622 | |||
623 | f0 = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,2,2,2,2); |
||
624 | f0expandX = new TGLayoutHints(kLHintsExpandX | kLHintsCenterY,20,2,2,2); |
||
625 | f1 = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,20,2,2,2); |
||
626 | f2 = new TGLayoutHints(kLHintsCenterX,0,0,0,0); |
||
627 | |||
628 | outsidebox = new TGCompositeFrame(parent, w-6, h, kHorizontalFrame | kFixedWidth); |
||
629 | if(DBGSIG > 1) outsidebox->SetBackgroundColor(0); |
||
630 | fH1 = new TGHorizontalFrame(outsidebox, 5*w/6, h, kFixedWidth); |
||
631 | if(DBGSIG > 1) fH1->SetBackgroundColor(200); |
||
632 | widgetTB[0] = new TGTextButton(fH1, buttext); |
||
633 | widgetTB[0]->SetTextJustify(36); |
||
634 | widgetTB[0]->SetWrapLength(-1); |
||
635 | widgetTB[0]->Resize(60,22); |
||
636 | fH1->AddFrame(widgetTB[0], f0); |
||
637 | widgetPB = new TGHProgressBar(fH1, TGProgressBar::kStandard, w/4); |
||
638 | widgetPB->ShowPosition(); |
||
639 | widgetPB->SetRange(0,100); |
||
640 | widgetPB->SetBarColor("green"); |
||
641 | fH1->AddFrame(widgetPB, f1); |
||
642 | widgetTE = new TGTextEntry(fH1, deftext); |
||
643 | fH1->AddFrame(widgetTE, f0expandX); |
||
644 | |||
645 | outsidebox->AddFrame(fH1, f2); |
||
646 | |||
647 | if(DBGSIG > 1) printf("id = %d\n",id); |
||
648 | |||
649 | return true; |
||
650 | } |
||
651 | |||
652 | // Widget with Label and horizontal progress bar |
||
653 | bool TSubStructure::TGLabelProgress(TGWindow *parent, int w, int h, const char *label) |
||
654 | { |
||
655 | id = 10; |
||
656 | |||
657 | f0 = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,2,2,2,2); |
||
658 | f1 = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,20,2,2,2); |
||
659 | f2 = new TGLayoutHints(kLHintsCenterX,0,0,0,0); |
||
660 | |||
661 | outsidebox = new TGCompositeFrame(parent, w-6, h, kHorizontalFrame | kFixedWidth); |
||
662 | if(DBGSIG > 1) outsidebox->SetBackgroundColor(0); |
||
663 | fH1 = new TGHorizontalFrame(outsidebox, 100, h); |
||
664 | if(DBGSIG > 1) fH1->SetBackgroundColor(200); |
||
665 | lab = new TGLabel(fH1, label); |
||
666 | fH1->AddFrame(lab, f0); |
||
667 | widgetPB = new TGHProgressBar(fH1, TGProgressBar::kStandard, w/2); |
||
668 | widgetPB->ShowPosition(); |
||
669 | widgetPB->SetRange(0,100); |
||
670 | widgetPB->SetBarColor("green"); |
||
671 | fH1->AddFrame(widgetPB, f1); |
||
672 | |||
673 | outsidebox->AddFrame(fH1, f2); |
||
674 | |||
675 | if(DBGSIG > 1) printf("id = %d\n",id); |
||
676 | |||
677 | return true; |
||
678 | } |
||
679 | |||
680 | // Widget with checkbutton and number entry |
||
681 | bool TSubStructure::TGCheckNEntry(TGWindow *parent, int w, int h, const char *label, int onoff, double defval, double *format, const char *pos) |
||
682 | { |
||
683 | id = 12; |
||
684 | |||
685 | TGNumberFormat::EStyle numtype; |
||
686 | TGNumberFormat::EAttribute negpos; |
||
687 | TGNumberFormat::ELimit numlim; |
||
688 | bool arelimits[] = {false,false}; |
||
689 | |||
690 | // Number type (integer, real) |
||
691 | if( (int)format[1] == 0 ) numtype = TGNumberFormat::kNESInteger; |
||
692 | else if( (int)format[1] == 1 ) numtype = TGNumberFormat::kNESRealOne; |
||
693 | else if( (int)format[1] == 2 ) numtype = TGNumberFormat::kNESRealTwo; |
||
694 | else if( (int)format[1] == 3 ) numtype = TGNumberFormat::kNESRealThree; |
||
695 | else if( (int)format[1] == 4 ) numtype = TGNumberFormat::kNESRealFour; |
||
696 | else if( (int)format[1] == -1 ) numtype = TGNumberFormat::kNESReal; |
||
697 | |||
698 | // Negative or positive |
||
699 | if( (int)format[2] == 0 ) negpos = TGNumberFormat::kNEAAnyNumber; |
||
700 | else if( (int)format[2] == 1 ) negpos = TGNumberFormat::kNEAPositive; |
||
701 | else if( (int)format[2] == 2 ) negpos = TGNumberFormat::kNEANonNegative; |
||
702 | |||
703 | // Limits |
||
704 | if( (int)format[3] == 0 ) numlim = TGNumberFormat::kNELNoLimits; |
||
705 | else if( (int)format[3] == 1 ) { numlim = TGNumberFormat::kNELLimitMax; arelimits[1] = true; } |
||
706 | else if( (int)format[3] == 2 ) { numlim = TGNumberFormat::kNELLimitMinMax; arelimits[0] = true; arelimits[1] = true; } |
||
707 | else if( (int)format[3] == -1 ) { numlim = TGNumberFormat::kNELLimitMin; arelimits[0] = true; } |
||
708 | |||
709 | f0 = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,2,2,2,2); |
||
710 | f1 = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,6,2,2,2); |
||
711 | if(strcmp("left",pos) == 0) |
||
712 | f2 = new TGLayoutHints(kLHintsLeft,0,0,0,0); |
||
713 | else if(strcmp("center",pos) == 0) |
||
714 | f2 = new TGLayoutHints(kLHintsCenterX,0,0,0,0); |
||
715 | else if(strcmp("right",pos) == 0) |
||
716 | f2 = new TGLayoutHints(kLHintsRight,0,0,0,0); |
||
717 | |||
718 | outsidebox = new TGCompositeFrame(parent, w-6, h, kHorizontalFrame | kFixedWidth); |
||
719 | if(DBGSIG > 1) outsidebox->SetBackgroundColor(0); |
||
720 | fH1 = new TGHorizontalFrame(outsidebox, 100, h); |
||
721 | if(DBGSIG > 1) fH1->SetBackgroundColor(200); |
||
722 | widgetChBox[0] = new TGCheckButton(fH1, label); |
||
723 | if(onoff == 0) |
||
724 | widgetChBox[0]->SetState(kButtonUp); |
||
725 | else if(onoff == 1) |
||
726 | widgetChBox[0]->SetState(kButtonDown); |
||
727 | // widgetChBox[0]->Resize(w-14,22); |
||
728 | fH1->AddFrame(widgetChBox[0], f0); |
||
729 | if( (int)format[1] == 0 ) |
||
730 | { |
||
731 | if( arelimits[0] && arelimits[1] ) |
||
732 | widgetNE[0] = new TGNumberEntry(fH1, (int)defval, (int)format[0], 999, numtype, negpos, numlim, (int)format[4], (int)format[5]); |
||
733 | else if( arelimits[0] ) |
||
734 | widgetNE[0] = new TGNumberEntry(fH1, (int)defval, (int)format[0], 999, numtype, negpos, numlim, (int)format[4], 0); |
||
735 | else if( arelimits[1] ) |
||
736 | widgetNE[0] = new TGNumberEntry(fH1, (int)defval, (int)format[0], 999, numtype, negpos, numlim, 0, (int)format[4]); |
||
737 | else |
||
738 | widgetNE[0] = new TGNumberEntry(fH1, (int)defval, (int)format[0], 999, numtype, negpos, numlim); |
||
739 | } |
||
740 | else if( (((int)format[1] > 0) && ((int)format[1] < 5)) || ((int)format[1] == -1) ) |
||
741 | { |
||
742 | if( arelimits[0] && arelimits[1] ) |
||
743 | widgetNE[0] = new TGNumberEntry(fH1, defval, (int)format[0], 999, numtype, negpos, numlim, format[4], format[5]); |
||
744 | else if( arelimits[0] ) |
||
745 | widgetNE[0] = new TGNumberEntry(fH1, defval, (int)format[0], 999, numtype, negpos, numlim, format[4], 0); |
||
746 | else if( arelimits[1] ) |
||
747 | widgetNE[0] = new TGNumberEntry(fH1, defval, (int)format[0], 999, numtype, negpos, numlim, 0, format[4]); |
||
748 | else |
||
749 | widgetNE[0] = new TGNumberEntry(fH1, defval, (int)format[0], 999, numtype, negpos, numlim); |
||
750 | } |
||
751 | else |
||
752 | { |
||
753 | delete outsidebox; |
||
754 | delete lab; |
||
755 | return false; |
||
756 | } |
||
757 | fH1->AddFrame(widgetNE[0], f1); |
||
758 | outsidebox->AddFrame(fH1, f2); |
||
759 | |||
760 | if(DBGSIG > 1) printf("id = %d\n",id); |
||
761 | |||
762 | return true; |
||
763 | } |
||
764 | |||
765 | // Widget with checkbutton and text entry |
||
766 | bool TSubStructure::TGCheckTEntry(TGWindow *parent, int w, int h, const char *label, int onoff, const char *deftext, const char *layout) |
||
767 | { |
||
768 | id = 13; |
||
769 | |||
770 | f0 = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,2,2,2,2); |
||
771 | |||
772 | if(strcmp("oneline", layout) == 0) |
||
773 | { |
||
774 | outsidebox = new TGCompositeFrame(parent, w-6, h, kHorizontalFrame | kFixedWidth); |
||
775 | if(DBGSIG > 1) outsidebox->SetBackgroundColor(0); |
||
776 | f0expandX = new TGLayoutHints(kLHintsExpandX | kLHintsCenterY,6,2,2,2); |
||
777 | } |
||
778 | else if(strcmp("twoline", layout) == 0) |
||
779 | { |
||
780 | outsidebox = new TGCompositeFrame(parent, w-6, h, kVerticalFrame | kFixedWidth); |
||
781 | if(DBGSIG > 1) outsidebox->SetBackgroundColor(0); |
||
782 | f0expandX = new TGLayoutHints(kLHintsExpandX | kLHintsCenterY,0,2,2,2); |
||
783 | } |
||
784 | |||
785 | widgetChBox[0] = new TGCheckButton(outsidebox, label); |
||
786 | if(onoff == 0) |
||
787 | widgetChBox[0]->SetState(kButtonUp); |
||
788 | else if(onoff == 1) |
||
789 | widgetChBox[0]->SetState(kButtonDown); |
||
790 | outsidebox->AddFrame(widgetChBox[0], f0); |
||
791 | widgetTE = new TGTextEntry(outsidebox, deftext); |
||
792 | outsidebox->AddFrame(widgetTE, f0expandX); |
||
793 | |||
794 | if(DBGSIG > 1) printf("id = %d\n",id); |
||
795 | |||
796 | return true; |
||
797 | } |