Overture  Version 25
DialogData.h
Go to the documentation of this file.
1 #ifndef DIALOG_DATA_H
2 #define DIALOG_DATA_H
3 
4 #ifndef NO_APP
5 #include "OvertureTypes.h"
6 #endif
7 #include "GUITypes.h"
8 
9 
11 
13 {
18 };
19 
20 struct PushButton
21 {
22 // buttonCommand holds the name of the command and
23 // buttonLabel holds the label that will appear on the button.
24  PushButton(){pb=NULL;sensitive=true;} // *wdh*
25  void setSensitive(bool trueOrFalse); // *wdh*
26 
29  bool sensitive; // *wdh*
30  void *pb; // widget
31 };
32 
34 {
35  ToggleButton(){tb=NULL; sensitive=true; state=0;} // *wdh*
36  int setState(bool trueOrFalse ); // *wdh*
37  void setSensitive(bool trueOrFalse); // *wdh*
38 
39 // buttonCommand holds the name of the command and
40 // buttonLabel holds the label that will appear on the button.
43  int state;
44  bool sensitive; // *wdh*
45  void *tb; // widget
46 };
47 
48 struct TextLabel
49 {
50 // textCommand holds the name of the command and
51 // textLabel holds the label that will appear in front of the editable text.
52 // string holds the editable string.
53 // textWidget holds a pointer to the editable text widget, which makes it possible to change the text
54 // without typing in the dialog window. This might be useful for correcting typos, for example.
56  void setSensitive(bool trueOrFalse); // *wdh*
57 
61  bool sensitive; // *wdh*
62  void *textWidget; // Widget
63  void *labelWidget; // Widget
64 };
65 
66 struct OptionMenu
67 {
69  int setCurrentChoice(int command); // *wdh*
70  int setCurrentChoice(const aString & label); // *wdh*
71  void setSensitive(bool trueOrFalse); // *wdh*
72  void setSensitive(int btn, bool trueOrFalse); // set the sensitivity of one push button
73 
75  int n_options;
78  bool sensitive; // *wdh*
79  void *menupane; // widget
80  void *menuframe; // widget
81 };
82 
83 class RadioBox
84 {
85 public:
87  bool setCurrentChoice(int command);
88  void setSensitive(bool trueOrFalse); // set the sensitivity of the entire radio box widget
89  void setSensitive(int btn, bool trueOrFalse); // set the sensitivity of one toggle button
90 
92  int n_options;
96  bool sensitive;
97  int columns;
98  void *radioBox; // widget
99 };
100 
102 {
103 public:
104 PullDownMenu(); // default constructor
105 ~PullDownMenu();
106 // set all fields except the menupane in a PullDownMenu
107 bool setPullDownMenu(const aString &pdMainLabel, const aString commands[], const aString labels[], button_type bt,
108  int *initState /* = NULL */);
109 // set the state of a toggle button
110 int setToggleState(int n, bool trueOrFalse ); // *wdh*
111 void setSensitive(bool trueOrFalse); // *wdh*
112 
118 bool sensitive; // *wdh*
119 void *menupane; // widget
120 };
121 
123 {
124 public:
125 InfoLabel(){labelWidget=NULL;} // default constructor
126 // textLabel holds the label that will appear in the window
127 // labelWidget holds a pointer to the label widget, which makes it possible to change the text
129  void *labelWidget; // Widget
130 };
131 
132 // can't have more than 10 option menus, 6 pull-down menus, 15 radio boxes, 10 info labels
134 
136 {
137 public:
138  enum WidgetTypeEnum // *wdh*
139  {
146  };
147 
149 {
153 };
154 
155 DialogData(); // default constructor. Not normally called by the user
156 ~DialogData(); // destructor
157 
158 void
159 openDialog(int managed = 1);
160 
161 int
162 dialogCommands(aString **commands);
163 
164 // parse an answer for a possible change to a toggle value
165 bool
166 getToggleValue( const aString & answer, const aString & label, bool & target );
167 // This version is for an int target :
168 bool
169 getToggleValue( const aString & answer, const aString & label, int & target );
170 
171 // parse an answer for a possible change to a text box
172 bool
173 getTextValue( const aString & answer, const aString & label, const aString & format, GUITypes::real & target );
174 bool
175 getTextValue( const aString & answer, const aString & label, const aString & format, int & target );
176 bool
177 getTextValue( const aString & answer, const aString & label, const aString & format, aString & target );
178 
179 int
180 showSibling(); // display a sibling on the screen
181 
182 int
183 hideSibling(); // remove a sibling from the screen
184 
185 void
186 setSensitive(int trueFalse);
187 
188 void
189 setSensitive(bool trueOrFalse, WidgetTypeEnum widgetType, int number ); // *wdh*
190 void
191 setSensitive(bool trueOrFalse, WidgetTypeEnum widgetType, const aString & label); // *wdh*
192 
193 int
194 addOptionMenu(const aString &opMainLabel, const aString opCommands[], const aString opLabels[], int initCommand);
195 
196 bool
197 addRadioBox(const aString &rbMainLabel, const aString rbCommands[], const aString rbLabels[], int initCommand,
198  int columns = 1);
199 
200 RadioBox&
201 getRadioBox(int n);
202 
203 RadioBox&
204 getRadioBox(const aString & radioLabel);
205 
206 bool
207 changeOptionMenu(int nOption, const aString opCommands[], const aString opLabels[], int initCommand);
208 
209 bool
210 changeOptionMenu(const aString & opMainLabel, const aString opCommands[], const aString opLabels[], int initCommand);
211 
212 int
214 
215 int
216 addPulldownMenu(const aString &pdMainLabel, const aString commands[], const aString labels[], button_type bt,
217  int *initState = NULL);
218 
219 int
220 setToggleButtons(const aString tbCommands[], const aString tbLabels[], const int initState[],
221  int numberOfColumns = 2);
222 
223 int
225 
226 int
227 setPushButtons(const aString pbCommands[], const aString pbLabels[], int numberOfRows = 2);
228 
229 int
230 setTextBoxes(const aString textCommands[], const aString textLabels[], const aString initString[]);
231 
232 int
233 setTextLabel(int n, const aString &buff);
234 
235 int
236 setTextLabel(const aString & textLabel, const aString &buff); // set the text box with label "textLabel"
237 
238 int
239 setToggleState(int n, int trueFalse);
240 
241 int
242 setToggleState(const aString & toggleButtonLabel, int trueFalse); // set toggle state with given label
243 
244 int
245 setExitCommand(const aString &exitC, const aString &exitL);
246 
247 void
248 setWindowTitle(const aString &title);
249 
250 void
251 setOptionMenuColumns(int columns);
252 
253 void
254 setLastPullDownIsHelp(int trueFalse);
255 
257 getPulldownMenu(int n);
258 
260 getPulldownMenu(const aString & label);
261 
262 OptionMenu&
263 getOptionMenu(int n); // *wdh*
264 
265 OptionMenu&
266 getOptionMenu(const aString & opMainLabel); // find the option menu with this label
267 
268 void
269 closeDialog();
270 
271 void *
272 getWidget();
273 
274 aString &
276 
277 void
279 
280 int
282 
283 void
285 
286 int
287 addInfoLabel(const aString &textLabel);
288 
289 int
291 
292 bool
293 setInfoLabel(int n, const aString &buff);
294 
295 protected:
296 void *dialogWindow; // Widget
297 
302 
303 int builtInDialog; // = 1 if this dialog is parsed inside processSpecialMenuItems, otherwise = 0.
304 // If builtInDialog == 1, the associated callback functions will return a negative number instead
305 // of a positive number, which is used for user defined commands.
306 
307 int pButtonRows; // pack the pButtons into this many rows
309 PushButton *pButtons; // array of buttonDefs
310 
313 ToggleButton *tButtons; // array of buttonDefs
314 
315 int n_text;
317 
320 
324 
327 
330 
331 DialogData(DialogData &source); // copy constructor disabled since it never gets defined
332 void operator =(DialogData &source); // assignment operator disabled since it never gets defined
333 
335 };
336 
337 
338 class PickInfo
339 {
340 public:
341 
342 PickInfo(); // default constructor
343 
346 GUITypes::real pickBox[4]; // xmin, xmax, ymin, ymax
347 };
348 
349 #endif