From f5f77c762534ed15adc557009d1a645e5fd998a5 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Sat, 16 Nov 2024 10:30:34 +1300 Subject: Reworked widget init/create subprograms --- src/fltk-widgets-clocks-updated.adb | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/fltk-widgets-clocks-updated.adb') diff --git a/src/fltk-widgets-clocks-updated.adb b/src/fltk-widgets-clocks-updated.adb index 0024cc0..b9eabea 100644 --- a/src/fltk-widgets-clocks-updated.adb +++ b/src/fltk-widgets-clocks-updated.adb @@ -84,6 +84,15 @@ package body FLTK.Widgets.Clocks.Updated is + procedure Extra_Init + (This : in out Updated_Clock; + X, Y, W, H : in Integer; + Text : in String) is + begin + Extra_Init (Clock (This), X, Y, W, H, Text); + end Extra_Init; + + package body Forge is function Create @@ -98,12 +107,9 @@ package body FLTK.Widgets.Clocks.Updated is Interfaces.C.int (W), Interfaces.C.int (H), Interfaces.C.To_C (Text)); - fl_widget_set_user_data - (This.Void_Ptr, - Storage.To_Integer (Widget_Convert.To_Address (This'Unchecked_Access))); + Extra_Init (This, X, Y, W, H, Text); clock_set_draw_hook (This.Void_Ptr, Storage.To_Integer (Draw_Hook'Address)); clock_set_handle_hook (This.Void_Ptr, Storage.To_Integer (Handle_Hook'Address)); - fl_widget_set_label (This.Void_Ptr, Interfaces.C.To_C (Text)); end return; end Create; @@ -122,12 +128,9 @@ package body FLTK.Widgets.Clocks.Updated is Interfaces.C.int (W), Interfaces.C.int (H), Interfaces.C.To_C (Text)); - fl_widget_set_user_data - (This.Void_Ptr, - Storage.To_Integer (Widget_Convert.To_Address (This'Unchecked_Access))); + Extra_Init (This, X, Y, W, H, Text); clock_set_draw_hook (This.Void_Ptr, Storage.To_Integer (Draw_Hook'Address)); clock_set_handle_hook (This.Void_Ptr, Storage.To_Integer (Handle_Hook'Address)); - fl_widget_set_label (This.Void_Ptr, Interfaces.C.To_C (Text)); end return; end Create; -- cgit