diff options
author | Jedidiah Barber <contact@jedbarber.id.au> | 2025-01-12 13:16:48 +1300 |
---|---|---|
committer | Jedidiah Barber <contact@jedbarber.id.au> | 2025-01-12 14:06:05 +1300 |
commit | f8b638b57cc1318ef3536efae662b54b3d14a3bb (patch) | |
tree | 3d1e34a93bfa418e0dbbeb18b8a490d13d915895 /src/fltk-widgets-groups-windows.adb | |
parent | e93b9bbc02e2791f3a35b6f077fcbb8514c28aed (diff) |
Added show(int argc, char **argv) methods for Window classes
Diffstat (limited to 'src/fltk-widgets-groups-windows.adb')
-rw-r--r-- | src/fltk-widgets-groups-windows.adb | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/fltk-widgets-groups-windows.adb b/src/fltk-widgets-groups-windows.adb index 090def8..afd17ae 100644 --- a/src/fltk-widgets-groups-windows.adb +++ b/src/fltk-widgets-groups-windows.adb @@ -6,6 +6,7 @@ with + Ada.Command_Line, Interfaces.C.Strings, FLTK.Images.RGB; @@ -50,6 +51,13 @@ package body FLTK.Widgets.Groups.Windows is pragma Import (C, fl_window_show, "fl_window_show"); pragma Inline (fl_window_show); + procedure fl_window_show2 + (W : in Storage.Integer_Address; + C : in Interfaces.C.int; + V : in Storage.Integer_Address); + pragma Import (C, fl_window_show2, "fl_window_show2"); + pragma Inline (fl_window_show2); + procedure fl_window_hide (W : in Storage.Integer_Address); pragma Import (C, fl_window_hide, "fl_window_hide"); @@ -291,6 +299,42 @@ package body FLTK.Widgets.Groups.Windows is + ------------------------ + -- Internal Utility -- + ------------------------ + + function Create_Argv + return Interfaces.C.Strings.chars_ptr_array + is + package ICS renames Interfaces.C.Strings; + package ACom renames Ada.Command_Line; + + Result : ICS.chars_ptr_array (0 .. Interfaces.C.size_t (ACom.Argument_Count)); + begin + Result (0) := ICS.New_String (ACom.Command_Name); + for Index in Integer range 1 .. ACom.Argument_Count loop + Result (Interfaces.C.size_t (Index)) := ICS.New_String (ACom.Argument (Index)); + end loop; + return Result; + end Create_Argv; + + + procedure Dispatch_Show_With_Args + (Func : in Show_With_Args_Func; + CObj : in Storage.Integer_Address) + is + Argv : Interfaces.C.Strings.chars_ptr_array := Create_Argv; + begin + Func (CObj, Interfaces.C.int (Ada.Command_Line.Argument_Count + 1), + Storage.To_Integer (Argv (Argv'First)'Address)); + for Ptr of Argv loop + Interfaces.C.Strings.Free (Ptr); + end loop; + end Dispatch_Show_With_Args; + + + + ------------------- -- Destructors -- ------------------- @@ -385,6 +429,13 @@ package body FLTK.Widgets.Groups.Windows is end Show; + procedure Show_With_Args + (This : in out Window) is + begin + Dispatch_Show_With_Args (fl_window_show2'Access, This.Void_Ptr); + end Show_With_Args; + + procedure Hide (This : in out Window) is begin |