diff options
| author | Matthias Melcher <github@matthiasm.com> | 2022-12-30 19:14:36 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-30 19:14:36 +0100 |
| commit | 44c874b731f9f58c2f50c3c6076371058cbe26e3 (patch) | |
| tree | 2386dfcc700c41a1109fc78b96875c11056abcc9 /fluid/Fl_Menu_Type.h | |
| parent | f58a93a159105336136ce6e54ab7fc161e4fa15a (diff) | |
Use `FL_OVERRIDE` for all overridden virtual methods (#611)
FL_OVERRIDE is defined as `override` for C++11 and higher
FL_OVERRIDE is defined as `override` for VisualC 2015 and newer
Don't interfere with Fl_Widget::override()
Diffstat (limited to 'fluid/Fl_Menu_Type.h')
| -rw-r--r-- | fluid/Fl_Menu_Type.h | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/fluid/Fl_Menu_Type.h b/fluid/Fl_Menu_Type.h index ddd58efae..6b8da257c 100644 --- a/fluid/Fl_Menu_Type.h +++ b/fluid/Fl_Menu_Type.h @@ -33,55 +33,55 @@ extern Fl_Menu_Item menu_item_type_menu[]; class Fl_Menu_Item_Type : public Fl_Widget_Type { public: - Fl_Menu_Item* subtypes() {return menu_item_type_menu;} - const char* type_name() {return "MenuItem";} - const char* alt_type_name() {return "fltk::Item";} - Fl_Type* make(Strategy strategy); - int is_menu_item() const {return 1;} - int is_button() const {return 1;} // this gets shortcut to work - Fl_Widget* widget(int,int,int,int) {return 0;} - Fl_Widget_Type* _make() {return 0;} - const char* menu_name(int& i); + Fl_Menu_Item* subtypes() FL_OVERRIDE {return menu_item_type_menu;} + const char* type_name() FL_OVERRIDE {return "MenuItem";} + const char* alt_type_name() FL_OVERRIDE {return "fltk::Item";} + Fl_Type* make(Strategy strategy) FL_OVERRIDE; + int is_menu_item() const FL_OVERRIDE {return 1;} + int is_button() const FL_OVERRIDE {return 1;} // this gets shortcut to work + Fl_Widget* widget(int,int,int,int) FL_OVERRIDE {return 0;} + Fl_Widget_Type* _make() FL_OVERRIDE {return 0;} + virtual const char* menu_name(int& i); int flags(); - void write_static(); + void write_static() FL_OVERRIDE; void write_item(); - void write_code1(); - void write_code2(); - int pixmapID() { return 16; } + void write_code1() FL_OVERRIDE; + void write_code2() FL_OVERRIDE; + int pixmapID() FL_OVERRIDE { return 16; } }; class Fl_Radio_Menu_Item_Type : public Fl_Menu_Item_Type { public: - const char* type_name() {return "RadioMenuItem";} - Fl_Type* make(Strategy strategy); - int pixmapID() { return 55; } + const char* type_name() FL_OVERRIDE {return "RadioMenuItem";} + Fl_Type* make(Strategy strategy) FL_OVERRIDE; + int pixmapID() FL_OVERRIDE { return 55; } }; class Fl_Checkbox_Menu_Item_Type : public Fl_Menu_Item_Type { public: - const char* type_name() {return "CheckMenuItem";} - Fl_Type* make(Strategy strategy); - int pixmapID() { return 54; } + const char* type_name() FL_OVERRIDE {return "CheckMenuItem";} + Fl_Type* make(Strategy strategy) FL_OVERRIDE; + int pixmapID() FL_OVERRIDE { return 54; } }; class Fl_Submenu_Type : public Fl_Menu_Item_Type { public: - Fl_Menu_Item* subtypes() {return 0;} - const char* type_name() {return "Submenu";} - const char* alt_type_name() {return "fltk::ItemGroup";} - int is_parent() const {return 1;} - int is_button() const {return 0;} // disable shortcut - Fl_Type* make(Strategy strategy); + Fl_Menu_Item* subtypes() FL_OVERRIDE {return 0;} + const char* type_name() FL_OVERRIDE {return "Submenu";} + const char* alt_type_name() FL_OVERRIDE {return "fltk::ItemGroup";} + int is_parent() const FL_OVERRIDE {return 1;} + int is_button() const FL_OVERRIDE {return 0;} // disable shortcut + Fl_Type* make(Strategy strategy) FL_OVERRIDE; // changes to submenu must propagate up so build_menu is called // on the parent Fl_Menu_Type: - void add_child(Fl_Type*a, Fl_Type*b) {parent->add_child(a,b);} - void move_child(Fl_Type*a, Fl_Type*b) {parent->move_child(a,b);} - void remove_child(Fl_Type*a) {parent->remove_child(a);} - int pixmapID() { return 18; } + void add_child(Fl_Type*a, Fl_Type*b) FL_OVERRIDE {parent->add_child(a,b);} + void move_child(Fl_Type*a, Fl_Type*b) FL_OVERRIDE {parent->move_child(a,b);} + void remove_child(Fl_Type*a) FL_OVERRIDE {parent->remove_child(a);} + int pixmapID() FL_OVERRIDE { return 18; } }; class Fl_Menu_Type : public Fl_Widget_Type { - int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) { + int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) FL_OVERRIDE { Fl_Menu_ *myo = (Fl_Menu_*)(w==4 ? ((Fl_Widget_Type*)this->factory)->o : this->o); switch (w) { case 4: @@ -93,40 +93,40 @@ class Fl_Menu_Type : public Fl_Widget_Type { return 1; } public: - int is_menu_button() const {return 1;} - int is_parent() const {return 1;} + int is_menu_button() const FL_OVERRIDE {return 1;} + int is_parent() const FL_OVERRIDE {return 1;} int menusize; virtual void build_menu(); Fl_Menu_Type() : Fl_Widget_Type() {menusize = 0;} ~Fl_Menu_Type() { if (menusize) delete[] (Fl_Menu_Item*)(((Fl_Menu_*)o)->menu()); } - void add_child(Fl_Type*, Fl_Type*) {build_menu();} - void move_child(Fl_Type*, Fl_Type*) {build_menu();} - void remove_child(Fl_Type*) {build_menu();} - Fl_Type* click_test(int x, int y); - void write_code2(); - void copy_properties(); + void add_child(Fl_Type*, Fl_Type*) FL_OVERRIDE {build_menu();} + void move_child(Fl_Type*, Fl_Type*) FL_OVERRIDE {build_menu();} + void remove_child(Fl_Type*) FL_OVERRIDE {build_menu();} + Fl_Type* click_test(int x, int y) FL_OVERRIDE; + void write_code2() FL_OVERRIDE; + void copy_properties() FL_OVERRIDE; }; extern Fl_Menu_Item button_type_menu[]; class Fl_Menu_Button_Type : public Fl_Menu_Type { - Fl_Menu_Item *subtypes() {return button_type_menu;} + Fl_Menu_Item *subtypes() FL_OVERRIDE {return button_type_menu;} public: - virtual void ideal_size(int &w, int &h) { + void ideal_size(int &w, int &h) FL_OVERRIDE { Fl_Widget_Type::ideal_size(w, h); w += 2 * ((o->labelsize() - 3) & ~1) + o->labelsize() - 4; h = (h / 5) * 5; if (h < 15) h = 15; if (w < (15 + h)) w = 15 + h; } - virtual const char *type_name() {return "Fl_Menu_Button";} - virtual const char *alt_type_name() {return "fltk::MenuButton";} - Fl_Widget *widget(int X,int Y,int W,int H) { + const char *type_name() FL_OVERRIDE {return "Fl_Menu_Button";} + const char *alt_type_name() FL_OVERRIDE {return "fltk::MenuButton";} + Fl_Widget *widget(int X,int Y,int W,int H) FL_OVERRIDE { return new Fl_Menu_Button(X,Y,W,H,"menu");} - Fl_Widget_Type *_make() {return new Fl_Menu_Button_Type();} - int pixmapID() { return 26; } + Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Menu_Button_Type();} + int pixmapID() FL_OVERRIDE { return 26; } }; extern Fl_Menu_Item dummymenu[]; @@ -134,7 +134,7 @@ extern Fl_Menu_Item dummymenu[]; #include <FL/Fl_Choice.H> class Fl_Choice_Type : public Fl_Menu_Type { public: - virtual void ideal_size(int &w, int &h) { + void ideal_size(int &w, int &h) FL_OVERRIDE { Fl_Widget_Type::ideal_size(w, h); int w1 = o->h() - Fl::box_dh(o->box()); if (w1 > 20) w1 = 20; @@ -145,19 +145,19 @@ public: if (h < 15) h = 15; if (w < (15 + h)) w = 15 + h; } - virtual const char *type_name() {return "Fl_Choice";} - virtual const char *alt_type_name() {return "fltk::Choice";} - Fl_Widget *widget(int X,int Y,int W,int H) { + const char *type_name() FL_OVERRIDE {return "Fl_Choice";} + const char *alt_type_name() FL_OVERRIDE {return "fltk::Choice";} + Fl_Widget *widget(int X,int Y,int W,int H) FL_OVERRIDE { Fl_Choice *myo = new Fl_Choice(X,Y,W,H,"choice:"); myo->menu(dummymenu); return myo; } - Fl_Widget_Type *_make() {return new Fl_Choice_Type();} - int pixmapID() { return 15; } + Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Choice_Type();} + int pixmapID() FL_OVERRIDE { return 15; } }; class Fl_Input_Choice_Type : public Fl_Menu_Type { - int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) { + 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) { case 4: @@ -169,7 +169,7 @@ class Fl_Input_Choice_Type : public Fl_Menu_Type { return 1; } public: - virtual void ideal_size(int &w, int &h) { + void ideal_size(int &w, int &h) FL_OVERRIDE { Fl_Input_Choice *myo = (Fl_Input_Choice *)o; fl_font(myo->textfont(), myo->textsize()); h = fl_height() + myo->textsize() - 6; @@ -179,33 +179,33 @@ public: if (h < 15) h = 15; if (w < (15 + h)) w = 15 + h; } - virtual const char *type_name() {return "Fl_Input_Choice";} - virtual const char *alt_type_name() {return "fltk::ComboBox";} - virtual Fl_Type* click_test(int,int); - Fl_Widget *widget(int X,int Y,int W,int H) { + const char *type_name() FL_OVERRIDE {return "Fl_Input_Choice";} + const char *alt_type_name() FL_OVERRIDE {return "fltk::ComboBox";} + Fl_Type* click_test(int,int) FL_OVERRIDE; + Fl_Widget *widget(int X,int Y,int W,int H) FL_OVERRIDE { Fl_Input_Choice *myo = new Fl_Input_Choice(X,Y,W,H,"input choice:"); myo->menu(dummymenu); myo->value("input"); return myo; } - Fl_Widget_Type *_make() {return new Fl_Input_Choice_Type();} - virtual void build_menu(); - int pixmapID() { return 53; } - void copy_properties(); + Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Input_Choice_Type();} + void build_menu() FL_OVERRIDE; + int pixmapID() FL_OVERRIDE { return 53; } + void copy_properties() FL_OVERRIDE; }; class Fl_Menu_Bar_Type : public Fl_Menu_Type { public: - virtual void ideal_size(int &w, int &h) { + void ideal_size(int &w, int &h) FL_OVERRIDE { w = o->window()->w(); h = ((o->labelsize() + Fl::box_dh(o->box()) + 4) / 5) * 5; if (h < 15) h = 15; } - virtual const char *type_name() {return "Fl_Menu_Bar";} - virtual const char *alt_type_name() {return "fltk::MenuBar";} - Fl_Widget *widget(int X,int Y,int W,int H) {return new Fl_Menu_Bar(X,Y,W,H);} - Fl_Widget_Type *_make() {return new Fl_Menu_Bar_Type();} - int pixmapID() { return 17; } + const char *type_name() FL_OVERRIDE {return "Fl_Menu_Bar";} + const char *alt_type_name() FL_OVERRIDE {return "fltk::MenuBar";} + Fl_Widget *widget(int X,int Y,int W,int H) FL_OVERRIDE {return new Fl_Menu_Bar(X,Y,W,H);} + Fl_Widget_Type *_make() FL_OVERRIDE {return new Fl_Menu_Bar_Type();} + int pixmapID() FL_OVERRIDE { return 17; } }; |
