From c2c5985b130e02b970cb6bf88c9a81e6e72c6646 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Sat, 6 May 2017 17:59:20 +1000 Subject: Cleaned up positioning of Draw procedures --- src/c_fl_menu.cpp | 12 ------------ src/c_fl_menu.h | 1 - src/c_fl_widget.cpp | 12 ------------ src/c_fl_widget.h | 1 - src/fltk-widgets-boxes.ads | 6 +++--- src/fltk-widgets-buttons-enter.ads | 6 +++--- src/fltk-widgets-buttons-light-check.ads | 6 +++--- src/fltk-widgets-buttons-light-radio.ads | 6 +++--- src/fltk-widgets-buttons-light-round-radio.ads | 6 +++--- src/fltk-widgets-buttons-light-round.ads | 6 +++--- src/fltk-widgets-buttons-light.ads | 6 +++--- src/fltk-widgets-buttons-radio.ads | 6 +++--- src/fltk-widgets-buttons-repeat.ads | 6 +++--- src/fltk-widgets-buttons-toggle.ads | 6 +++--- src/fltk-widgets-buttons.ads | 6 +++--- src/fltk-widgets-groups-text_displays-text_editors.ads | 6 +++--- src/fltk-widgets-groups-text_displays.ads | 6 +++--- src/fltk-widgets-groups-windows-double.ads | 6 +++--- src/fltk-widgets-groups-windows-single-menu.ads | 6 +++--- src/fltk-widgets-groups-windows-single.ads | 6 +++--- src/fltk-widgets-groups-windows.ads | 6 +++--- src/fltk-widgets-groups.ads | 6 +++--- src/fltk-widgets-inputs-int.ads | 6 +++--- src/fltk-widgets-inputs.ads | 6 +++--- src/fltk-widgets-menus-menu_bars.ads | 6 +++--- src/fltk-widgets-menus-menu_buttons.ads | 6 +++--- src/fltk-widgets-menus.adb | 3 ++- src/fltk-widgets-menus.ads | 7 +++---- src/fltk-widgets.adb | 3 ++- src/fltk-widgets.ads | 6 +++--- 30 files changed, 76 insertions(+), 101 deletions(-) diff --git a/src/c_fl_menu.cpp b/src/c_fl_menu.cpp index c9fb6d3..411f6a0 100644 --- a/src/c_fl_menu.cpp +++ b/src/c_fl_menu.cpp @@ -15,10 +15,8 @@ class My_Menu : public Fl_Menu_ { public: using Fl_Menu_::Fl_Menu_; friend void menu_set_draw_hook(MENU m, void * d); - friend void fl_menu_draw(MENU m); protected: void draw(); - void real_draw(); hook_p draw_hook; }; @@ -28,21 +26,11 @@ void My_Menu::draw() { } -void My_Menu::real_draw() { - //Fl_Menu_::draw(); -} - - void menu_set_draw_hook(MENU m, void * d) { reinterpret_cast(m)->draw_hook = reinterpret_cast(d); } -void fl_menu_draw(MENU m) { - reinterpret_cast(m)->real_draw(); -} - - MENU new_fl_menu(int x, int y, int w, int h, char* label) { diff --git a/src/c_fl_menu.h b/src/c_fl_menu.h index 9276ccb..77dfb80 100644 --- a/src/c_fl_menu.h +++ b/src/c_fl_menu.h @@ -9,7 +9,6 @@ typedef void* MENU; extern "C" void menu_set_draw_hook(MENU m, void * d); -extern "C" void fl_menu_draw(MENU m); extern "C" MENU new_fl_menu(int x, int y, int w, int h, char* label); diff --git a/src/c_fl_widget.cpp b/src/c_fl_widget.cpp index 4e9f2fb..16c746d 100644 --- a/src/c_fl_widget.cpp +++ b/src/c_fl_widget.cpp @@ -15,11 +15,9 @@ class My_Widget : public Fl_Widget { public: using Fl_Widget::Fl_Widget; friend void widget_set_draw_hook(WIDGET w, void * d); - friend void fl_widget_draw(WIDGET w); friend WIDGET new_fl_widget(int x, int y, int w, int h, char* label); protected: void draw(); - void real_draw(); hook_p draw_hook; }; @@ -29,21 +27,11 @@ void My_Widget::draw() { } -void My_Widget::real_draw() { - //Fl_Widget::draw(); -} - - void widget_set_draw_hook(WIDGET w, void * d) { reinterpret_cast(w)->draw_hook = reinterpret_cast(d); } -void fl_widget_draw(WIDGET w) { - reinterpret_cast(w)->real_draw(); -} - - WIDGET new_fl_widget(int x, int y, int w, int h, char* label) { diff --git a/src/c_fl_widget.h b/src/c_fl_widget.h index be83177..b56d3e9 100644 --- a/src/c_fl_widget.h +++ b/src/c_fl_widget.h @@ -8,7 +8,6 @@ typedef void* WIDGET; extern "C" void widget_set_draw_hook(WIDGET w, void * d); -extern "C" void fl_widget_draw(WIDGET w); extern "C" WIDGET new_fl_widget(int x, int y, int w, int h, char* label); diff --git a/src/fltk-widgets-boxes.ads b/src/fltk-widgets-boxes.ads index feeae91..baf6b28 100644 --- a/src/fltk-widgets-boxes.ads +++ b/src/fltk-widgets-boxes.ads @@ -12,13 +12,13 @@ package FLTK.Widgets.Boxes is return Box; -private - - procedure Draw (This : in out Box); +private + + type Box is new Widget with null record; diff --git a/src/fltk-widgets-buttons-enter.ads b/src/fltk-widgets-buttons-enter.ads index a341698..915589a 100644 --- a/src/fltk-widgets-buttons-enter.ads +++ b/src/fltk-widgets-buttons-enter.ads @@ -15,13 +15,13 @@ package FLTK.Widgets.Buttons.Enter is return Enter_Button; -private - - procedure Draw (This : in out Enter_Button); +private + + type Enter_Button is new Button with null record; diff --git a/src/fltk-widgets-buttons-light-check.ads b/src/fltk-widgets-buttons-light-check.ads index f1c0c90..13a92ea 100644 --- a/src/fltk-widgets-buttons-light-check.ads +++ b/src/fltk-widgets-buttons-light-check.ads @@ -12,13 +12,13 @@ package FLTK.Widgets.Buttons.Light.Check is return Check_Button; -private - - procedure Draw (This : in out Check_Button); +private + + type Check_Button is new Light_Button with null record; diff --git a/src/fltk-widgets-buttons-light-radio.ads b/src/fltk-widgets-buttons-light-radio.ads index 25f5fc0..f702649 100644 --- a/src/fltk-widgets-buttons-light-radio.ads +++ b/src/fltk-widgets-buttons-light-radio.ads @@ -12,13 +12,13 @@ package FLTK.Widgets.Buttons.Light.Radio is return Radio_Light_Button; -private - - procedure Draw (This : in out Radio_Light_Button); +private + + type Radio_Light_Button is new Light_Button with null record; diff --git a/src/fltk-widgets-buttons-light-round-radio.ads b/src/fltk-widgets-buttons-light-round-radio.ads index c71638f..ce875f7 100644 --- a/src/fltk-widgets-buttons-light-round-radio.ads +++ b/src/fltk-widgets-buttons-light-round-radio.ads @@ -12,13 +12,13 @@ package FLTK.Widgets.Buttons.Light.Round.Radio is return Radio_Round_Button; -private - - procedure Draw (This : in out Radio_Round_Button); +private + + type Radio_Round_Button is new Round_Button with null record; diff --git a/src/fltk-widgets-buttons-light-round.ads b/src/fltk-widgets-buttons-light-round.ads index 9693915..26d6904 100644 --- a/src/fltk-widgets-buttons-light-round.ads +++ b/src/fltk-widgets-buttons-light-round.ads @@ -12,13 +12,13 @@ package FLTK.Widgets.Buttons.Light.Round is return Round_Button; -private - - procedure Draw (This : in out Round_Button); +private + + type Round_Button is new Light_Button with null record; diff --git a/src/fltk-widgets-buttons-light.ads b/src/fltk-widgets-buttons-light.ads index 5454b76..4e5eef6 100644 --- a/src/fltk-widgets-buttons-light.ads +++ b/src/fltk-widgets-buttons-light.ads @@ -12,13 +12,13 @@ package FLTK.Widgets.Buttons.Light is return Light_Button; -private - - procedure Draw (This : in out Light_Button); +private + + type Light_Button is new Button with null record; diff --git a/src/fltk-widgets-buttons-radio.ads b/src/fltk-widgets-buttons-radio.ads index eb0dd4a..6fca4fb 100644 --- a/src/fltk-widgets-buttons-radio.ads +++ b/src/fltk-widgets-buttons-radio.ads @@ -12,13 +12,13 @@ package FLTK.Widgets.Buttons.Radio is return Radio_Button; -private - - procedure Draw (This : in out Radio_Button); +private + + type Radio_Button is new Button with null record; diff --git a/src/fltk-widgets-buttons-repeat.ads b/src/fltk-widgets-buttons-repeat.ads index f0cd8c3..f5ccda0 100644 --- a/src/fltk-widgets-buttons-repeat.ads +++ b/src/fltk-widgets-buttons-repeat.ads @@ -12,13 +12,13 @@ package FLTK.Widgets.Buttons.Repeat is return Repeat_Button; -private - - procedure Draw (This : in out Repeat_Button); +private + + type Repeat_Button is new Button with null record; diff --git a/src/fltk-widgets-buttons-toggle.ads b/src/fltk-widgets-buttons-toggle.ads index e486c06..7d4262e 100644 --- a/src/fltk-widgets-buttons-toggle.ads +++ b/src/fltk-widgets-buttons-toggle.ads @@ -12,13 +12,13 @@ package FLTK.Widgets.Buttons.Toggle is return Toggle_Button; -private - - procedure Draw (This : in out Toggle_Button); +private + + type Toggle_Button is new Button with null record; diff --git a/src/fltk-widgets-buttons.ads b/src/fltk-widgets-buttons.ads index f207e09..d4b421b 100644 --- a/src/fltk-widgets-buttons.ads +++ b/src/fltk-widgets-buttons.ads @@ -29,13 +29,13 @@ package FLTK.Widgets.Buttons is (This : in out Button); -private - - procedure Draw (This : in out Button); +private + + type Button is new Widget with null record; diff --git a/src/fltk-widgets-groups-text_displays-text_editors.ads b/src/fltk-widgets-groups-text_displays-text_editors.ads index 0f84a7e..10652fc 100644 --- a/src/fltk-widgets-groups-text_displays-text_editors.ads +++ b/src/fltk-widgets-groups-text_displays-text_editors.ads @@ -40,13 +40,13 @@ package FLTK.Widgets.Groups.Text_Displays.Text_Editors is Key : in Shortcut_Key); -private - - procedure Draw (This : in out Text_Editor); +private + + type Text_Editor is new Text_Display with null record; diff --git a/src/fltk-widgets-groups-text_displays.ads b/src/fltk-widgets-groups-text_displays.ads index 15a3f27..bcd8310 100644 --- a/src/fltk-widgets-groups-text_displays.ads +++ b/src/fltk-widgets-groups-text_displays.ads @@ -107,13 +107,13 @@ package FLTK.Widgets.Groups.Text_Displays is Width : in Natural); -private - - procedure Draw (This : in out Text_Display); +private + + type Text_Display is new Group with record Buffer : access FLTK.Text_Buffers.Text_Buffer; diff --git a/src/fltk-widgets-groups-windows-double.ads b/src/fltk-widgets-groups-windows-double.ads index 802e067..3e8be5f 100644 --- a/src/fltk-widgets-groups-windows-double.ads +++ b/src/fltk-widgets-groups-windows-double.ads @@ -25,13 +25,13 @@ package FLTK.Widgets.Groups.Windows.Double is (This : in Double_Window); -private - - procedure Draw (This : in out Double_Window); +private + + type Double_Window is new Window with null record; diff --git a/src/fltk-widgets-groups-windows-single-menu.ads b/src/fltk-widgets-groups-windows-single-menu.ads index c7fa063..7ca43f9 100644 --- a/src/fltk-widgets-groups-windows-single-menu.ads +++ b/src/fltk-widgets-groups-windows-single-menu.ads @@ -39,13 +39,13 @@ package FLTK.Widgets.Groups.Windows.Single.Menu is Value : in Boolean); -private - - procedure Draw (This : in out Menu_Window); +private + + type Menu_Window is new Single_Window with null record; diff --git a/src/fltk-widgets-groups-windows-single.ads b/src/fltk-widgets-groups-windows-single.ads index 32b5c65..b598306 100644 --- a/src/fltk-widgets-groups-windows-single.ads +++ b/src/fltk-widgets-groups-windows-single.ads @@ -25,13 +25,13 @@ package FLTK.Widgets.Groups.Windows.Single is (This : in out Single_Window); -private - - procedure Draw (This : in out Single_Window); +private + + type Single_Window is new Window with null record; diff --git a/src/fltk-widgets-groups-windows.ads b/src/fltk-widgets-groups-windows.ads index 294450a..5351212 100644 --- a/src/fltk-widgets-groups-windows.ads +++ b/src/fltk-widgets-groups-windows.ads @@ -53,13 +53,13 @@ package FLTK.Widgets.Groups.Windows is (This : in out Window); -private - - procedure Draw (This : in out Window); +private + + type Window is new Group with null record; diff --git a/src/fltk-widgets-groups.ads b/src/fltk-widgets-groups.ads index a9453cb..a45e836 100644 --- a/src/fltk-widgets-groups.ads +++ b/src/fltk-widgets-groups.ads @@ -63,13 +63,13 @@ package FLTK.Widgets.Groups is Item : in Widget'Class); -private - - procedure Draw (This : in out Group); +private + + type Group is new Widget with null record; diff --git a/src/fltk-widgets-inputs-int.ads b/src/fltk-widgets-inputs-int.ads index 18c2482..3f210c0 100644 --- a/src/fltk-widgets-inputs-int.ads +++ b/src/fltk-widgets-inputs-int.ads @@ -17,13 +17,13 @@ package FLTK.Widgets.Inputs.Int is return Integer; -private - - procedure Draw (This : in out Integer_Input); +private + + type Integer_Input is new Input with null record; diff --git a/src/fltk-widgets-inputs.ads b/src/fltk-widgets-inputs.ads index c268e72..a60f524 100644 --- a/src/fltk-widgets-inputs.ads +++ b/src/fltk-widgets-inputs.ads @@ -17,13 +17,13 @@ package FLTK.Widgets.Inputs is return String; -private - - procedure Draw (This : in out Input); +private + + type Input is new Widget with null record; diff --git a/src/fltk-widgets-menus-menu_bars.ads b/src/fltk-widgets-menus-menu_bars.ads index 6175306..a30ed76 100644 --- a/src/fltk-widgets-menus-menu_bars.ads +++ b/src/fltk-widgets-menus-menu_bars.ads @@ -12,13 +12,13 @@ package FLTK.Widgets.Menus.Menu_Bars is return Menu_Bar; -private - - procedure Draw (This : in out Menu_Bar); +private + + type Menu_Bar is new Menu with null record; diff --git a/src/fltk-widgets-menus-menu_buttons.ads b/src/fltk-widgets-menus-menu_buttons.ads index dff316d..425a98f 100644 --- a/src/fltk-widgets-menus-menu_buttons.ads +++ b/src/fltk-widgets-menus-menu_buttons.ads @@ -21,13 +21,13 @@ package FLTK.Widgets.Menus.Menu_Buttons is Pop : in Popup_Buttons); -private - - procedure Draw (This : in out Menu_Button); +private + + type Menu_Button is new Menu with null record; diff --git a/src/fltk-widgets-menus.adb b/src/fltk-widgets-menus.adb index afb007c..84e2f61 100644 --- a/src/fltk-widgets-menus.adb +++ b/src/fltk-widgets-menus.adb @@ -93,7 +93,8 @@ package body FLTK.Widgets.Menus is procedure Draw (This : in out Menu) is begin - fl_menu_draw (This.Void_Ptr); + -- this space intentionally left blank + null; end Draw; diff --git a/src/fltk-widgets-menus.ads b/src/fltk-widgets-menus.ads index c745273..6cc197d 100644 --- a/src/fltk-widgets-menus.ads +++ b/src/fltk-widgets-menus.ads @@ -73,14 +73,13 @@ package FLTK.Widgets.Menus is (Item : in Menu_Item); -private - - - -- must be overridden in any derived types procedure Draw (This : in out Menu); +private + + type Menu is new Widget with null record; diff --git a/src/fltk-widgets.adb b/src/fltk-widgets.adb index 96d7998..292f274 100644 --- a/src/fltk-widgets.adb +++ b/src/fltk-widgets.adb @@ -150,7 +150,8 @@ package body FLTK.Widgets is procedure Draw (This : in out Widget) is begin - fl_widget_draw (This.Void_Ptr); + -- this space intentionally left blank + null; end Draw; diff --git a/src/fltk-widgets.ads b/src/fltk-widgets.ads index 0ed0d2d..c2b863b 100644 --- a/src/fltk-widgets.ads +++ b/src/fltk-widgets.ads @@ -129,13 +129,13 @@ package FLTK.Widgets is Pic : in out FLTK.Images.Image'Class); -private - - procedure Draw (This : in out Widget); +private + + type Widget is new Wrapper with record Callback : Widget_Callback; -- cgit