From e9dc75679fcac3bf2024e47641941d0a5ef0899d Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Mon, 1 May 2017 12:49:40 +1000 Subject: Draw method implemented for Boxes/Inputs --- src/fltk-widgets-inputs-int.adb | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/fltk-widgets-inputs-int.adb') diff --git a/src/fltk-widgets-inputs-int.adb b/src/fltk-widgets-inputs-int.adb index 30f3d01..42cb22b 100644 --- a/src/fltk-widgets-inputs-int.adb +++ b/src/fltk-widgets-inputs-int.adb @@ -8,6 +8,14 @@ use type System.Address; package body FLTK.Widgets.Inputs.Int is + procedure int_input_set_draw_hook + (W, D : in System.Address); + pragma Import (C, int_input_set_draw_hook, "int_input_set_draw_hook"); + + procedure fl_int_input_draw + (W : in System.Address); + pragma Import (C, fl_int_input_draw, "fl_int_input_draw"); + function new_fl_int_input (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -26,6 +34,30 @@ package body FLTK.Widgets.Inputs.Int is + procedure Draw_Hook (U : in System.Address); + pragma Convention (C, Draw_Hook); + + procedure Draw_Hook + (U : in System.Address) + is + Ada_Input : access Integer_Input'Class := + Integer_Input_Convert.To_Pointer (U); + begin + Ada_Input.Draw; + end Draw_Hook; + + + + + procedure Draw + (This : in out Integer_Input) is + begin + fl_int_input_draw (This.Void_Ptr); + end Draw; + + + + procedure Finalize (This : in out Integer_Input) is begin @@ -55,6 +87,7 @@ package body FLTK.Widgets.Inputs.Int is fl_widget_set_user_data (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); + int_input_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); end return; end Create; -- cgit