diff options
author | Jed Barber <jjbarber@y7mail.com> | 2017-05-30 19:13:56 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2017-05-30 19:13:56 +1000 |
commit | dbb118c28e8348797ce3ccc1a6c7f1ec4f1f4968 (patch) | |
tree | 102c241043244cc0e5e6c4786c026d044168b246 | |
parent | 68f7afe50933c1339ac86407e99799d74250d4fd (diff) |
Group widget now more or less method complete
-rw-r--r-- | src/c_fl_group.cpp | 27 | ||||
-rw-r--r-- | src/c_fl_group.h | 7 | ||||
-rw-r--r-- | src/fltk-widgets-groups.adb | 88 | ||||
-rw-r--r-- | src/fltk-widgets-groups.ads | 28 |
4 files changed, 145 insertions, 5 deletions
diff --git a/src/c_fl_group.cpp b/src/c_fl_group.cpp index 4f1b5ef..7e7786d 100644 --- a/src/c_fl_group.cpp +++ b/src/c_fl_group.cpp @@ -98,11 +98,21 @@ int fl_group_find(GROUP g, WIDGET item) { } +void fl_group_init_sizes(GROUP g) { + reinterpret_cast<Fl_Group*>(g)->init_sizes(); +} + + void fl_group_insert(GROUP g, WIDGET item, int place) { reinterpret_cast<Fl_Group*>(g)->insert(*(reinterpret_cast<Fl_Widget*>(item)), place); } +void fl_group_insert2(GROUP g, WIDGET item, WIDGET before) { + reinterpret_cast<Fl_Group*>(g)->insert(*(reinterpret_cast<Fl_Widget*>(item)), reinterpret_cast<Fl_Widget*>(before)); +} + + void fl_group_remove(GROUP g, WIDGET item) { reinterpret_cast<Fl_Group*>(g)->remove(reinterpret_cast<Fl_Widget*>(item)); } @@ -113,7 +123,12 @@ void fl_group_remove2(GROUP g, int place) { } -void fl_group_resizable(GROUP g, WIDGET item) { +void * fl_group_get_resizable(GROUP g) { + return reinterpret_cast<Fl_Group*>(g)->resizable(); +} + + +void fl_group_set_resizable(GROUP g, WIDGET item) { reinterpret_cast<Fl_Group*>(g)->resizable(reinterpret_cast<Fl_Widget*>(item)); } @@ -129,3 +144,13 @@ void * fl_group_child(GROUP g, int place) { return reinterpret_cast<Fl_Group*>(g)->child(place); } + +unsigned int flt_group_get_clip_children(GROUP g) { + return reinterpret_cast<Fl_Group*>(g)->clip_children(); +} + + +void fl_group_set_clip_children(GROUP g, int c) { + reinterpret_cast<Fl_Group*>(g)->clip_children(c); +} + diff --git a/src/c_fl_group.h b/src/c_fl_group.h index f98e691..a911296 100644 --- a/src/c_fl_group.h +++ b/src/c_fl_group.h @@ -21,13 +21,18 @@ extern "C" void fl_group_end(GROUP g); extern "C" void fl_group_add(GROUP g, WIDGET item); extern "C" int fl_group_find(GROUP g, WIDGET item); +extern "C" void fl_group_init_sizes(GROUP g); extern "C" void fl_group_insert(GROUP g, WIDGET item, int place); +extern "C" void fl_group_insert2(GROUP g, WIDGET item, WIDGET before); 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" void * fl_group_get_resizable(GROUP g); +extern "C" void fl_group_set_resizable(GROUP g, WIDGET item); extern "C" int fl_group_children(GROUP g); extern "C" void * fl_group_child(GROUP g, int place); +extern "C" unsigned int fl_group_get_clip_children(GROUP g); +extern "C" void fl_group_set_clip_children(GROUP g, int c); #endif diff --git a/src/fltk-widgets-groups.adb b/src/fltk-widgets-groups.adb index 97391da..c66c653 100644 --- a/src/fltk-widgets-groups.adb +++ b/src/fltk-widgets-groups.adb @@ -37,11 +37,19 @@ package body FLTK.Widgets.Groups is return Interfaces.C.int; pragma Import (C, fl_group_find, "fl_group_find"); + procedure fl_group_init_sizes + (G : in System.Address); + pragma Import (C, fl_group_init_sizes, "fl_group_init_sizes"); + procedure fl_group_insert (G, W : in System.Address; P : in Interfaces.C.int); pragma Import (C, fl_group_insert, "fl_group_insert"); + procedure fl_group_insert2 + (G, W, B : in System.Address); + pragma Import (C, fl_group_insert2, "fl_group_insert2"); + procedure fl_group_remove (G, W : in System.Address); pragma Import (C, fl_group_remove, "fl_group_remove"); @@ -62,9 +70,24 @@ package body FLTK.Widgets.Groups is return System.Address; pragma Import (C, fl_group_child, "fl_group_child"); - procedure fl_group_resizable + function fl_group_get_clip_children + (G : in System.Address) + return Interfaces.C.unsigned; + pragma Import (C, fl_group_get_clip_children, "fl_group_get_clip_children"); + + procedure fl_group_set_clip_children + (G : in System.Address; + C : in Interfaces.C.unsigned); + pragma Import (C, fl_group_set_clip_children, "fl_group_set_clip_children"); + + function fl_group_get_resizable + (G : in System.Address) + return System.Address; + pragma Import (C, fl_group_get_resizable, "fl_group_get_resizable"); + + procedure fl_group_set_resizable (G, W : in System.Address); - pragma Import (C, fl_group_resizable, "fl_group_resizable"); + pragma Import (C, fl_group_set_resizable, "fl_group_set_resizable"); procedure fl_group_draw (W : in System.Address); @@ -156,6 +179,26 @@ package body FLTK.Widgets.Groups is + function Get_Clip_Mode + (This : in Group) + return Clip_Mode is + begin + return Clip_Mode'Val (fl_group_get_clip_children (This.Void_Ptr)); + end Get_Clip_Mode; + + + + + procedure Set_Clip_Mode + (This : in out Group; + Mode : in Clip_Mode) is + begin + fl_group_set_clip_children (This.Void_Ptr, Clip_Mode'Pos (Mode)); + end Set_Clip_Mode; + + + + procedure Clear (This : in out Group) is begin @@ -179,6 +222,15 @@ package body FLTK.Widgets.Groups is + procedure Reset_Initial_Sizes + (This : in out Group) is + begin + fl_group_init_sizes (This.Void_Ptr); + end Reset_Initial_Sizes; + + + + procedure Insert (This : in out Group; Item : in out Widget'Class; @@ -193,6 +245,20 @@ package body FLTK.Widgets.Groups is + procedure Insert + (This : in out Group; + Item : in out Widget'Class; + Before : in Widget'Class) is + begin + fl_group_insert2 + (This.Void_Ptr, + Item.Void_Ptr, + Before.Void_Ptr); + end Insert; + + + + procedure Remove (This : in out Group; Item : in out Widget'Class) is @@ -213,11 +279,27 @@ package body FLTK.Widgets.Groups is + function Get_Resizable + (This : in Group) + return access Widget'Class + is + Widget_Ptr : System.Address := + fl_group_get_resizable (This.Void_Ptr); + + Actual_Widget : access Widget'Class := + Widget_Convert.To_Pointer (fl_widget_get_user_data (Widget_Ptr)); + begin + return Actual_Widget; + end Get_Resizable; + + + + procedure Set_Resizable (This : in out Group; Item : in Widget'Class) is begin - fl_group_resizable (This.Void_Ptr, Item.Void_Ptr); + fl_group_set_resizable (This.Void_Ptr, Item.Void_Ptr); end Set_Resizable; diff --git a/src/fltk-widgets-groups.ads b/src/fltk-widgets-groups.ads index e631b7e..84859b0 100644 --- a/src/fltk-widgets-groups.ads +++ b/src/fltk-widgets-groups.ads @@ -7,7 +7,10 @@ package FLTK.Widgets.Groups is type Group is new Widget with private; + + type Index is new Positive; + type Clip_Mode is (No_Clip, Clip); function Create @@ -32,6 +35,16 @@ package FLTK.Widgets.Groups is return Natural; + function Get_Clip_Mode + (This : in Group) + return Clip_Mode; + + + procedure Set_Clip_Mode + (This : in out Group; + Mode : in Clip_Mode); + + procedure Clear (This : in out Group); @@ -42,12 +55,22 @@ package FLTK.Widgets.Groups is return Index; + procedure Reset_Initial_Sizes + (This : in out Group); + + procedure Insert (This : in out Group; Item : in out Widget'Class; Place : in Index); + procedure Insert + (This : in out Group; + Item : in out Widget'Class; + Before : in Widget'Class); + + procedure Remove (This : in out Group; Item : in out Widget'Class); @@ -58,6 +81,11 @@ package FLTK.Widgets.Groups is Place : in Index); + function Get_Resizable + (This : in Group) + return access Widget'Class; + + procedure Set_Resizable (This : in out Group; Item : in Widget'Class); |