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-round.adb | |
parent | 371cccdf78fa9aaf49158ea57e598abcd5ff56f0 (diff) |
Cleaned up Draw/Handle code on Ada side
Diffstat (limited to 'src/fltk-widgets-buttons-light-round.adb')
-rw-r--r-- | src/fltk-widgets-buttons-light-round.adb | 74 |
1 files changed, 29 insertions, 45 deletions
diff --git a/src/fltk-widgets-buttons-light-round.adb b/src/fltk-widgets-buttons-light-round.adb index c13bb43..d047603 100644 --- a/src/fltk-widgets-buttons-light-round.adb +++ b/src/fltk-widgets-buttons-light-round.adb @@ -16,15 +16,6 @@ package body FLTK.Widgets.Buttons.Light.Round is (W, H : in System.Address); pragma Import (C, round_button_set_handle_hook, "round_button_set_handle_hook"); - procedure fl_round_button_draw - (W : in System.Address); - pragma Import (C, fl_round_button_draw, "fl_round_button_draw"); - - function fl_round_button_handle - (W : in System.Address; - E : in Interfaces.C.int) - return Interfaces.C.int; - pragma Import (C, fl_round_button_handle, "fl_round_button_handle"); function new_fl_round_button (X, Y, W, H : in Interfaces.C.int; @@ -37,43 +28,15 @@ package body FLTK.Widgets.Buttons.Light.Round is pragma Import (C, free_fl_round_button, "free_fl_round_button"); + procedure fl_round_button_draw + (W : in System.Address); + pragma Import (C, fl_round_button_draw, "fl_round_button_draw"); - - procedure Draw_Hook (U : in System.Address); - pragma Convention (C, Draw_Hook); - - procedure Draw_Hook - (U : in System.Address) - is - package Round_Button_Convert is new - System.Address_To_Access_Conversions (Round_Button'Class); - - Ada_Round_Button : access Round_Button'Class := - Round_Button_Convert.To_Pointer (U); - begin - Ada_Round_Button.Draw; - end Draw_Hook; - - - - - procedure Draw - (This : in out Round_Button) is - begin - fl_round_button_draw (This.Void_Ptr); - end Draw; - - - - - function Handle - (This : in out Round_Button; - Event : in Event_Kind) - return Event_Outcome is - begin - return Event_Outcome'Val - (fl_round_button_handle (This.Void_Ptr, Event_Kind'Pos (Event))); - end Handle; + function fl_round_button_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_round_button_handle, "fl_round_button_handle"); @@ -114,5 +77,26 @@ package body FLTK.Widgets.Buttons.Light.Round is end Create; + + + procedure Draw + (This : in out Round_Button) is + begin + fl_round_button_draw (This.Void_Ptr); + end Draw; + + + + + function Handle + (This : in out Round_Button; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_round_button_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + end FLTK.Widgets.Buttons.Light.Round; |