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-valuators-sliders-value-horizontal.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-valuators-sliders-value-horizontal.adb')
-rw-r--r-- | src/fltk-widgets-valuators-sliders-value-horizontal.adb | 65 |
1 files changed, 25 insertions, 40 deletions
diff --git a/src/fltk-widgets-valuators-sliders-value-horizontal.adb b/src/fltk-widgets-valuators-sliders-value-horizontal.adb index bac9b5d..d60e46a 100644 --- a/src/fltk-widgets-valuators-sliders-value-horizontal.adb +++ b/src/fltk-widgets-valuators-sliders-value-horizontal.adb @@ -12,18 +12,9 @@ with package body FLTK.Widgets.Valuators.Sliders.Value.Horizontal is - procedure hor_value_slider_set_draw_hook - (W, D : in Storage.Integer_Address); - pragma Import (C, hor_value_slider_set_draw_hook, "hor_value_slider_set_draw_hook"); - pragma Inline (hor_value_slider_set_draw_hook); - - procedure hor_value_slider_set_handle_hook - (W, H : in Storage.Integer_Address); - pragma Import (C, hor_value_slider_set_handle_hook, "hor_value_slider_set_handle_hook"); - pragma Inline (hor_value_slider_set_handle_hook); - - - + ------------------------ + -- Functions From C -- + ------------------------ function new_fl_hor_value_slider (X, Y, W, H : in Interfaces.C.int; @@ -55,15 +46,19 @@ package body FLTK.Widgets.Valuators.Sliders.Value.Horizontal is + ------------------- + -- Destructors -- + ------------------- + procedure Extra_Final - (This : in out Hor_Value_Slider) is + (This : in out Horizontal_Value_Slider) is begin Extra_Final (Value_Slider (This)); end Extra_Final; procedure Finalize - (This : in out Hor_Value_Slider) is + (This : in out Horizontal_Value_Slider) is begin Extra_Final (This); if This.Void_Ptr /= Null_Pointer and This.Needs_Dealloc then @@ -75,8 +70,12 @@ package body FLTK.Widgets.Valuators.Sliders.Value.Horizontal is + -------------------- + -- Constructors -- + -------------------- + procedure Extra_Init - (This : in out Hor_Value_Slider; + (This : in out Horizontal_Value_Slider; X, Y, W, H : in Integer; Text : in String) is begin @@ -84,14 +83,22 @@ package body FLTK.Widgets.Valuators.Sliders.Value.Horizontal is end Extra_Init; + procedure Initialize + (This : in out Horizontal_Value_Slider) is + begin + This.Draw_Ptr := fl_hor_value_slider_draw'Address; + This.Handle_Ptr := fl_hor_value_slider_handle'Address; + end Initialize; + + package body Forge is function Create (X, Y, W, H : in Integer; Text : in String := "") - return Hor_Value_Slider is + return Horizontal_Value_Slider is begin - return This : Hor_Value_Slider do + return This : Horizontal_Value_Slider do This.Void_Ptr := new_fl_hor_value_slider (Interfaces.C.int (X), Interfaces.C.int (Y), @@ -99,34 +106,12 @@ package body FLTK.Widgets.Valuators.Sliders.Value.Horizontal is Interfaces.C.int (H), Interfaces.C.To_C (Text)); Extra_Init (This, X, Y, W, H, Text); - hor_value_slider_set_draw_hook - (This.Void_Ptr, Storage.To_Integer (Draw_Hook'Address)); - hor_value_slider_set_handle_hook - (This.Void_Ptr, Storage.To_Integer (Handle_Hook'Address)); end return; end Create; end Forge; - - - procedure Draw - (This : in out Hor_Value_Slider) is - begin - fl_hor_value_slider_draw (This.Void_Ptr); - end Draw; - - - function Handle - (This : in out Hor_Value_Slider; - Event : in Event_Kind) - return Event_Outcome is - begin - return Event_Outcome'Val - (fl_hor_value_slider_handle (This.Void_Ptr, Event_Kind'Pos (Event))); - end Handle; - - end FLTK.Widgets.Valuators.Sliders.Value.Horizontal; + |