diff options
| author | Matthias Melcher <git@matthiasm.com> | 2021-12-11 13:15:23 +0100 |
|---|---|---|
| committer | Matthias Melcher <git@matthiasm.com> | 2021-12-11 13:19:15 +0100 |
| commit | 8e864bae21bcebb3d40c140dca44f95bb5b95e94 (patch) | |
| tree | 06f4ae3730cc05f4ad632f7737cf539f6354ca73 /fluid | |
| parent | 0a8b1845fe4b32740f7d4d6a9ce128ec9431990b (diff) | |
Fluid PR 313: update subtype menu to show "Normal" when deactivated.
Based on jdpalmer's pull request:
If the subtype menu is disabled because there are no subtypes, the deactivated menu will still display the subtype of the last widget that had a subtype value. Clearing the menu when there are no subtypes fixes this minor inconsistency.
Diffstat (limited to 'fluid')
| -rw-r--r-- | fluid/Fl_Widget_Type.cxx | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx index 00bc95c41..37cfa5fc3 100644 --- a/fluid/Fl_Widget_Type.cxx +++ b/fluid/Fl_Widget_Type.cxx @@ -1726,21 +1726,30 @@ void value_cb(Fl_Value_Input* i, void* v) { Fl_Menu_Item *Fl_Widget_Type::subtypes() {return 0;} void subtype_cb(Fl_Choice* i, void* v) { + static Fl_Menu_Item empty_type_menu[] = { + {"Normal",0,0,(void*)0}, + {0}}; + if (v == LOAD) { Fl_Menu_Item* m = current_widget->subtypes(); - if (!m) {i->deactivate(); return;} - i->menu(m); - int j; - for (j = 0;; j++) { - if (!m[j].text) {j = 0; break;} - if (current_widget->is_spinner()) { - if (m[j].argument() == ((Fl_Spinner*)current_widget->o)->type()) break; - } else { - if (m[j].argument() == current_widget->o->type()) break; + if (!m) { + i->menu(empty_type_menu); + i->value(0); + i->deactivate(); + } else { + i->menu(m); + int j; + for (j = 0;; j++) { + if (!m[j].text) {j = 0; break;} + if (current_widget->is_spinner()) { + if (m[j].argument() == ((Fl_Spinner*)current_widget->o)->type()) break; + } else { + if (m[j].argument() == current_widget->o->type()) break; + } } + i->value(j); + i->activate(); } - i->value(j); - i->activate(); i->redraw(); } else { int mod = 0; |
