20 #include <Xm/MenuShell.h>
21 #include <Xm/RowColumn.h>
22 #include <Xm/ToggleB.h>
36 int x_for_position_of_menu;
39 x_for_position_of_menu = 10;
41 optionMenu_shell = XtVaCreatePopupShell (
"optionMenu shell",
42 xmMenuShellWidgetClass,
46 XmNallowShellResize,
true,
47 XmNoverrideRedirect,
true,
51 optionMenu = XtVaCreateWidget(
"optionMenu_p1",
52 xmRowColumnWidgetClass,
54 XmNrowColumnType, XmMENU_PULLDOWN,
59 args.
add(XmNfontList, (XtArgVal)
p_global->fontlist);
64 int width_help_label, height_help_label;
65 calculate_label_size(&width_help_label, &height_help_label,
false);
67 #if defined(DUMP_BUTTON_CREATION)
68 printf(
"width_help_label=%i height_help_label=%i label='%s'\n", width_help_label, height_help_label, _at->
label_for_inputfield);
69 #endif // DUMP_BUTTON_CREATION
75 optionMenu1 = XtVaCreateManagedWidget(
"optionMenu1",
76 xmRowColumnWidgetClass,
78 XmNrowColumnType, XmMENU_OPTION,
79 XmNsubMenuId, optionMenu,
88 optionMenu1 = XtVaCreateManagedWidget(
"optionMenu1",
89 xmRowColumnWidgetClass,
91 XmNrowColumnType, XmMENU_OPTION,
92 XmNsubMenuId, optionMenu,
102 XtVaSetValues(optionMenu1,
122 p_global->last_option_menu->next = next;
135 return p_global->current_option_menu;
140 XtDestroyWidget(os->
widget);
144 p_global->current_option_menu = oms;
170 entry = XtVaCreateManagedWidget(
"optionMenu_entry",
171 xmPushButtonWidgetClass,
178 return (
void *)entry;
182 if (default_option) {
196 void AW_window::insert_option_internal(
AW_label option_name,
const char *
mnemonic,
const char *var_value,
const char *name_of_color,
bool default_option) {
208 XtAddCallback(entry, XmNactivateCallback,
217 void AW_window::insert_option_internal(
AW_label option_name,
const char *mnemonic,
int var_value,
const char *name_of_color,
bool default_option) {
229 XtAddCallback(entry, XmNactivateCallback,
230 (XtCallbackProc) AW_variable_update_callback,
238 void AW_window::insert_option_internal(
AW_label option_name,
const char *mnemonic,
float var_value,
const char *name_of_color,
bool default_option) {
250 XtAddCallback(entry, XmNactivateCallback,
251 (XtCallbackProc) AW_variable_update_callback,
260 void AW_window::insert_option (
const char *on,
const char *mn,
const char *vv,
const char *noc) { insert_option_internal(on, mn, vv, noc,
false); }
262 void AW_window::insert_option (
const char *on,
const char *mn,
int vv,
const char *noc) { insert_option_internal(on, mn, vv, noc,
false); }
264 void AW_window::insert_option (
const char *on,
const char *mn,
float vv,
const char *noc) { insert_option_internal(on, mn, vv, noc,
false); }
276 XtVaGetValues(oms->
label_widget, XmNwidth, &width, XmNheight, &height,
NULp);
277 int width_of_last_widget = width;
278 int height_of_last_widget = height;
286 width_of_last_widget = width_of_last_widget / 2;
290 width_of_last_widget = 0;
305 while (active_choice && global_var_value != active_choice->
value) {
306 active_choice = active_choice->
next;
339 int xoff_for_label = 0;
340 int width_of_label = 0;
341 int x_for_position_of_option = 0;
345 x_for_position_of_option = 10;
353 calculate_label_size(&width_of_label, &height_of_label,
true);
357 label_for_toggle = XtVaCreateManagedWidget(
"label",
361 XmNy, (
int)(_at->
y_for_next_button) + this->get_root()->y_correction_for_input_labels,
362 XmNwidth, (
int)(width_of_label + 2),
364 XmNrecomputeSize,
false,
365 XmNalignment, XmALIGNMENT_BEGINNING,
380 args.
add(XmNx, x_for_position_of_option + xoff_for_label);
382 args.
add(XmNradioBehavior, True);
383 args.
add(XmNradioAlwaysOne, True);
384 args.
add(XmNfontList, (XtArgVal)
p_global->fontlist);
385 args.
add(XmNorientation, orientation ==
AW_HORIZONTAL ? XmHORIZONTAL : XmVERTICAL);
417 const char *labeltext,
const char *mnemonic,
423 Widget toggleButton = XtVaCreateManagedWidget(
"toggleButton",
424 xmToggleButtonWidgetClass,
428 XmNindicatorSize, 16,
432 toggle->
widget = toggleButton;
434 XtAddCallback(toggleButton, XmNvalueChangedCallback,
435 (XtCallbackProc) AW_variable_update_callback,
437 if (default_toggle) {
438 delete p_global->last_toggle_field->default_toggle;
439 p_global->last_toggle_field->default_toggle = toggle;
442 if (
p_global->last_toggle_field->first_toggle) {
443 p_global->last_toggle_field->last_toggle->next = toggle;
444 p_global->last_toggle_field->last_toggle = toggle;
447 p_global->last_toggle_field->last_toggle = toggle;
448 p_global->last_toggle_field->first_toggle = toggle;
458 void AW_window::insert_toggle_internal(
AW_label toggle_label,
const char *mnemonic,
const char *var_value,
bool default_toggle) {
469 void AW_window::insert_toggle_internal(
AW_label toggle_label,
const char *mnemonic,
int var_value,
bool default_toggle) {
480 void AW_window::insert_toggle_internal(
AW_label toggle_label,
const char *mnemonic,
float var_value,
bool default_toggle) {
493 void AW_window::insert_toggle (
const char *toggle_label,
const char *mnemonic,
const char *var_value) { insert_toggle_internal(toggle_label, mnemonic, var_value,
false); }
494 void AW_window::insert_default_toggle(
const char *toggle_label,
const char *mnemonic,
const char *var_value) { insert_toggle_internal(toggle_label, mnemonic, var_value,
true); }
495 void AW_window::insert_toggle (
const char *toggle_label,
const char *mnemonic,
int var_value) { insert_toggle_internal(toggle_label, mnemonic, var_value,
false); }
497 void AW_window::insert_toggle (
const char *toggle_label,
const char *mnemonic,
float var_value) { insert_toggle_internal(toggle_label, mnemonic, var_value,
false); }
498 void AW_window::insert_default_toggle(
const char *toggle_label,
const char *mnemonic,
float var_value) { insert_toggle_internal(toggle_label, mnemonic, var_value,
true); }
507 static int inside_here = 0;
514 while (toggle_field_list) {
518 toggle_field_list = toggle_field_list->
next;
522 if (toggle_field_list) {
526 while (active_toggle && active_toggle->
value != global_value) {
527 active_toggle = active_toggle->
next;
529 if (!active_toggle) active_toggle = toggle_field_list->
default_toggle;
534 XmToggleButtonSetState(toggle->widget, toggle == active_toggle, False);
536 if (toggle->next) toggle = toggle->next;
548 int width_of_last_widget = length;
549 int height_of_last_widget = height;
557 width_of_last_widget = width_of_last_widget / 2;
564 width_of_last_widget = 0;
573 GBK_terminatef(
"update_toggle_field: toggle field %i does not exist", toggle_field_number);
void TuneBackground(Widget w, int modStrength)
AW_widget_value_pair * first_toggle
AW_VARIABLE_TYPE toggle_field_var_type
void insert_option(AW_label choice_label, const char *mnemonic, const char *var_value, const char *name_of_color=NULp)
void refresh_option_menu(AW_option_menu_struct *)
void insert_toggle(AW_label toggle_label, const char *mnemonic, const char *var_value)
__ATTR__NORETURN void toggle_type_mismatch(const char *triedType)
static Widget _aw_create_toggle_entry(AW_window *aww, Widget toggle_field, const char *labeltext, const char *mnemonic, VarUpdateInfo *awus, AW_widget_value_pair *toggle, bool default_toggle)
bool remove_button_from_sens_list(Widget button)
__ATTR__NORETURN void option_type_mismatch(const char *triedType)
AW_VARIABLE_TYPE variable_type
void GBK_terminatef(const char *templat,...)
int correct_for_at_center_intern
void update_option_menu()
void update_toggle_field()
bool AW_IS_IMAGEREF(const char *label)
short saved_xoff_for_label
void create_toggle_field(const char *awar_name, AW_label label, AW_orientation orientation=AW_VERTICAL)
#define RES_LABEL_CONVERT(label)
char * toggle_field_var_name
void increment_at_commands(int width, int height)
void assign_to_widget(Widget w)
int number_of_option_menus
AW_toggle_field_struct * next
void * _create_option_entry(AW_VARIABLE_TYPE type, const char *name, const char *mnemonic, const char *name_of_color)
void label(const char *label)
GB_write_int const char GB_write_autoconv_string WRITE_SKELETON(write_pointer, GBDATA *,"%p", GB_write_pointer) char *AW_awa if)(!gb_var) return strdup("")
void TuneOrSetBackground(Widget w, const char *color, int modStrength)
void refresh_toggle_field(int toggle_field_number)
AW_awar * awar(const char *awar)
void clear_option_menu(AW_option_menu_struct *oms)
void insert_default_option(AW_label choice_label, const char *mnemonic, const char *var_value, const char *name_of_color=NULp)
#define RES_CONVERT(res_name, res_value)
unsigned long int background_color
#define IF_ASSERTION_USED(x)
__ATTR__NORETURN void type_mismatch(const char *triedType, const char *intoWhat)
void make_sensitive(Widget w, AW_active mask)
void option_menu_add_option(AW_option_menu_struct *oms, AW_widget_value_pair *os, bool default_option)
AW_option_menu_struct * create_option_menu(const char *awar_name)
void insert_default_toggle(AW_label toggle_label, const char *mnemonic, const char *var_value)
static void remove_option_from_option_menu(AW_root *aw_root, AW_widget_value_pair *os)
char * label_for_inputfield
void AW_label_in_awar_list(AW_window *aww, Widget widget, const char *str)
#define SPACE_BEHIND_BUTTON
void set_widget(Widget w)
void add(String name, XtArgVal value)
int number_of_toggle_fields
int correct_for_at_center
struct _WidgetRec * Widget
void tie_widget(AW_CL cd1, Widget widget, AW_widget_type type, AW_window *aww)
AW_widget_value_pair * default_toggle