Changeset 6675 for trunk/WINDOW/AW_button.cxx
- Timestamp:
- 02/06/10 09:01:31 (2 years ago)
- Files:
-
- 1 modified
-
trunk/WINDOW/AW_button.cxx (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WINDOW/AW_button.cxx
r6584 r6675 15 15 #include "aw_size.hxx" 16 16 #include "aw_select.hxx" 17 #include "aw_ awar.hxx"17 #include "aw_nawar.hxx" 18 18 #include "aw_window_Xm.hxx" 19 19 … … 39 39 #endif // DEBUG 40 40 41 static void aw_cp_awar_2_widget_cb(AW_root *root, AW_widget_list_for_variable *widgetlist) { 42 if (widgetlist->widget == (int *)root->changer_of_variable) { 41 struct AW_widget_refresh_cb { 42 AW_widget_refresh_cb(AW_widget_refresh_cb *previous, AW_awar *vs, AW_CL cd1, Widget w, AW_widget_type type, AW_window *awi); 43 ~AW_widget_refresh_cb(); 44 45 AW_CL cd; 46 AW_awar *awar; 47 Widget widget; 48 AW_widget_type widget_type; 49 AW_window *aw; 50 51 AW_widget_refresh_cb *next; 52 }; 53 54 static void aw_cp_awar_2_widget_cb(AW_root *root, AW_CL cl_widget_refresh_cb) { 55 AW_widget_refresh_cb *widgetlist = (AW_widget_refresh_cb*)cl_widget_refresh_cb; 56 if (widgetlist->widget == root->changer_of_variable) { 43 57 root->changer_of_variable = 0; 44 58 root->value_changed = false; … … 81 95 } 82 96 83 84 AW_widget_list_for_variable::AW_widget_list_for_variable(AW_awar *vs, AW_CL cd1, int *widgeti, AW_widget_type type, AW_window *awi) { 97 AW_widget_refresh_cb::AW_widget_refresh_cb(AW_widget_refresh_cb *previous, AW_awar *vs, AW_CL cd1, Widget w, AW_widget_type type, AW_window *awi) { 85 98 cd = cd1; 86 widget = w idgeti;99 widget = w; 87 100 widget_type = type; 88 101 awar = vs; 89 102 aw = awi; 90 next = 0; 91 awar->add_callback((AW_RCB1)aw_cp_awar_2_widget_cb, (AW_CL)this); 92 } 103 next = previous; 104 105 awar->add_callback(aw_cp_awar_2_widget_cb, (AW_CL)this); 106 } 107 108 AW_widget_refresh_cb::~AW_widget_refresh_cb() { 109 if (next) delete next; 110 awar->remove_callback(aw_cp_awar_2_widget_cb, (AW_CL)this); 111 } 112 113 void AW_awar::tie_widget(AW_CL cd1, Widget widget, AW_widget_type type, AW_window *aww) { 114 refresh_list = new AW_widget_refresh_cb(refresh_list, this, cd1, widget, type, aww); 115 } 116 void AW_awar::untie_all_widgets() { 117 delete refresh_list; refresh_list = NULL; 118 } 119 93 120 94 121 struct AW_variable_update_struct { // used to refresh single items on change … … 139 166 140 167 if (root->value_changed) { 141 root->changer_of_variable = (long)vus->widget;168 root->changer_of_variable = vus->widget; 142 169 } 143 170 … … 847 874 } 848 875 849 void AW_window::update_label(int *widget, const char *var_value) { 850 Widget w = (Widget) widget; 851 852 if (get_root()->changer_of_variable != (long)widget) { 853 XtVaSetValues(w, RES_CONVERT(XmNlabelString, var_value), NULL); 876 void AW_window::update_label(Widget widget, const char *var_value) { 877 if (get_root()->changer_of_variable != widget) { 878 XtVaSetValues(widget, RES_CONVERT(XmNlabelString, var_value), NULL); 854 879 } 855 880 else { … … 867 892 }; 868 893 869 void AW_window::update_toggle(int *wgt, const char *var, AW_CL cd_toggle_data) 870 { 894 void AW_window::update_toggle(Widget widget, const char *var, AW_CL cd_toggle_data) { 871 895 aw_toggle_data *tdata = (aw_toggle_data*)cd_toggle_data; 872 896 const char *text = tdata->bitmapOrText[(var[0] == '0' || var[0] == 'n') ? 0 : 1]; 873 897 874 898 if (tdata->isTextToggle) { 875 XtVaSetValues( (Widget)wgt, RES_CONVERT(XmNlabelString, text), NULL);899 XtVaSetValues(widget, RES_CONVERT(XmNlabelString, text), NULL); 876 900 } 877 901 else { 878 902 char *path = pixmapPath(text+1); 879 XtVaSetValues( (Widget)wgt, RES_CONVERT(XmNlabelPixmap, path), NULL);903 XtVaSetValues(widget, RES_CONVERT(XmNlabelPixmap, path), NULL); 880 904 free(path); 881 905 } … … 913 937 char *var_value = vs->read_as_string(); 914 938 915 this->update_toggle( (int*)p_w->toggle_field, var_value, (AW_CL)tdata);939 this->update_toggle(p_w->toggle_field, var_value, (AW_CL)tdata); 916 940 free(var_value); 917 941 } … … 924 948 (XtPointer) vus); 925 949 926 AW_INSERT_BUTTON_IN_AWAR_LIST(vs,(AW_CL)tdata, p_w->toggle_field, AW_WIDGET_TOGGLE, this);950 vs->tie_widget((AW_CL)tdata, p_w->toggle_field, AW_WIDGET_TOGGLE, this); 927 951 } 928 952 … … 1060 1084 (XtPointer) root); 1061 1085 1062 AW_INSERT_BUTTON_IN_AWAR_LIST(vs,0, textField, AW_WIDGET_INPUT_FIELD, this);1086 vs->tie_widget(0, textField, AW_WIDGET_INPUT_FIELD, this); 1063 1087 root->make_sensitive(textField, _at->widget_mask); 1064 1088 … … 1088 1112 } 1089 1113 1090 1091 void AW_window::update_input_field(int *widget, const char *var_value) { 1092 Widget w = (Widget) widget; 1093 1094 XtVaSetValues(w, XmNvalue, var_value, NULL); 1095 } 1096 1097 1098 1114 void AW_window::update_input_field(Widget widget, const char *var_value) { 1115 XtVaSetValues(widget, XmNvalue, var_value, NULL); 1116 } 1099 1117 1100 1118 void AW_window::create_text_field(const char *var_name, int columns, int rows) { … … 1224 1242 XtAddCallback(scrolledText, XmNvalueChangedCallback, (XtCallbackProc) AW_value_changed_callback, (XtPointer) root); 1225 1243 1226 AW_INSERT_BUTTON_IN_AWAR_LIST(vs,0, scrolledText, AW_WIDGET_TEXT_FIELD, this);1244 vs->tie_widget(0, scrolledText, AW_WIDGET_TEXT_FIELD, this); 1227 1245 root->make_sensitive(scrolledText, _at->widget_mask); 1228 1246 … … 1232 1250 1233 1251 1234 void AW_window::update_text_field(int *widget, const char *var_value) { 1235 Widget w = (Widget) widget; 1236 1237 XtVaSetValues(w, XmNvalue, var_value, NULL); 1252 void AW_window::update_text_field(Widget widget, const char *var_value) { 1253 XtVaSetValues(widget, XmNvalue, var_value, NULL); 1238 1254 } 1239 1255 … … 1399 1415 (XtPointer) _d_callback); 1400 1416 } 1401 AW_INSERT_BUTTON_IN_AWAR_LIST(vs,(AW_CL)p_global->last_selection_list, scrolledList, AW_WIDGET_SELECTION_LIST, this);1417 vs->tie_widget((AW_CL)p_global->last_selection_list, scrolledList, AW_WIDGET_SELECTION_LIST, this); 1402 1418 root->make_sensitive(scrolledList, _at->widget_mask); 1403 1419 } … … 2209 2225 p_global->current_option_menu = p_global->last_option_menu; 2210 2226 2211 AW_INSERT_BUTTON_IN_AWAR_LIST(vs,(AW_CL)p_global->current_option_menu, optionMenu, AW_WIDGET_CHOICE_MENU, this);2227 vs->tie_widget((AW_CL)p_global->current_option_menu, optionMenu, AW_WIDGET_CHOICE_MENU, this); 2212 2228 root->make_sensitive(optionMenu1, _at->widget_mask); 2213 2229 … … 2216 2232 2217 2233 static void remove_option_from_option_menu(AW_root *aw_root, AW_option_struct *os) { 2218 AW_remove_button_from_sens_list(aw_root,os->choice_widget);2234 aw_root->remove_button_from_sens_list(os->choice_widget); 2219 2235 XtDestroyWidget(os->choice_widget); 2220 2236 } … … 2352 2368 2353 2369 void AW_window::update_option_menu(AW_option_menu_struct *oms) { 2354 if (get_root()->changer_of_variable != (long)oms->label_widget) {2370 if (get_root()->changer_of_variable != oms->label_widget) { 2355 2371 AW_option_struct *active_choice = oms->first_choice; 2356 2372 { … … 2518 2534 } 2519 2535 2520 AW_INSERT_BUTTON_IN_AWAR_LIST(vs,get_root()->number_of_toggle_fields, toggle_field, AW_WIDGET_TOGGLE_FIELD, this);2536 vs->tie_widget(get_root()->number_of_toggle_fields, toggle_field, AW_WIDGET_TOGGLE_FIELD, this); 2521 2537 root->make_sensitive(toggle_field, _at->widget_mask); 2522 2538 }
