From e93b9bbc02e2791f3a35b6f077fcbb8514c28aed Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Sun, 12 Jan 2025 01:14:58 +1300 Subject: Refactored draw/handle methods in Widgets hierarchy, improved docs, added a few minor method bindings here and there --- src/fltk-widgets-valuators-dials-line.adb | 53 ++++++++++++------------------- 1 file changed, 20 insertions(+), 33 deletions(-) (limited to 'src/fltk-widgets-valuators-dials-line.adb') diff --git a/src/fltk-widgets-valuators-dials-line.adb b/src/fltk-widgets-valuators-dials-line.adb index 7ee67ce..16f9bef 100644 --- a/src/fltk-widgets-valuators-dials-line.adb +++ b/src/fltk-widgets-valuators-dials-line.adb @@ -12,18 +12,9 @@ with package body FLTK.Widgets.Valuators.Dials.Line is - procedure line_dial_set_draw_hook - (W, D : in Storage.Integer_Address); - pragma Import (C, line_dial_set_draw_hook, "line_dial_set_draw_hook"); - pragma Inline (line_dial_set_draw_hook); - - procedure line_dial_set_handle_hook - (W, H : in Storage.Integer_Address); - pragma Import (C, line_dial_set_handle_hook, "line_dial_set_handle_hook"); - pragma Inline (line_dial_set_handle_hook); - - - + ------------------------ + -- Functions From C -- + ------------------------ function new_fl_line_dial (X, Y, W, H : in Interfaces.C.int; @@ -55,6 +46,10 @@ package body FLTK.Widgets.Valuators.Dials.Line is + ------------------- + -- Destructors -- + ------------------- + procedure Extra_Final (This : in out Line_Dial) is begin @@ -75,6 +70,10 @@ package body FLTK.Widgets.Valuators.Dials.Line is + -------------------- + -- Constructors -- + -------------------- + procedure Extra_Init (This : in out Line_Dial; X, Y, W, H : in Integer; @@ -84,6 +83,14 @@ package body FLTK.Widgets.Valuators.Dials.Line is end Extra_Init; + procedure Initialize + (This : in out Line_Dial) is + begin + This.Draw_Ptr := fl_line_dial_draw'Address; + This.Handle_Ptr := fl_line_dial_handle'Address; + end Initialize; + + package body Forge is function Create @@ -99,32 +106,12 @@ package body FLTK.Widgets.Valuators.Dials.Line is Interfaces.C.int (H), Interfaces.C.To_C (Text)); Extra_Init (This, X, Y, W, H, Text); - line_dial_set_draw_hook (This.Void_Ptr, Storage.To_Integer (Draw_Hook'Address)); - line_dial_set_handle_hook (This.Void_Ptr, Storage.To_Integer (Handle_Hook'Address)); end return; end Create; end Forge; - - - procedure Draw - (This : in out Line_Dial) is - begin - fl_line_dial_draw (This.Void_Ptr); - end Draw; - - - function Handle - (This : in out Line_Dial; - Event : in Event_Kind) - return Event_Outcome is - begin - return Event_Outcome'Val - (fl_line_dial_handle (This.Void_Ptr, Event_Kind'Pos (Event))); - end Handle; - - end FLTK.Widgets.Valuators.Dials.Line; + -- cgit