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.adb | |
parent | 371cccdf78fa9aaf49158ea57e598abcd5ff56f0 (diff) |
Cleaned up Draw/Handle code on Ada side
Diffstat (limited to 'src/fltk-widgets-buttons.adb')
-rw-r--r-- | src/fltk-widgets-buttons.adb | 75 |
1 files changed, 30 insertions, 45 deletions
diff --git a/src/fltk-widgets-buttons.adb b/src/fltk-widgets-buttons.adb index aa9e7f3..15e4982 100644 --- a/src/fltk-widgets-buttons.adb +++ b/src/fltk-widgets-buttons.adb @@ -16,15 +16,6 @@ package body FLTK.Widgets.Buttons is (W, H : in System.Address); pragma Import (C, button_set_handle_hook, "button_set_handle_hook"); - procedure fl_button_draw - (W : in System.Address); - pragma Import (C, fl_button_draw, "fl_button_draw"); - - function fl_button_handle - (W : in System.Address; - E : in Interfaces.C.int) - return Interfaces.C.int; - pragma Import (C, fl_button_handle, "fl_button_handle"); function new_fl_button (X, Y, W, H : in Interfaces.C.int; @@ -36,6 +27,7 @@ package body FLTK.Widgets.Buttons is (B : in System.Address); pragma Import (C, free_fl_button, "free_fl_button"); + function fl_button_get_state (B : in System.Address) return Interfaces.C.int; @@ -50,43 +42,15 @@ package body FLTK.Widgets.Buttons is (B : in System.Address); pragma Import (C, fl_button_set_only, "fl_button_set_only"); + procedure fl_button_draw + (W : in System.Address); + pragma Import (C, fl_button_draw, "fl_button_draw"); - - - procedure Draw_Hook (U : in System.Address); - pragma Convention (C, Draw_Hook); - - procedure Draw_Hook - (U : in System.Address) - is - package Button_Convert is new System.Address_To_Access_Conversions (Button'Class); - - Ada_Button : access Button'Class := - Button_Convert.To_Pointer (U); - begin - Ada_Button.Draw; - end Draw_Hook; - - - - - procedure Draw - (This : in out Button) is - begin - fl_button_draw (This.Void_Ptr); - end Draw; - - - - - function Handle - (This : in out Button; - Event : in Event_Kind) - return Event_Outcome is - begin - return Event_Outcome'Val - (fl_button_handle (This.Void_Ptr, Event_Kind'Pos (Event))); - end Handle; + function fl_button_handle + (W : in System.Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_button_handle, "fl_button_handle"); @@ -156,5 +120,26 @@ package body FLTK.Widgets.Buttons is end Set_Only; + + + procedure Draw + (This : in out Button) is + begin + fl_button_draw (This.Void_Ptr); + end Draw; + + + + + function Handle + (This : in out Button; + Event : in Event_Kind) + return Event_Outcome is + begin + return Event_Outcome'Val + (fl_button_handle (This.Void_Ptr, Event_Kind'Pos (Event))); + end Handle; + + end FLTK.Widgets.Buttons; |