From f419b275ee91792e08f211a588d891c4aa6bedac Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Fri, 15 Jul 2016 22:20:30 +1000 Subject: Groups and Widgets should now keep track of themselves properly, also all named access types removed --- fltk-widgets-inputs.adb | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'fltk-widgets-inputs.adb') diff --git a/fltk-widgets-inputs.adb b/fltk-widgets-inputs.adb index e378684..37d99e7 100644 --- a/fltk-widgets-inputs.adb +++ b/fltk-widgets-inputs.adb @@ -10,7 +10,7 @@ package body FLTK.Widgets.Inputs is function new_fl_input (X, Y, W, H : in Interfaces.C.int; - Label : in Interfaces.C.char_array) + Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_input, "new_fl_input"); @@ -24,8 +24,11 @@ package body FLTK.Widgets.Inputs is procedure Finalize (This : in out Input) is begin - if (This.Void_Ptr /= System.Null_Address) then - free_fl_input (This.Void_Ptr); + Finalize (Widget (This)); + if This.Void_Ptr /= System.Null_Address then + if This in Input then + free_fl_input (This.Void_Ptr); + end if; end if; end Finalize; @@ -34,19 +37,17 @@ package body FLTK.Widgets.Inputs is function Create (X, Y, W, H : in Integer; - Label : in String) + Text : in String) return Input is - - VP : System.Address; - begin - VP := new_fl_input + return This : Input do + This.Void_Ptr := new_fl_input (Interfaces.C.int (X), Interfaces.C.int (Y), Interfaces.C.int (W), Interfaces.C.int (H), - Interfaces.C.To_C (Label)); - return (Ada.Finalization.Limited_Controlled with Void_Ptr => VP); + Interfaces.C.To_C (Text)); + end return; end Create; -- cgit