From 678d77f43136347199e7d4bfddaca4e634e02dc3 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Wed, 21 Sep 2016 23:34:15 +1000 Subject: More progress on the little utility window layouts --- src/fltk_binding/c_fl_group.cpp | 5 +++++ src/fltk_binding/c_fl_group.h | 1 + src/fltk_binding/c_fl_window.cpp | 5 +++++ src/fltk_binding/c_fl_window.h | 1 + src/fltk_binding/fltk-widgets-groups-windows.adb | 25 ++++++++++++++++++++++++ src/fltk_binding/fltk-widgets-groups-windows.ads | 7 +++++++ src/fltk_binding/fltk-widgets-groups.adb | 14 +++++++++++++ src/fltk_binding/fltk-widgets-groups.ads | 5 +++++ 8 files changed, 63 insertions(+) (limited to 'src/fltk_binding') diff --git a/src/fltk_binding/c_fl_group.cpp b/src/fltk_binding/c_fl_group.cpp index 8adc9dd..9ea2764 100644 --- a/src/fltk_binding/c_fl_group.cpp +++ b/src/fltk_binding/c_fl_group.cpp @@ -51,6 +51,11 @@ void fl_group_remove2(GROUP g, int place) { } +void fl_group_resizable(GROUP g, WIDGET item) { + reinterpret_cast(g)->resizable(reinterpret_cast(item)); +} + + int fl_group_children(GROUP g) { diff --git a/src/fltk_binding/c_fl_group.h b/src/fltk_binding/c_fl_group.h index 3c7a8fb..9b58f8c 100644 --- a/src/fltk_binding/c_fl_group.h +++ b/src/fltk_binding/c_fl_group.h @@ -19,6 +19,7 @@ extern "C" int fl_group_find(GROUP g, WIDGET item); extern "C" void fl_group_insert(GROUP g, WIDGET item, int place); extern "C" void fl_group_remove(GROUP g, WIDGET item); extern "C" void fl_group_remove2(GROUP g, int place); +extern "C" void fl_group_resizable(GROUP g, WIDGET item); extern "C" int fl_group_children(GROUP g); extern "C" void * fl_group_child(GROUP g, int place); diff --git a/src/fltk_binding/c_fl_window.cpp b/src/fltk_binding/c_fl_window.cpp index 5b2d0ff..9c8dbc6 100644 --- a/src/fltk_binding/c_fl_window.cpp +++ b/src/fltk_binding/c_fl_window.cpp @@ -35,3 +35,8 @@ void fl_window_set_label(WINDOW n, char* text) { reinterpret_cast(n)->copy_label(text); } + +void fl_window_size_range(WINDOW n, int lw, int lh, int hw, int hh, int dw, int dh, int a) { + reinterpret_cast(n)->size_range(lw, lh, hw, hh, dw, dh, a); +} + diff --git a/src/fltk_binding/c_fl_window.h b/src/fltk_binding/c_fl_window.h index 8d38de0..526811a 100644 --- a/src/fltk_binding/c_fl_window.h +++ b/src/fltk_binding/c_fl_window.h @@ -14,6 +14,7 @@ extern "C" void free_fl_window(WINDOW n); extern "C" void fl_window_show(WINDOW n); extern "C" void fl_window_hide(WINDOW n); extern "C" void fl_window_set_label(WINDOW n, char* text); +extern "C" void fl_window_size_range(WINDOW n, int lw, int lh, int hw, int hh, int dw, int dh, int a); #endif diff --git a/src/fltk_binding/fltk-widgets-groups-windows.adb b/src/fltk_binding/fltk-widgets-groups-windows.adb index 4ecda66..a0262e1 100644 --- a/src/fltk_binding/fltk-widgets-groups-windows.adb +++ b/src/fltk_binding/fltk-widgets-groups-windows.adb @@ -36,6 +36,11 @@ package body FLTK.Widgets.Groups.Windows is T : in Interfaces.C.char_array); pragma Import (C, fl_window_set_label, "fl_window_set_label"); + procedure fl_window_size_range + (W : in System.Address; + LW, LH, HW, HH, DW, DH, A : in Interfaces.C.int); + pragma Import (C, fl_window_size_range, "fl_window_size_range"); + @@ -119,5 +124,25 @@ package body FLTK.Widgets.Groups.Windows is end Set_Label; + + + procedure Set_Size_Range + (This : in out Window; + Min_W, Min_H : in Integer; + Max_W, Max_H, Incre_W, Incre_H : in Integer := 0; + Keep_Aspect : in Boolean := False) is + begin + fl_window_size_range + (This.Void_Ptr, + Interfaces.C.int (Min_W), + Interfaces.C.int (Min_H), + Interfaces.C.int (Max_W), + Interfaces.C.int (Max_H), + Interfaces.C.int (Incre_W), + Interfaces.C.int (Incre_H), + Boolean'Pos (Keep_Aspect)); + end Set_Size_Range; + + end FLTK.Widgets.Groups.Windows; diff --git a/src/fltk_binding/fltk-widgets-groups-windows.ads b/src/fltk_binding/fltk-widgets-groups-windows.ads index 0999b21..2213563 100644 --- a/src/fltk_binding/fltk-widgets-groups-windows.ads +++ b/src/fltk_binding/fltk-widgets-groups-windows.ads @@ -30,6 +30,13 @@ package FLTK.Widgets.Groups.Windows is Text : in String); + procedure Set_Size_Range + (This : in out Window; + Min_W, Min_H : in Integer; + Max_W, Max_H, Incre_W, Incre_H : in Integer := 0; + Keep_Aspect : in Boolean := False); + + private diff --git a/src/fltk_binding/fltk-widgets-groups.adb b/src/fltk_binding/fltk-widgets-groups.adb index 32753ea..3ffd1e3 100644 --- a/src/fltk_binding/fltk-widgets-groups.adb +++ b/src/fltk_binding/fltk-widgets-groups.adb @@ -52,6 +52,10 @@ package body FLTK.Widgets.Groups is return System.Address; pragma Import (C, fl_group_child, "fl_group_child"); + procedure fl_group_resizable + (G, W : in System.Address); + pragma Import (C, fl_group_resizable, "fl_group_resizable"); + @@ -185,5 +189,15 @@ package body FLTK.Widgets.Groups is end Remove; + + + procedure Set_Resizable + (This : in out Group; + Item : in Widget'Class) is + begin + fl_group_resizable (This.Void_Ptr, Item.Void_Ptr); + end Set_Resizable; + + end FLTK.Widgets.Groups; diff --git a/src/fltk_binding/fltk-widgets-groups.ads b/src/fltk_binding/fltk-widgets-groups.ads index 7d6e59b..e777f04 100644 --- a/src/fltk_binding/fltk-widgets-groups.ads +++ b/src/fltk_binding/fltk-widgets-groups.ads @@ -58,6 +58,11 @@ package FLTK.Widgets.Groups is Place : in Index); + procedure Set_Resizable + (This : in out Group; + Item : in Widget'Class); + + private -- cgit