diff options
| author | Matthias Melcher <github@matthiasm.com> | 2023-07-17 18:31:58 +0200 |
|---|---|---|
| committer | Matthias Melcher <github@matthiasm.com> | 2023-07-17 18:32:13 +0200 |
| commit | 9794d200b33b438feaf76c960e464b90dd911d58 (patch) | |
| tree | 5078c3e9261457aff8d94962ab898ca9dd87af11 /fluid | |
| parent | 80ad543963431f47f3fd8ae2d06d2fa32341299e (diff) | |
FLUID: emulating RTTI and fixing type dependencies (Buttons)
Diffstat (limited to 'fluid')
| -rw-r--r-- | fluid/Fl_Menu_Type.cxx | 2 | ||||
| -rw-r--r-- | fluid/Fl_Menu_Type.h | 6 | ||||
| -rw-r--r-- | fluid/Fl_Type.h | 3 | ||||
| -rw-r--r-- | fluid/Fl_Widget_Type.cxx | 5 | ||||
| -rw-r--r-- | fluid/Fl_Widget_Type.h | 9 | ||||
| -rw-r--r-- | fluid/Fl_Window_Type.cxx | 20 | ||||
| -rw-r--r-- | fluid/Fl_Window_Type.h | 4 | ||||
| -rw-r--r-- | fluid/factory.cxx | 196 | ||||
| -rw-r--r-- | fluid/pixmaps.cxx | 2 | ||||
| -rw-r--r-- | fluid/widget_panel.cxx | 32 | ||||
| -rw-r--r-- | fluid/widget_panel.fl | 26 |
11 files changed, 185 insertions, 120 deletions
diff --git a/fluid/Fl_Menu_Type.cxx b/fluid/Fl_Menu_Type.cxx index a887921ba..bd3f1de10 100644 --- a/fluid/Fl_Menu_Type.cxx +++ b/fluid/Fl_Menu_Type.cxx @@ -705,9 +705,11 @@ void shortcut_in_cb(Fl_Shortcut_Button* i, void* v) { i->value( ((Fl_Text_Display*)(current_widget->o))->shortcut() ); else { i->hide(); + i->parent()->hide(); return; } i->show(); + i->parent()->show(); i->redraw(); } else { int mod = 0; diff --git a/fluid/Fl_Menu_Type.h b/fluid/Fl_Menu_Type.h index f43328363..03921706c 100644 --- a/fluid/Fl_Menu_Type.h +++ b/fluid/Fl_Menu_Type.h @@ -5,7 +5,7 @@ // This should have the widget pointer in it, but it is still in the // Fl_Type base class. // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -31,7 +31,7 @@ extern Fl_Menu_Item menu_item_type_menu[]; -class Fl_Menu_Item_Type : public Fl_Widget_Type { +class Fl_Menu_Item_Type : public Fl_Widget_Type { // FIXME: hmmmmm public: Fl_Menu_Item* subtypes() FL_OVERRIDE {return menu_item_type_menu;} const char* type_name() FL_OVERRIDE {return "MenuItem";} @@ -157,7 +157,7 @@ public: ID id() const FL_OVERRIDE { return ID::Choice; } }; -class Fl_Input_Choice_Type : public Fl_Menu_Type { +class Fl_Input_Choice_Type : public Fl_Menu_Type { // FIXME: Composite: Fl_Group int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) FL_OVERRIDE { Fl_Input_Choice *myo = (Fl_Input_Choice*)(w==4 ? ((Fl_Widget_Type*)this->factory)->o : this->o); switch (w) { diff --git a/fluid/Fl_Type.h b/fluid/Fl_Type.h index 711e0e992..d226c7b7e 100644 --- a/fluid/Fl_Type.h +++ b/fluid/Fl_Type.h @@ -1,7 +1,7 @@ // // Widget type header file for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2021 by Bill Spitzak and others. +// Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -197,6 +197,7 @@ public: virtual int is_public() const {return 1;} virtual ID id() const { return ID::Base_; } + virtual bool is_a(ID inID) { return (inID==ID::Base_); } const char* class_name(const int need_nest) const; const class Fl_Class_Type* is_in_class() const; diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx index a126ad95a..54134b4d3 100644 --- a/fluid/Fl_Widget_Type.cxx +++ b/fluid/Fl_Widget_Type.cxx @@ -186,7 +186,6 @@ Fl_Widget_Type::Fl_Widget_Type() inactive_name_ = 0; image = 0; inactive = 0; - xclass = 0; o = 0; public_ = 1; bind_image_ = 0; @@ -1047,7 +1046,7 @@ void box_cb(Fl_Choice* i, void *v) { void down_box_cb(Fl_Choice* i, void *v) { if (v == LOAD) { int n; - if (current_widget->is_button() && !current_widget->is_menu_item()) + if (current_widget->is_a(Fl_Type::ID::Button)) n = ((Fl_Button*)(current_widget->o))->down_box(); else if (current_widget->id() == Fl_Type::ID::Input_Choice) n = ((Fl_Input_Choice*)(current_widget->o))->down_box(); @@ -1068,7 +1067,7 @@ void down_box_cb(Fl_Choice* i, void *v) { if (n == ZERO_ENTRY) n = 0; for (Fl_Type *o = Fl_Type::first; o; o = o->next) { if (o->selected) { - if (o->is_button() && !o->is_menu_item()) { + if (o->is_a(Fl_Type::ID::Button)) { Fl_Widget_Type* q = (Fl_Widget_Type*)o; ((Fl_Button*)(q->o))->down_box((Fl_Boxtype)n); if (((Fl_Button*)(q->o))->value()) q->redraw(); diff --git a/fluid/Fl_Widget_Type.h b/fluid/Fl_Widget_Type.h index e6d2c54a0..07ffc44b5 100644 --- a/fluid/Fl_Widget_Type.h +++ b/fluid/Fl_Widget_Type.h @@ -5,7 +5,7 @@ // This should have the widget pointer in it, but it is still in the // Fl_Type base class. // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -37,7 +37,10 @@ void selection_changed(Fl_Type* new_current); Fl_Type *sort(Fl_Type *parent); void comment_cb(class Fl_Text_Editor* i, void *v); -class Fl_Widget_Type : public Fl_Type { +class Fl_Widget_Type : public Fl_Type +{ + typedef Fl_Type super; + virtual Fl_Widget *widget(int,int,int,int) = 0; virtual Fl_Widget_Type *_make() = 0; // virtual constructor void setlabel(const char *) FL_OVERRIDE; @@ -67,7 +70,6 @@ protected: Fl_Widget *live_widget; public: - const char *xclass; // junk string, used for shortcut Fl_Widget *o; int public_; int bind_image_; @@ -103,6 +105,7 @@ public: virtual Fl_Menu_Item *subtypes(); ID id() const FL_OVERRIDE { return ID::Widget_; } + bool is_a(ID inID) FL_OVERRIDE { return (inID==ID::Widget_) ? true : super::is_a(inID); } int is_widget() const FL_OVERRIDE; int is_public() const FL_OVERRIDE; diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx index d45fe901c..22f39dfc8 100644 --- a/fluid/Fl_Window_Type.cxx +++ b/fluid/Fl_Window_Type.cxx @@ -340,25 +340,23 @@ void border_cb(Fl_Light_Button* i, void* v) { void xclass_cb(Fl_Input* i, void* v) { if (v == LOAD) { - if (!current_widget->is_window()) { + if (current_widget->is_window()) { + i->show(); + i->parent()->show(); + i->value(((Fl_Window_Type *)current_widget)->xclass); + } else { i->hide(); i->parent()->hide(); // hides the "X Class:" label as well - return; } - i->show(); - i->parent()->show(); - i->value(((Fl_Widget_Type *)current_widget)->xclass); } else { int mod = 0; undo_checkpoint(); for (Fl_Type *o = Fl_Type::first; o; o = o->next) { - if (o->selected && o->is_widget()) { + if (o->selected && o->is_window()) { mod = 1; - Fl_Widget_Type* w = (Fl_Widget_Type*)o; - if (w->is_window() || w->is_button()) - storestring(i->value(),w->xclass); - if (w->is_window()) ((Fl_Window*)(w->o))->xclass(w->xclass); - else if (w->is_menu_item()) w->redraw(); + Fl_Window_Type *wt = (Fl_Window_Type *)o; + storestring(i->value(), wt->xclass); + ((Fl_Window*)(wt->o))->xclass(wt->xclass); } } if (mod) set_modflag(1); diff --git a/fluid/Fl_Window_Type.h b/fluid/Fl_Window_Type.h index b59d9c047..cc993f37b 100644 --- a/fluid/Fl_Window_Type.h +++ b/fluid/Fl_Window_Type.h @@ -43,7 +43,7 @@ enum { FD_BOX = 32 // user creates a new selection box }; -class Fl_Window_Type : public Fl_Widget_Type { +class Fl_Window_Type : public Fl_Widget_Type { // FIXME: Fl_Group protected: Fl_Menu_Item* subtypes() FL_OVERRIDE {return window_type_menu;} @@ -85,9 +85,11 @@ public: numselected(0), recalc(0), modal(0), non_modal(0), + xclass(NULL), sr_min_w(0), sr_min_h(0), sr_max_w(0), sr_max_h(0) { } uchar modal, non_modal; + const char *xclass; // junk string, used for shortcut Fl_Type *make(Strategy strategy) FL_OVERRIDE; const char *type_name() FL_OVERRIDE {return "Fl_Window";} diff --git a/fluid/factory.cxx b/fluid/factory.cxx index a4335d90a..297814ce7 100644 --- a/fluid/factory.cxx +++ b/fluid/factory.cxx @@ -33,6 +33,12 @@ #include <FL/Fl.H> #include <FL/Fl_Window.H> +#include <FL/Fl_Button.H> +#include <FL/Fl_Return_Button.H> +#include <FL/Fl_Repeat_Button.H> +#include <FL/Fl_Light_Button.H> +#include <FL/Fl_Check_Button.H> +#include <FL/Fl_Round_Button.H> #include <FL/Fl_Group.H> #include <FL/Fl_Menu_Item.H> #include <FL/Fl_Pixmap.H> @@ -57,117 +63,169 @@ public: }; static Fl_Box_Type Fl_Box_type; -//////////////////////////////////////////////////////////////// -#include <FL/Fl_Button.H> + +// ---- Button Types --------------------------------------------------- MARK: - + + +// ---- Button ---- + static Fl_Menu_Item buttontype_menu[] = { {"Normal",0,0,(void*)0}, {"Toggle",0,0,(void*)FL_TOGGLE_BUTTON}, {"Radio",0,0,(void*)FL_RADIO_BUTTON}, - {0}}; -class Fl_Button_Type : public Fl_Widget_Type { - Fl_Menu_Item *subtypes() FL_OVERRIDE {return buttontype_menu;} + {0} +}; + +/** + \brief A handler for the simple push button and a base class for all other buttons. + */ +class Fl_Button_Type : public Fl_Widget_Type +{ + typedef Fl_Widget_Type super; + Fl_Menu_Item *subtypes() FL_OVERRIDE { return buttontype_menu; } public: void ideal_size(int &w, int &h) FL_OVERRIDE { + // TODO: this is a really bad size suggestion Fl_Widget_Type::ideal_size(w, h); w += 2 * (o->labelsize() - 4); h = (h / 5) * 5; } - const char *type_name() FL_OVERRIDE {return "Fl_Button";} - const char *alt_type_name() FL_OVERRIDE {return "fltk::Button";} - Fl_Widget *widget(int x,int y,int w,int h) FL_OVERRIDE { - return new Fl_Button(x,y,w,h,"button");} - Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Button_Type();} - int is_button() const FL_OVERRIDE {return 1;} + const char *type_name() FL_OVERRIDE { return "Fl_Button"; } + const char *alt_type_name() FL_OVERRIDE { return "fltk::Button"; } + Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE { + return new Fl_Button(x, y, w, h, "button"); + } + Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Button_Type(); } + int is_button() const FL_OVERRIDE { return 1; } ID id() const FL_OVERRIDE { return ID::Button; } + bool is_a(ID inID) FL_OVERRIDE { return (inID==ID::Button) ? true : super::is_a(inID); } }; + static Fl_Button_Type Fl_Button_type; -//////////////////////////////////////////////////////////////// -#include <FL/Fl_Return_Button.H> -class Fl_Return_Button_Type : public Fl_Button_Type { +// ---- Return Button ---- + +/** + \brief The Return Button is simply a Button with the return key as a hotkey. + */ +class Fl_Return_Button_Type : public Fl_Button_Type +{ + typedef Fl_Button_Type super; public: void ideal_size(int &w, int &h) FL_OVERRIDE { + // TODO: this is a really bad size suggestion Fl_Button_Type::ideal_size(w, h); int W = o->h(); if (o->w()/3 < W) W = o->w()/3; w += W + 8 - o->labelsize(); } - const char *type_name() FL_OVERRIDE {return "Fl_Return_Button";} - const char *alt_type_name() FL_OVERRIDE {return "fltk::ReturnButton";} - Fl_Widget *widget(int x,int y,int w,int h) FL_OVERRIDE { - return new Fl_Return_Button(x,y,w,h,"button");} - Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Return_Button_Type();} + const char *type_name() FL_OVERRIDE { return "Fl_Return_Button"; } + const char *alt_type_name() FL_OVERRIDE { return "fltk::ReturnButton"; } + Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE { + return new Fl_Return_Button(x, y, w, h, "button"); + } + Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Return_Button_Type(); } ID id() const FL_OVERRIDE { return ID::Return_Button; } + bool is_a(ID inID) FL_OVERRIDE { return (inID==ID::Return_Button) ? true : super::is_a(inID); } }; + static Fl_Return_Button_Type Fl_Return_Button_type; -//////////////////////////////////////////////////////////////// -#include <FL/Fl_Repeat_Button.H> -class Fl_Repeat_Button_Type : public Fl_Widget_Type { +// ---- Repeat Button ---- + +/** + \brief Handler for Fl_Repeat_Button. + \note Even though Fl_Repeat_Button is somewhat limited compared to Fl_Button, + and some settings may not make much sense, it is still derived from it, + so the wrapper should be as well. + */ +class Fl_Repeat_Button_Type : public Fl_Button_Type +{ + typedef Fl_Button_Type super; public: - const char *type_name() FL_OVERRIDE {return "Fl_Repeat_Button";} - const char *alt_type_name() FL_OVERRIDE {return "fltk::RepeatButton";} - Fl_Widget *widget(int x,int y,int w,int h) FL_OVERRIDE { - return new Fl_Repeat_Button(x,y,w,h,"button");} - Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Repeat_Button_Type();} + const char *type_name() FL_OVERRIDE { return "Fl_Repeat_Button"; } + const char *alt_type_name() FL_OVERRIDE { return "fltk::RepeatButton"; } + Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE { + return new Fl_Repeat_Button(x, y, w, h, "button"); + } + Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Repeat_Button_Type(); } ID id() const FL_OVERRIDE { return ID::Repeat_Button; } + bool is_a(ID inID) FL_OVERRIDE { return (inID==ID::Repeat_Button) ? true : super::is_a(inID); } }; + static Fl_Repeat_Button_Type Fl_Repeat_Button_type; -//////////////////////////////////////////////////////////////// -#include <FL/Fl_Light_Button.H> -class Fl_Light_Button_Type : public Fl_Button_Type { +// ---- Light Button ---- + +class Fl_Light_Button_Type : public Fl_Button_Type +{ + typedef Fl_Button_Type super; public: void ideal_size(int &w, int &h) FL_OVERRIDE { + // TODO: improve this Fl_Button_Type::ideal_size(w, h); w += 4; } - const char *type_name() FL_OVERRIDE {return "Fl_Light_Button";} - const char *alt_type_name() FL_OVERRIDE {return "fltk::LightButton";} - Fl_Widget *widget(int x,int y,int w,int h) FL_OVERRIDE { - return new Fl_Light_Button(x,y,w,h,"button");} - Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Light_Button_Type();} + const char *type_name() FL_OVERRIDE { return "Fl_Light_Button"; } + const char *alt_type_name() FL_OVERRIDE { return "fltk::LightButton"; } + Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE { + return new Fl_Light_Button(x, y, w, h, "button"); + } + Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Light_Button_Type(); } ID id() const FL_OVERRIDE { return ID::Light_Button; } + bool is_a(ID inID) FL_OVERRIDE { return (inID==ID::Light_Button) ? true : super::is_a(inID); } }; + static Fl_Light_Button_Type Fl_Light_Button_type; -//////////////////////////////////////////////////////////////// -#include <FL/Fl_Check_Button.H> -class Fl_Check_Button_Type : public Fl_Button_Type { +// ---- Check Button ---- + +class Fl_Check_Button_Type : public Fl_Button_Type +{ + typedef Fl_Button_Type super; public: void ideal_size(int &w, int &h) FL_OVERRIDE { + // TODO: fix this Fl_Button_Type::ideal_size(w, h); w += 4; } - const char *type_name() FL_OVERRIDE {return "Fl_Check_Button";} - const char *alt_type_name() FL_OVERRIDE {return "fltk::CheckButton";} - Fl_Widget *widget(int x,int y,int w,int h) FL_OVERRIDE { - return new Fl_Check_Button(x,y,w,h,"button");} - Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Check_Button_Type();} + const char *type_name() FL_OVERRIDE { return "Fl_Check_Button"; } + const char *alt_type_name() FL_OVERRIDE { return "fltk::CheckButton"; } + Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE { + return new Fl_Check_Button(x, y, w, h, "button"); + } + Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Check_Button_Type(); } ID id() const FL_OVERRIDE { return ID::Check_Button; } + bool is_a(ID inID) FL_OVERRIDE { return (inID==ID::Check_Button) ? true : super::is_a(inID); } }; + static Fl_Check_Button_Type Fl_Check_Button_type; -//////////////////////////////////////////////////////////////// -#include <FL/Fl_Round_Button.H> -class Fl_Round_Button_Type : public Fl_Button_Type { +// ---- Round Button ---- + +class Fl_Round_Button_Type : public Fl_Button_Type +{ + typedef Fl_Button_Type super; public: void ideal_size(int &w, int &h) FL_OVERRIDE { + // TODO: ideas? Fl_Button_Type::ideal_size(w, h); w += 4; } - const char *type_name() FL_OVERRIDE {return "Fl_Round_Button";} - const char *alt_type_name() FL_OVERRIDE {return "fltk::RadioButton";} - Fl_Widget *widget(int x,int y,int w,int h) FL_OVERRIDE { - return new Fl_Round_Button(x,y,w,h,"button");} - Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Round_Button_Type();} + const char *type_name() FL_OVERRIDE { return "Fl_Round_Button"; } + const char *alt_type_name() FL_OVERRIDE { return "fltk::RadioButton"; } + Fl_Widget *widget(int x, int y, int w, int h) FL_OVERRIDE { + return new Fl_Round_Button(x, y, w, h, "button"); + } + Fl_Widget_Type *_make() FL_OVERRIDE { return new Fl_Round_Button_Type(); } ID id() const FL_OVERRIDE { return ID::Round_Button; } + bool is_a(ID inID) FL_OVERRIDE { return (inID==ID::Round_Button) ? true : super::is_a(inID); } }; static Fl_Round_Button_Type Fl_Round_Button_type; @@ -183,7 +241,7 @@ static Fl_Menu_Item browser_type_menu[] = { {"Hold",0,0,(void*)FL_HOLD_BROWSER}, {"Multi",0,0,(void*)FL_MULTI_BROWSER}, {0}}; -class Fl_Browser_Type : public Fl_Widget_Type { +class Fl_Browser_Type : public Fl_Widget_Type { // FIXME: Fl_Group(!), Fl_Browser_ Fl_Menu_Item *subtypes() FL_OVERRIDE {return browser_type_menu;} int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) FL_OVERRIDE; public: @@ -230,7 +288,7 @@ int Fl_Browser_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) { return 1; } -class Fl_Check_Browser_Type : public Fl_Widget_Type { +class Fl_Check_Browser_Type : public Fl_Widget_Type { // FIXME: Fl_Browser_ Fl_Menu_Item *subtypes() FL_OVERRIDE {return browser_type_menu;} int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) FL_OVERRIDE; public: @@ -277,7 +335,7 @@ int Fl_Check_Browser_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) { return 1; } -class Fl_Tree_Type : public Fl_Widget_Type { +class Fl_Tree_Type : public Fl_Widget_Type { // FIXME: Fl_Group public: void ideal_size(int &w, int &h) FL_OVERRIDE { if (h < 60) h = 60; @@ -304,7 +362,7 @@ public: }; static Fl_Tree_Type Fl_Tree_type; -class Fl_File_Browser_Type : public Fl_Widget_Type { +class Fl_File_Browser_Type : public Fl_Widget_Type { // FIXME: Fl_Browser (no underscore) Fl_Menu_Item *subtypes() FL_OVERRIDE {return browser_type_menu;} int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) FL_OVERRIDE; public: @@ -354,7 +412,7 @@ static Fl_Menu_Item counter_type_menu[] = { {"Normal",0,0,(void*)FL_NORMAL_COUNTER}, {"Simple",0,0,(void*)FL_SIMPLE_COUNTER}, {0}}; -class Fl_Counter_Type : public Fl_Widget_Type { +class Fl_Counter_Type : public Fl_Widget_Type { // FIXME: Fl_Valuator Fl_Menu_Item *subtypes() FL_OVERRIDE {return counter_type_menu;} int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) FL_OVERRIDE; int is_valuator() const FL_OVERRIDE {return 1;} @@ -387,7 +445,7 @@ static Fl_Menu_Item spinner_type_menu[] = { {"Integer",0,0,(void*)FL_INT_INPUT}, {"Float", 0,0,(void*)FL_FLOAT_INPUT}, {0}}; -class Fl_Spinner_Type : public Fl_Widget_Type { +class Fl_Spinner_Type : public Fl_Widget_Type { // FIXME: Fl_Group, *NOT* Fl_Valuator Fl_Menu_Item *subtypes() FL_OVERRIDE {return spinner_type_menu;} int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) FL_OVERRIDE; public: @@ -434,7 +492,7 @@ static Fl_Menu_Item input_type_menu[] = { {"Int",0,0,(void*)FL_INT_INPUT}, {"Float",0,0,(void*)FL_FLOAT_INPUT}, {0}}; -class Fl_Input_Type : public Fl_Widget_Type { +class Fl_Input_Type : public Fl_Widget_Type { // FIXME: Fl_Input_ Fl_Menu_Item *subtypes() FL_OVERRIDE {return input_type_menu;} int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) FL_OVERRIDE; public: @@ -484,7 +542,7 @@ int Fl_Input_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) { //////////////////////////////////////////////////////////////// #include <FL/Fl_File_Input.H> -class Fl_File_Input_Type : public Fl_Widget_Type { +class Fl_File_Input_Type : public Fl_Widget_Type { // FIXME: Fl_Input Fl_Menu_Item *subtypes() FL_OVERRIDE {return 0;} int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) FL_OVERRIDE; public: @@ -526,7 +584,7 @@ int Fl_File_Input_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) { //////////////////////////////////////////////////////////////// #include <FL/Fl_Text_Display.H> -class Fl_Text_Display_Type : public Fl_Widget_Type { +class Fl_Text_Display_Type : public Fl_Widget_Type { // FIXME: Fl_Group int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) FL_OVERRIDE; public: void ideal_size(int &w, int &h) FL_OVERRIDE { @@ -567,7 +625,7 @@ int Fl_Text_Display_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) { //////////////////////////////////////////////////////////////// #include <FL/Fl_Text_Editor.H> -class Fl_Text_Editor_Type : public Fl_Widget_Type { +class Fl_Text_Editor_Type : public Fl_Widget_Type { // FIXME: Fl_Text_Display int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) FL_OVERRIDE; public: void ideal_size(int &w, int &h) FL_OVERRIDE { @@ -608,7 +666,7 @@ int Fl_Text_Editor_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) { //////////////////////////////////////////////////////////////// #include <FL/Fl_Simple_Terminal.H> -class Fl_Simple_Terminal_Type : public Fl_Text_Editor_Type { +class Fl_Simple_Terminal_Type : public Fl_Text_Editor_Type { // FIXME: Fl_Text_Display public: const char *type_name() FL_OVERRIDE {return "Fl_Simple_Terminal";} const char *alt_type_name() FL_OVERRIDE {return "fltk::SimpleTerminal";} @@ -647,7 +705,7 @@ static Fl_Clock_Type Fl_Clock_type; //////////////////////////////////////////////////////////////// #include <FL/Fl_Help_View.H> -class Fl_Help_View_Type : public Fl_Widget_Type { +class Fl_Help_View_Type : public Fl_Widget_Type { // FIXME: Fl_Group public: void ideal_size(int &w, int &h) FL_OVERRIDE { Fl_Help_View *myo = (Fl_Help_View *)o; @@ -693,7 +751,7 @@ static Fl_Progress_Type Fl_Progress_type; //////////////////////////////////////////////////////////////// #include <FL/Fl_Adjuster.H> -class Fl_Adjuster_Type : public Fl_Widget_Type { +class Fl_Adjuster_Type : public Fl_Widget_Type { // FIXME: Fl_Valuator int is_valuator() const FL_OVERRIDE {return 1;} public: const char *type_name() FL_OVERRIDE {return "Fl_Adjuster";} @@ -713,7 +771,7 @@ static Fl_Menu_Item dial_type_menu[] = { {"Line",0,0,(void*)FL_LINE_DIAL}, {"Fill",0,0,(void*)FL_FILL_DIAL}, {0}}; -class Fl_Dial_Type : public Fl_Widget_Type { +class Fl_Dial_Type : public Fl_Widget_Type { // FIXME: Fl_Valuator Fl_Menu_Item *subtypes() FL_OVERRIDE {return dial_type_menu;} int is_valuator() const FL_OVERRIDE {return 1;} public: @@ -733,7 +791,7 @@ static Fl_Menu_Item roller_type_menu[] = { {"Vertical",0,0,(void*)0}, {"Horizontal",0,0,(void*)FL_HORIZONTAL}, {0}}; -class Fl_Roller_Type : public Fl_Widget_Type { +class Fl_Roller_Type : public Fl_Widget_Type { // FIXME: Fl_Valuator Fl_Menu_Item *subtypes() FL_OVERRIDE {return roller_type_menu;} int is_valuator() const FL_OVERRIDE {return 1;} public: @@ -757,7 +815,7 @@ static Fl_Menu_Item slider_type_menu[] = { {"Vert Knob",0,0,(void*)FL_VERT_NICE_SLIDER}, {"Horz Knob",0,0,(void*)FL_HOR_NICE_SLIDER}, {0}}; -class Fl_Slider_Type : public Fl_Widget_Type { +class Fl_Slider_Type : public Fl_Widget_Type { // FIXME: Fl_Valuator Fl_Menu_Item *subtypes() FL_OVERRIDE {return slider_type_menu;} int is_valuator() const FL_OVERRIDE {return 2;} public: @@ -822,7 +880,7 @@ static Fl_Output_Type Fl_Output_type; //////////////////////////////////////////////////////////////// #include <FL/Fl_Value_Input.H> -class Fl_Value_Input_Type : public Fl_Widget_Type { +class Fl_Value_Input_Type : public Fl_Widget_Type { // FIXME: Fl_Input_ public: void ideal_size(int &w, int &h) FL_OVERRIDE { Fl_Value_Input *myo = (Fl_Value_Input *)o; @@ -863,7 +921,7 @@ int Fl_Value_Input_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) { //////////////////////////////////////////////////////////////// #include <FL/Fl_Value_Output.H> -class Fl_Value_Output_Type : public Fl_Widget_Type { +class Fl_Value_Output_Type : public Fl_Widget_Type { // FIXME: Fl_Valuator public: void ideal_size(int &w, int &h) FL_OVERRIDE { Fl_Value_Output *myo = (Fl_Value_Output *)o; diff --git a/fluid/pixmaps.cxx b/fluid/pixmaps.cxx index e84627916..55c99dc05 100644 --- a/fluid/pixmaps.cxx +++ b/fluid/pixmaps.cxx @@ -1,7 +1,7 @@ // // Fluid Image management for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2021 by Bill Spitzak and others. +// Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this diff --git a/fluid/widget_panel.cxx b/fluid/widget_panel.cxx index 33a712396..4bb22b797 100644 --- a/fluid/widget_panel.cxx +++ b/fluid/widget_panel.cxx @@ -565,26 +565,27 @@ sized to fit the container."); } // Fl_Box* o o->end(); } // Fl_Group* o - { Fl_Group* o = new Fl_Group(95, 210, 0, 20, "Shortcut:"); + { Fl_Group* o = new Fl_Group(95, 210, 310, 20, "Shortcut:"); o->labelfont(1); o->labelsize(11); + o->callback((Fl_Callback*)propagate_load); o->align(Fl_Align(FL_ALIGN_LEFT)); + { // This is a special button that grabs keystrokes directly + Fl_Shortcut_Button* o = new Fl_Shortcut_Button(95, 210, 310, 20); + o->tooltip("The shortcut key for the widget.\nUse \'Backspace\' key to clear."); + o->box(FL_DOWN_BOX); + o->color(FL_BACKGROUND2_COLOR); + o->selection_color((Fl_Color)12); + o->labeltype(FL_NORMAL_LABEL); + o->labelfont(0); + o->labelsize(11); + o->labelcolor(FL_FOREGROUND_COLOR); + o->callback((Fl_Callback*)shortcut_in_cb); + o->align(Fl_Align(FL_ALIGN_CENTER)); + o->when(FL_WHEN_CHANGED); + } // Fl_Shortcut_Button* o o->end(); } // Fl_Group* o - { // This is a special button that grabs keystrokes directly - Fl_Shortcut_Button* o = new Fl_Shortcut_Button(95, 210, 310, 20); - o->tooltip("The shortcut key for the widget.\nUse \'Backspace\' key to clear."); - o->box(FL_DOWN_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->selection_color((Fl_Color)12); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(11); - o->labelcolor(FL_FOREGROUND_COLOR); - o->callback((Fl_Callback*)shortcut_in_cb); - o->align(Fl_Align(FL_ALIGN_CENTER)); - o->when(FL_WHEN_CHANGED); - } // Fl_Shortcut_Button* o { Fl_Group* o = new Fl_Group(95, 235, 300, 20, "X Class:"); o->labelfont(1); o->labelsize(11); @@ -632,7 +633,6 @@ sized to fit the container."); } // Fl_Light_Button* o { Fl_Light_Button* o = new Fl_Light_Button(160, 260, 60, 20, "Active"); o->tooltip("Activate the widget."); - o->shortcut(0x400061); o->selection_color((Fl_Color)1); o->labelsize(11); o->callback((Fl_Callback*)active_cb); diff --git a/fluid/widget_panel.fl b/fluid/widget_panel.fl index 1af617206..c72e2a18f 100644 --- a/fluid/widget_panel.fl +++ b/fluid/widget_panel.fl @@ -334,7 +334,7 @@ h, ph, sh, ch, and i} xywh {275 150 55 20} labelsize 11 align 5 textsize 11 xywh {0 0 31 20} labelsize 11 } MenuItem {} { - label Reposition selected + label Reposition xywh {0 0 31 20} labelsize 11 } MenuItem {} { @@ -471,20 +471,22 @@ h, ph, sh, ch, and i} xywh {275 150 55 20} labelsize 11 align 5 textsize 11 } } Fl_Group {} { - label {Shortcut:} open - xywh {95 210 0 20} labelfont 1 labelsize 11 align 4 - } {} - Fl_Button {} { - callback shortcut_in_cb - comment {This is a special button that grabs keystrokes directly} - tooltip {The shortcut key for the widget. + label {Shortcut:} + callback propagate_load open + xywh {95 210 310 20} labelfont 1 labelsize 11 align 4 + } { + Fl_Button {} { + callback shortcut_in_cb + comment {This is a special button that grabs keystrokes directly} selected + tooltip {The shortcut key for the widget. Use 'Backspace' key to clear.} xywh {95 210 310 20} box DOWN_BOX color 7 selection_color 12 labelsize 11 when 1 - code0 {\#include <FL/Fl_Shortcut_Button.H>} - class Fl_Shortcut_Button + code0 {\#include <FL/Fl_Shortcut_Button.H>} + class Fl_Shortcut_Button + } } Fl_Group {} { label {X Class:} - callback propagate_load + callback propagate_load open xywh {95 235 300 20} labelfont 1 labelsize 11 align 4 } { Fl_Input {} { @@ -521,7 +523,7 @@ Use 'Backspace' key to clear.} xywh {95 210 310 20} box DOWN_BOX color 7 selecti Fl_Light_Button {} { label Active callback active_cb - tooltip {Activate the widget.} xywh {160 260 60 20} shortcut 0x400061 selection_color 1 labelsize 11 + tooltip {Activate the widget.} xywh {160 260 60 20} selection_color 1 labelsize 11 } Fl_Light_Button {} { label Resizable |
