38#include <Xm/ToggleB.h>
39#include <Xm/ArrowBG.h>
40#include <Xm/RowColumn.h>
42#include <Xm/Separator.h>
50 XtCallbackRec** arrow_callbacks,
51 Widget* parent_widget) {
53 Widget arrow_form = XtVaCreateWidget
58 XtNvisual, pView->
vi->visual,
59 XtNdepth, pView->
vi->depth,
60 XtNcolormap, pView->
cmap,
61 XtNborderColor, pView->
borcol,
62 XtNbackground, pView->
bgnd,
65 Widget arrow = XtVaCreateManagedWidget
67 xmArrowButtonGadgetClass,
69 XmNtopAttachment, XmATTACH_POSITION,
71 XmNbottomAttachment, XmATTACH_POSITION,
73 XmNleftAttachment, XmATTACH_POSITION,
75 XmNrightAttachment, XmATTACH_POSITION,
77 XmNarrowDirection, XmARROW_UP,
84 XtAddCallbacks (arrow,
88 XtAddCallbacks (arrow,
92 XtAddCallbacks (arrow,
96 arrow = XtVaCreateManagedWidget
98 xmArrowButtonGadgetClass,
100 XmNtopAttachment, XmATTACH_POSITION,
102 XmNbottomAttachment, XmATTACH_POSITION,
103 XmNbottomPosition, 3,
104 XmNleftAttachment, XmATTACH_POSITION,
106 XmNrightAttachment, XmATTACH_POSITION,
108 XmNarrowDirection, XmARROW_DOWN,
111 XtVaSetValues (arrow,
115 XtAddCallbacks (arrow,
119 XtAddCallbacks (arrow,
123 XtAddCallbacks (arrow,
127 arrow = XtVaCreateManagedWidget
129 xmArrowButtonGadgetClass,
131 XmNtopAttachment, XmATTACH_POSITION,
133 XmNbottomAttachment, XmATTACH_POSITION,
134 XmNbottomPosition, 2,
135 XmNleftAttachment, XmATTACH_POSITION,
137 XmNrightAttachment, XmATTACH_POSITION,
139 XmNarrowDirection, XmARROW_LEFT,
142 XtVaSetValues (arrow,
146 XtAddCallbacks (arrow,
150 XtAddCallbacks (arrow,
154 XtAddCallbacks (arrow,
158 arrow = XtVaCreateManagedWidget
160 xmArrowButtonGadgetClass,
162 XmNtopAttachment, XmATTACH_POSITION,
164 XmNbottomAttachment, XmATTACH_POSITION,
165 XmNbottomPosition, 2,
166 XmNleftAttachment, XmATTACH_POSITION,
168 XmNrightAttachment, XmATTACH_POSITION,
170 XmNarrowDirection, XmARROW_RIGHT,
173 XtVaSetValues (arrow,
177 XtAddCallbacks (arrow,
181 XtAddCallbacks (arrow,
185 XtAddCallbacks (arrow,
189 XtManageChild (arrow_form);
194 Widget* parent_widget,
195 XtCallbackRec* radio_box_callback,
197 G4int default_button,
198 char* radio_box_name,
202 XmString button_str = XmStringCreateLocalized((
char*)
e_str.c_str());
205 args =
new Arg* [num_buttons];
209 for (i = 0; i < num_buttons; i++) {
211 args[i] =
new Arg[7];
212 button_str = XmStringCreateLocalized (button_names[i]);
214 XtSetArg (args[i][0], XtNvisual, pView->
vi->visual);
215 XtSetArg (args[i][1], XtNdepth, pView->
vi->depth);
216 XtSetArg (args[i][2], XtNcolormap, pView->
cmap);
217 XtSetArg (args[i][3], XtNborderColor, pView->
borcol);
218 XtSetArg (args[i][4], XtNbackground, pView->
bgnd);
219 XtSetArg (args[i][5], XmNlabelString, button_str);
221 if (i == default_button) {
222 XtSetArg (args[i][6], XmNset, True);
224 XtSetArg (args[i][6], XmNset, False);
228 Widget radio_box = XtVaCreateWidget (radio_box_name,
229 xmRowColumnWidgetClass,
231 XmNisHomogeneous, False,
232 XmNradioBehavior, True,
233 XmNradioAlwaysOne, True,
235 XtNvisual, pView->
vi->visual,
236 XtNdepth, pView->
vi->depth,
237 XtNcolormap, pView->
cmap,
238 XtNborderColor, pView->
borcol,
239 XtNbackground, pView->
bgnd,
242 XmString lab = XmStringCreateLocalized (label_string);
259 for (i = 0; i < num_buttons; i++) {
260 button = XtCreateManagedWidget (button_names[i],
261 xmToggleButtonWidgetClass,
265 XtVaSetValues (button,
269 XtAddCallbacks (button,
274 XtManageChild (radio_box);
276 XmStringFree (button_str);
278 for (i = 0; i < num_buttons; i++) {
295 char local_w_text[50];
296 strcpy (local_w_text, w_text);
299 strcpy (label_name, w_name);
300 strcat (label_name,
"_label");
302 char text_field_name[50];
303 strcpy (text_field_name, w_name);
304 strcat (text_field_name,
"_text_field");
306 XmString local_text = XmStringCreateLocalized (local_w_text);
320 XmStringFree (local_text);
325 *wid = XtVaCreateManagedWidget (text_field_name,
326 xmTextFieldWidgetClass,
329 XtNvisual, pView->
vi->visual,
330 XtNdepth, pView->
vi->depth,
331 XtNcolormap, pView->
cmap,
332 XtNborderColor, pView->
borcol,
333 XtNbackground, pView->
bgnd,
337 XmNvalueChangedCallback,
367 XtVaCreateManagedWidget (
"sep",
368 xmSeparatorWidgetClass,
370 XmNseparatorType, XmNO_LINE,
372 XmNorientation, XmHORIZONTAL,
373 XtNvisual, pView->
vi->visual,
374 XtNdepth, pView->
vi->depth,
375 XtNcolormap, pView->
cmap,
376 XtNborderColor, pView->
borcol,
377 XtNbackground, pView->
bgnd,
390 unsigned char* orientation,
391 unsigned char* direction,
392 XtCallbackRec** slider_box_callbacks,
393 Widget* parent_widget)
395 XmString slider_name_str = XmStringCreateLocalized((
char*)
e_str.c_str());
398 slider_args =
new Arg*[num_sliders];
403 for (i = 0; i < num_sliders; i++) {
405 slider_args[i] =
new Arg[13];
406 slider_name_str = XmStringCreateLtoR (slider_names[i],
407 XmFONTLIST_DEFAULT_TAG);
409 XtSetArg (slider_args[i][j],
410 XtNvisual, pView->
vi->visual); j++;
411 XtSetArg (slider_args[i][j],
412 XtNdepth, pView->
vi->depth); j++;
413 XtSetArg (slider_args[i][j],
414 XtNcolormap, pView->
cmap); j++;
415 XtSetArg (slider_args[i][j],
416 XtNborderColor, pView->
borcol); j++;
417 XtSetArg (slider_args[i][j],
418 XtNbackground, pView->
bgnd); j++;
420 XtSetArg (slider_args[i][j],
421 XmNtitleString, slider_name_str); j++;
423 XtSetArg (slider_args[i][j],
424 XmNmaximum,
G4int(max_array[i] * std::pow(10.0, (
G4double)decimals[i]))); j++;
425 XtSetArg (slider_args[i][j],
426 XmNminimum,
G4int(min_array[i] * std::pow(10.0, (
G4double)decimals[i]))); j++;
427 XtSetArg (slider_args[i][j],
428 XmNvalue,
G4int(value_array[i] * std::pow(10.0, (
G4double)decimals[i]))); j++;
429 XtSetArg (slider_args[i][j],
430 XmNshowValue, show[i]); j++;
431 XtSetArg (slider_args[i][j],
432 XmNdecimalPoints, decimals[i]); j++;
434 XtSetArg (slider_args[i][j],
435 XmNorientation, orientation[i]); j++;
436 XtSetArg (slider_args[i][j],
437 XmNprocessingDirection, direction[i]); j++;
441 Widget slider_box = XtVaCreateWidget (
"slider_box",
442 xmRowColumnWidgetClass,
444 XmNisHomogeneous, False,
445 XtNvisual, pView->
vi->visual,
446 XtNdepth, pView->
vi->depth,
447 XtNcolormap, pView->
cmap,
448 XtNborderColor, pView->
borcol,
449 XtNbackground, pView->
bgnd,
452 XmString lab = XmStringCreateLocalized (label_string);
469 for (i = 0; i < num_sliders; i++) {
471 slider = XtCreateManagedWidget (slider_names[i],
477 XtAddCallbacks (slider,
478 XmNvalueChangedCallback,
479 slider_box_callbacks[i]);
481 XtAddCallbacks (slider,
483 slider_box_callbacks[i]);
487 XtManageChild (slider_box);
488 XmStringFree (slider_name_str);
490 for (i = 0; i < num_sliders; i++) {
492 delete[] slider_args[i];
496 delete[] slider_args;
501 XtPointer clientData,
512 std::istringstream iss(
string);
517 XtPointer clientData,
520 char* txt = (
char*)clientData;
533 XtVaGetValues (w,XmNuserData,&userData,NULL);
534 return (
G4bool)(((
unsigned long)userData)&0xffff);
540 XtVaGetValues (w,XmNuserData,&userData,NULL);
541 return (
G4int)(
unsigned long)userData;
const G4DNABoundingBox initial
static void Add_set_field(char *widget, char *widget_text, Widget *row_col_box, Widget *wid, G4double *val, G4OpenGLXmViewer *pView)
static G4bool get_boolean_userData(Widget w)
static G4int get_int_userData(Widget w)
static const G4String e_str
static void Add_four_arrow_buttons(G4OpenGLXmViewer *pView, XtCallbackRec **arrow_callbacks, Widget *parent_widget)
static void Add_radio_box(char *label_string, Widget *parent_frame_widget, XtCallbackRec *radio_box_cb, G4int num_buttons, G4int default_button, char *radio_box_name, char **button_names, G4OpenGLXmViewer *pView)
static void get_double_value_callback(Widget w, XtPointer clientData, XtPointer callData)
static void Add_slider_box(char *label_string, G4int num_sliders, char **slider_name, G4OpenGLXmViewer *pView, G4double *min_array, G4double *max_array, G4double *value_array, G4bool *show, short *decimals, unsigned char *orientation, unsigned char *direction, XtCallbackRec **slider_box_cb, Widget *parent_frame_widget)
static void get_text_callback(Widget w, XtPointer clientData, XtPointer callData)