From b72f41264d96f6cd9333badad82f978ecdc48fc2 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Fri, 15 Jul 2016 22:20:30 +1000 Subject: Groups and Widgets should now keep track of themselves properly, also all named access types removed --- src/fltk_binding/fltk-widgets.ads | 51 ++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 17 deletions(-) (limited to 'src/fltk_binding/fltk-widgets.ads') diff --git a/src/fltk_binding/fltk-widgets.ads b/src/fltk_binding/fltk-widgets.ads index 9c696ed..9910dee 100644 --- a/src/fltk_binding/fltk-widgets.ads +++ b/src/fltk_binding/fltk-widgets.ads @@ -1,72 +1,89 @@ with FLTK.Enums; use FLTK.Enums; +limited with FLTK.Widgets.Groups; package FLTK.Widgets is type Widget is abstract new Wrapper with private; - type Widget_Access is access all Widget; + type Widget_Cursor (Data : access Widget'Class) is limited null record + with Implicit_Dereference => Data; - type Font_Size is new Natural; - Normal_Size : constant Font_Size := 14; + -- would like to move this definition to FLTK.Widgets.Groups somehow + type Group_Cursor (Data : access FLTK.Widgets.Groups.Group'Class) is limited null record + with Implicit_Dereference => Data; + type Font_Size is new Natural; + Normal_Size : constant Font_Size := 14; type Color is new Natural; function Create (X, Y, W, H : in Integer; - Label : in String) + Text : in String) return Widget is abstract; + function Parent + (This : in Widget) + return Group_Cursor; + + function Get_Box - (W : in Widget'Class) + (This : in Widget) return Box_Kind; procedure Set_Box - (W : in out Widget'Class; - B : in Box_Kind); + (This : in out Widget; + Box : in Box_Kind); function Get_Label_Font - (W : in Widget'Class) + (This : in Widget) return Font_Kind; procedure Set_Label_Font - (W : in out Widget'Class; - F : in Font_Kind); + (This : in out Widget; + Font : in Font_Kind); function Get_Label_Size - (W : in Widget'Class) + (This : in Widget) return Font_Size; procedure Set_Label_Size - (W : in out Widget'Class; - S : in Font_Size); + (This : in out Widget; + Size : in Font_Size); function Get_Label_Type - (W : in Widget'Class) + (This : in Widget) return Label_Kind; procedure Set_Label_Type - (W : in out Widget'Class; - L : in Label_Kind); + (This : in out Widget; + Label : in Label_Kind); private - type Widget is abstract new Wrapper with null record; + type Widget is abstract new Wrapper with + record + Parent : access FLTK.Widgets.Groups.Group; + end record; + + + overriding procedure Finalize + (This : in out Widget); end FLTK.Widgets; -- cgit