diff options
author | Jed Barber <jjbarber@y7mail.com> | 2017-05-14 13:33:27 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2017-05-14 13:33:27 +1000 |
commit | f3638a598d55629bf130c648416ca75f5edae1f1 (patch) | |
tree | bef111db3ab51c3233b60380ecc3ab6d25441eae /src/fltk-widgets-buttons-light-check.adb | |
parent | 371cccdf78fa9aaf49158ea57e598abcd5ff56f0 (diff) |
Cleaned up Draw/Handle code on Ada side
Diffstat (limited to 'src/fltk-widgets-buttons-light-check.adb')
-rw-r--r-- | src/fltk-widgets-buttons-light-check.adb | 74 |
1 files changed, 29 insertions, 45 deletions
diff --git a/src/fltk-widgets-buttons-light-check.adb b/src/fltk-widgets-buttons-light-check.adb index 8db7533..e0e25b4 100644 --- a/src/fltk-widgets-buttons-light-check.adb +++ b/src/fltk-widgets-buttons-light-check.adb @@ -16,15 +16,6 @@ package body FLTK.Widgets.Buttons.Light.Check is (W, H : in System.Address); pragma Import (C, check_button_set_handle_hook, "check_button_set_handle_hook"); - procedure fl_check_button_draw - (W : in System.Address); - pragma Import (C, fl_check_button_draw, "fl_check_button_draw"); - - function fl_check_button_handle - (W : in System.Address; - E : in Interfaces.C.int) - return Interfaces.C.int; - pragma Import (C, fl_check_button_handle, "fl_check_button_handle"); function new_fl_check_button (X, Y, W, H : in Interfaces.C.int; @@ -37,43 +28,15 @@ package body FLTK.Widgets.Buttons.Light.Check is pragma Import (C, free_fl_check_button, "free_fl_check_button"); + procedure fl_check_button_draw + (W : in System.Address); + pragma Import (C, fl_check_button_draw, "fl_check_button_draw"); - - procedure Draw_Hook (U : in System.Address); - pragma Convention (C, Draw_Hook); - - procedure Draw_Hook - (U : in System.Address) - is - package Check_Button_Convert is new - System.Address_To_Access_Conversions (Check_Button'Class); - - Ada_Check_Button : access Check_Button'Class := - Check_Button_Convert.To_Pointer (U); - begin - Ada_Check_Button.Draw; - end Draw_Hook; - - - - - procedure Draw - (This : in out Check_Button) is - begin - fl_check_button_draw (This.Void_Ptr); - end Draw; - - - - - function Handle - (This : in out Check_Button; - Event : in Event_Kind) - return Event_Outcome is - begin - return Event_Outcome'Val - (fl_check_button_handle (This.Void_Ptr, Event_Kind'Pos (Event))); - end Handle; + function fl_check_button_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_check_button_handle, "fl_check_button_handle"); @@ -114,5 +77,26 @@ package body FLTK.Widgets.Buttons.Light.Check is end Create; + + + procedure Draw + (This : in out Check_Button) is + begin + fl_check_button_draw (This.Void_Ptr); + end Draw; + + + + + function Handle + (This : in out Check_Button; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_check_button_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + end FLTK.Widgets.Buttons.Light.Check; |