summaryrefslogtreecommitdiff
path: root/src/fltk-widgets-groups.ads
diff options
context:
space:
mode:
Diffstat (limited to 'src/fltk-widgets-groups.ads')
-rw-r--r--src/fltk-widgets-groups.ads120
1 files changed, 116 insertions, 4 deletions
diff --git a/src/fltk-widgets-groups.ads b/src/fltk-widgets-groups.ads
index 53ada82..609ba5d 100644
--- a/src/fltk-widgets-groups.ads
+++ b/src/fltk-widgets-groups.ads
@@ -1,18 +1,31 @@
+with
+
+ Ada.Iterator_Interfaces;
+
private with
- System;
+ System.Address_To_Access_Conversions;
package FLTK.Widgets.Groups is
- type Group is new Widget with private;
+ type Group is new Widget with private
+ with Default_Iterator => Iterate,
+ Iterator_Element => Widget_Reference,
+ Variable_Indexing => Child;
+
+ type Group_Reference (Data : not null access Group'Class) is limited null record
+ with Implicit_Dereference => Data;
+
+ subtype Index is Positive;
- type Index is new Positive;
-- type Clip_Mode is (No_Clip, Clip);
+ type Cursor is private;
+
@@ -56,10 +69,24 @@ package FLTK.Widgets.Groups is
+ function Has_Child
+ (This : in Group;
+ Place : in Index)
+ return Boolean;
+
+ function Has_Child
+ (Place : in Cursor)
+ return Boolean;
+
function Child
(This : in Group;
Place : in Index)
- return access Widget'Class;
+ return Widget_Reference;
+
+ function Child
+ (This : in Group;
+ Place : in Cursor)
+ return Widget_Reference;
function Find
(This : in Group;
@@ -73,6 +100,16 @@ package FLTK.Widgets.Groups is
+ package Group_Iterators is
+ new Ada.Iterator_Interfaces (Cursor, Has_Child);
+
+ function Iterate
+ (This : in Group)
+ return Group_Iterators.Reversible_Iterator'Class;
+
+
+
+
-- function Get_Clip_Mode
-- (This : in Group)
-- return Clip_Mode;
@@ -98,6 +135,15 @@ package FLTK.Widgets.Groups is
+ function Get_Current
+ return access Group'Class;
+
+ procedure Set_Current
+ (To : in Group'Class);
+
+
+
+
procedure Draw
(This : in out Group);
@@ -115,6 +161,8 @@ private
overriding procedure Finalize
(This : in out Group);
+ package Group_Convert is new System.Address_To_Access_Conversions (Group);
+
@@ -123,5 +171,69 @@ private
pragma Import (C, fl_group_end, "fl_group_end");
+
+
+ type Cursor is record
+ My_Container : access Group;
+ My_Index : Index'Base := Index'First;
+ end record;
+
+ type Iterator is new Group_Iterators.Reversible_Iterator with record
+ My_Container : access Group;
+ end record;
+
+ overriding function First
+ (Object : in Iterator)
+ return Cursor;
+
+ overriding function Next
+ (Object : in Iterator;
+ Place : in Cursor)
+ return Cursor;
+
+ overriding function Last
+ (Object : in Iterator)
+ return Cursor;
+
+ overriding function Previous
+ (Object : in Iterator;
+ Place : in Cursor)
+ return Cursor;
+
+
+
+
+ pragma Inline (Add);
+ pragma Inline (Insert);
+ pragma Inline (Remove);
+ pragma Inline (Clear);
+
+
+ pragma Inline (Has_Child);
+ pragma Inline (Child);
+ pragma Inline (Find);
+ pragma Inline (Number_Of_Children);
+
+
+ pragma Inline (Iterate);
+
+
+ -- pragma Inline (Get_Clip_Mode);
+ -- pragma Inline (Set_Clip_Mode);
+
+
+ pragma Inline (Get_Resizable);
+ pragma Inline (Set_Resizable);
+ pragma Inline (Reset_Initial_Sizes);
+
+
+ pragma Inline (Get_Current);
+ pragma Inline (Set_Current);
+
+
+ pragma Inline (Draw);
+ pragma Inline (Handle);
+
+
end FLTK.Widgets.Groups;