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-groups-tabbed.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-groups-tabbed.adb')
-rw-r--r-- | src/fltk-widgets-groups-tabbed.adb | 55 |
1 files changed, 38 insertions, 17 deletions
diff --git a/src/fltk-widgets-groups-tabbed.adb b/src/fltk-widgets-groups-tabbed.adb index cd7684a..37556e5 100644 --- a/src/fltk-widgets-groups-tabbed.adb +++ b/src/fltk-widgets-groups-tabbed.adb @@ -12,18 +12,9 @@ with package body FLTK.Widgets.Groups.Tabbed is - procedure tabs_set_draw_hook - (W, D : in Storage.Integer_Address); - pragma Import (C, tabs_set_draw_hook, "tabs_set_draw_hook"); - pragma Inline (tabs_set_draw_hook); - - procedure tabs_set_handle_hook - (W, H : in Storage.Integer_Address); - pragma Import (C, tabs_set_handle_hook, "tabs_set_handle_hook"); - pragma Inline (tabs_set_handle_hook); - - - + ------------------------ + -- Functions From C -- + ------------------------ function new_fl_tabs (X, Y, W, H : in Interfaces.C.int; @@ -87,6 +78,11 @@ package body FLTK.Widgets.Groups.Tabbed is pragma Import (C, fl_tabs_draw, "fl_tabs_draw"); pragma Inline (fl_tabs_draw); + procedure fl_tabs_redraw_tabs + (T : in Storage.Integer_Address); + pragma Import (C, fl_tabs_redraw_tabs, "fl_tabs_redraw_tabs"); + pragma Inline (fl_tabs_redraw_tabs); + function fl_tabs_handle (W : in Storage.Integer_Address; E : in Interfaces.C.int) @@ -97,6 +93,10 @@ package body FLTK.Widgets.Groups.Tabbed is + ------------------- + -- Destructors -- + ------------------- + procedure Extra_Final (This : in out Tabbed_Group) is begin @@ -117,6 +117,10 @@ package body FLTK.Widgets.Groups.Tabbed is + -------------------- + -- Constructors -- + -------------------- + procedure Extra_Init (This : in out Tabbed_Group; X, Y, W, H : in Integer; @@ -126,6 +130,14 @@ package body FLTK.Widgets.Groups.Tabbed is end Extra_Init; + procedure Initialize + (This : in out Tabbed_Group) is + begin + This.Draw_Ptr := fl_tabs_draw'Address; + This.Handle_Ptr := fl_tabs_handle'Address; + end Initialize; + + package body Forge is function Create @@ -141,8 +153,6 @@ package body FLTK.Widgets.Groups.Tabbed is Interfaces.C.int (H), Interfaces.C.To_C (Text)); Extra_Init (This, X, Y, W, H, Text); - tabs_set_draw_hook (This.Void_Ptr, Storage.To_Integer (Draw_Hook'Address)); - tabs_set_handle_hook (This.Void_Ptr, Storage.To_Integer (Handle_Hook'Address)); end return; end Create; @@ -151,6 +161,10 @@ package body FLTK.Widgets.Groups.Tabbed is + ----------------------- + -- API Subprograms -- + ----------------------- + procedure Get_Client_Area (This : in Tabbed_Group; Tab_Height : in Natural; @@ -229,19 +243,26 @@ package body FLTK.Widgets.Groups.Tabbed is procedure Draw (This : in out Tabbed_Group) is begin - fl_tabs_draw (This.Void_Ptr); + Group (This).Draw; end Draw; + procedure Redraw_Tabs + (This : in out Tabbed_Group) is + begin + fl_tabs_redraw_tabs (This.Void_Ptr); + end Redraw_Tabs; + + function Handle (This : in out Tabbed_Group; Event : in Event_Kind) return Event_Outcome is begin - return Event_Outcome'Val - (fl_tabs_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + return Group (This).Handle (Event); end Handle; end FLTK.Widgets.Groups.Tabbed; + |