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.adb | |
parent | 371cccdf78fa9aaf49158ea57e598abcd5ff56f0 (diff) |
Cleaned up Draw/Handle code on Ada side
Diffstat (limited to 'src/fltk-widgets.adb')
-rw-r--r-- | src/fltk-widgets.adb | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/src/fltk-widgets.adb b/src/fltk-widgets.adb index 6fee044..91495e9 100644 --- a/src/fltk-widgets.adb +++ b/src/fltk-widgets.adb @@ -26,6 +26,7 @@ package body FLTK.Widgets is (W, H : in System.Address); pragma Import (C, widget_set_handle_hook, "widget_set_handle_hook"); + function new_fl_widget (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -36,6 +37,7 @@ package body FLTK.Widgets is (F : in System.Address); pragma Import (C, free_fl_widget, "free_fl_widget"); + function fl_widget_get_box (W : in System.Address) return Interfaces.C.int; @@ -132,8 +134,17 @@ package body FLTK.Widgets is - procedure Draw_Hook (U : in System.Address); - pragma Convention (C, Draw_Hook); + procedure Callback_Hook + (W, U : in System.Address) + is + Ada_Widget : access Widget'Class := + Widget_Convert.To_Pointer (U); + begin + Ada_Widget.Callback.all (Ada_Widget.all); + end Callback_Hook; + + + procedure Draw_Hook (U : in System.Address) @@ -161,17 +172,6 @@ package body FLTK.Widgets is - function Handle - (This : in out Widget; - Event : in Event_Kind) - return Event_Outcome is - begin - return Not_Handled; - end Handle; - - - - procedure Finalize (This : in out Widget) is begin @@ -326,23 +326,6 @@ package body FLTK.Widgets is - -- this is the part called by FLTK callbacks - -- note that the user data portion is a reference back to the Ada binding - procedure Callback_Hook (W, U : in System.Address); - pragma Convention (C, Callback_Hook); - - procedure Callback_Hook - (W, U : in System.Address) - is - Ada_Widget : access Widget'Class := - Widget_Convert.To_Pointer (U); - begin - Ada_Widget.Callback.all (Ada_Widget.all); - end Callback_Hook; - - - - procedure Set_Callback (This : in out Widget; Func : in Widget_Callback) is @@ -443,5 +426,16 @@ package body FLTK.Widgets is end Set_Image; + + + function Handle + (This : in out Widget; + Event : in Event_Kind) + return Event_Outcome is + begin + return Not_Handled; + end Handle; + + end FLTK.Widgets; |