From d4520de203a8fd8816836b7f8507027cf0675f91 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 --- c_fl_group.cpp | 5 +++++ c_fl_group.h | 1 + c_fl_window.cpp | 5 +++++ c_fl_window.h | 1 + fltk-widgets-groups-windows.adb | 25 +++++++++++++++++++++++++ fltk-widgets-groups-windows.ads | 7 +++++++ fltk-widgets-groups.adb | 14 ++++++++++++++ fltk-widgets-groups.ads | 5 +++++ 8 files changed, 63 insertions(+) diff --git a/c_fl_group.cpp b/c_fl_group.cpp index 8adc9dd..9ea2764 100644 --- a/c_fl_group.cpp +++ b/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/c_fl_group.h b/c_fl_group.h index 3c7a8fb..9b58f8c 100644 --- a/c_fl_group.h +++ b/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/c_fl_window.cpp b/c_fl_window.cpp index 5b2d0ff..9c8dbc6 100644 --- a/c_fl_window.cpp +++ b/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/c_fl_window.h b/c_fl_window.h index 8d38de0..526811a 100644 --- a/c_fl_window.h +++ b/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/fltk-widgets-groups-windows.adb b/fltk-widgets-groups-windows.adb index 4ecda66..a0262e1 100644 --- a/fltk-widgets-groups-windows.adb +++ b/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/fltk-widgets-groups-windows.ads b/fltk-widgets-groups-windows.ads index 0999b21..2213563 100644 --- a/fltk-widgets-groups-windows.ads +++ b/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/fltk-widgets-groups.adb b/fltk-widgets-groups.adb index 32753ea..3ffd1e3 100644 --- a/fltk-widgets-groups.adb +++ b/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/fltk-widgets-groups.ads b/fltk-widgets-groups.ads index 7d6e59b..e777f04 100644 --- a/fltk-widgets-groups.ads +++ b/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