diff options
author | Jedidiah Barber <contact@jedbarber.id.au> | 2025-01-09 14:58:19 +1300 |
---|---|---|
committer | Jedidiah Barber <contact@jedbarber.id.au> | 2025-01-09 14:58:19 +1300 |
commit | 17473af7e8ed13e0a9399a69442f9839e5d83aef (patch) | |
tree | 6cd9adf8cde65847f34fbd1cf0ac61c3ad5936ea /src/fltk-widgets-buttons-light-check.adb | |
parent | 3a9028302447ad84363c580b2152f30417186667 (diff) |
Used C FFI to make Extra_Init and Extra_Final calls more consistent
Diffstat (limited to 'src/fltk-widgets-buttons-light-check.adb')
-rw-r--r-- | src/fltk-widgets-buttons-light-check.adb | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/src/fltk-widgets-buttons-light-check.adb b/src/fltk-widgets-buttons-light-check.adb index d6a7ef7..d1596e0 100644 --- a/src/fltk-widgets-buttons-light-check.adb +++ b/src/fltk-widgets-buttons-light-check.adb @@ -6,12 +6,16 @@ with - Interfaces.C; + Interfaces.C.Strings; package body FLTK.Widgets.Buttons.Light.Check is + ------------------------ + -- Functions From C -- + ------------------------ + procedure check_button_set_draw_hook (W, D : in Storage.Integer_Address); pragma Import (C, check_button_set_draw_hook, "check_button_set_draw_hook"); @@ -55,6 +59,26 @@ package body FLTK.Widgets.Buttons.Light.Check is + ------------------- + -- Destructors -- + ------------------- + + -- Round the world and home again, that's the sailor's way! + procedure check_button_extra_final_hook + (Ada_Obj : in Storage.Integer_Address); + pragma Export (C, check_button_extra_final_hook, "check_button_extra_final_hook"); + + procedure check_button_extra_final_hook + (Ada_Obj : in Storage.Integer_Address) + is + My_Check_Button : Check_Button; + for My_Check_Button'Address use Storage.To_Address (Ada_Obj); + pragma Import (Ada, My_Check_Button); + begin + Extra_Final (My_Check_Button); + end check_button_extra_final_hook; + + procedure Extra_Final (This : in out Check_Button) is begin @@ -75,6 +99,34 @@ package body FLTK.Widgets.Buttons.Light.Check is + -------------------- + -- Constructors -- + -------------------- + + -- Arrived at the flip side + procedure check_button_extra_init_hook + (Ada_Obj : Storage.Integer_Address; + X, Y, W, H : in Interfaces.C.int; + C_Str : in Interfaces.C.Strings.chars_ptr); + pragma Export (C, check_button_extra_init_hook, "check_button_extra_init_hook"); + + procedure check_button_extra_init_hook + (Ada_Obj : in Storage.Integer_Address; + X, Y, W, H : in Interfaces.C.int; + C_Str : in Interfaces.C.Strings.chars_ptr) + is + My_Check_Button : Check_Button; + for My_Check_Button'Address use Storage.To_Address (Ada_Obj); + pragma Import (Ada, My_Check_Button); + begin + Extra_Init + (My_Check_Button, + Integer (X), Integer (Y), + Integer (W), Integer (H), + Interfaces.C.Strings.Value (C_Str)); + end check_button_extra_init_hook; + + procedure Extra_Init (This : in out Check_Button; X, Y, W, H : in Integer; @@ -111,6 +163,10 @@ package body FLTK.Widgets.Buttons.Light.Check is + ----------------------- + -- API Subprograms -- + ----------------------- + procedure Draw (This : in out Check_Button) is begin |