diff options
author | Jedidiah Barber <contact@jedbarber.id.au> | 2025-01-12 01:14:58 +1300 |
---|---|---|
committer | Jedidiah Barber <contact@jedbarber.id.au> | 2025-01-12 01:14:58 +1300 |
commit | e93b9bbc02e2791f3a35b6f077fcbb8514c28aed (patch) | |
tree | 3661530027db6809a9cbad7b2477416009e00787 /src/fltk-widgets-menus-menu_buttons.adb | |
parent | 53aa8144851913994b963ed611cca8885b8f9a9e (diff) |
Refactored draw/handle methods in Widgets hierarchy, improved docs, added a few minor method bindings here and there
Diffstat (limited to 'src/fltk-widgets-menus-menu_buttons.adb')
-rw-r--r-- | src/fltk-widgets-menus-menu_buttons.adb | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/src/fltk-widgets-menus-menu_buttons.adb b/src/fltk-widgets-menus-menu_buttons.adb index 95ebb8b..ae9ae75 100644 --- a/src/fltk-widgets-menus-menu_buttons.adb +++ b/src/fltk-widgets-menus-menu_buttons.adb @@ -16,19 +16,6 @@ package body FLTK.Widgets.Menus.Menu_Buttons is -- Functions From C -- ------------------------ - procedure menu_button_set_draw_hook - (W, D : in Storage.Integer_Address); - pragma Import (C, menu_button_set_draw_hook, "menu_button_set_draw_hook"); - pragma Inline (menu_button_set_draw_hook); - - procedure menu_button_set_handle_hook - (W, H : in Storage.Integer_Address); - pragma Import (C, menu_button_set_handle_hook, "menu_button_set_handle_hook"); - pragma Inline (menu_button_set_handle_hook); - - - - function new_fl_menu_button (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -157,6 +144,14 @@ package body FLTK.Widgets.Menus.Menu_Buttons is end Extra_Init; + procedure Initialize + (This : in out Menu_Button) is + begin + This.Draw_Ptr := fl_menu_button_draw'Address; + This.Handle_Ptr := fl_menu_button_handle'Address; + end Initialize; + + package body Forge is function Create @@ -172,10 +167,6 @@ package body FLTK.Widgets.Menus.Menu_Buttons is Interfaces.C.int (H), Interfaces.C.To_C (Text)); Extra_Init (This, X, Y, W, H, Text); - menu_button_set_draw_hook - (This.Void_Ptr, Storage.To_Integer (Draw_Hook'Address)); - menu_button_set_handle_hook - (This.Void_Ptr, Storage.To_Integer (Handle_Hook'Address)); end return; end Create; @@ -212,7 +203,7 @@ package body FLTK.Widgets.Menus.Menu_Buttons is procedure Draw (This : in out Menu_Button) is begin - fl_menu_button_draw (This.Void_Ptr); + Menu (This).Draw; end Draw; @@ -221,10 +212,10 @@ package body FLTK.Widgets.Menus.Menu_Buttons is Event : in Event_Kind) return Event_Outcome is begin - return Event_Outcome'Val - (fl_menu_button_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + return Menu (This).Handle (Event); end Handle; end FLTK.Widgets.Menus.Menu_Buttons; + |