diff options
author | Jedidiah Barber <contact@jedbarber.id.au> | 2024-12-11 17:25:21 +1300 |
---|---|---|
committer | Jedidiah Barber <contact@jedbarber.id.au> | 2024-12-11 17:25:21 +1300 |
commit | 86a0894a1c54e69ae56e147cc943893194664304 (patch) | |
tree | 42a91282fa5d48c1ad2d390691ae175aa761ce90 | |
parent | 24781de8bedb3bf4d12d7ec1d0307842e59a3f94 (diff) |
Abstract_Browser now Browser, slight tweaks to Select and Sort subprograms
-rw-r--r-- | doc/fl_browser_.html | 140 | ||||
-rw-r--r-- | src/fltk-widgets-groups-browsers.adb | 253 | ||||
-rw-r--r-- | src/fltk-widgets-groups-browsers.ads | 163 |
3 files changed, 309 insertions, 247 deletions
diff --git a/doc/fl_browser_.html b/doc/fl_browser_.html index 8c98c56..0f8c5fa 100644 --- a/doc/fl_browser_.html +++ b/doc/fl_browser_.html @@ -27,8 +27,9 @@ </table> <p><b>Note:</b><br /><br /> -As the name suggests, you will likely never actually touch Abstract_Browser directly. -Only through using or creating types derived from it.</p> +This Browser type should really be abstract but cannot be for technical binding reasons. +If you try to use it directly you will get exceptions. Either extend it or use types +already extended from it.</p> @@ -37,12 +38,12 @@ Only through using or creating types derived from it.</p> <tr> <td>Fl_Browser_</td> - <td>Abstract_Browser</td> + <td>Browser</td> </tr> <tr> <td> </td> - <td>Abstract_Browser_Reference</td> + <td>Browser_Reference</td> </tr> <tr> @@ -73,7 +74,7 @@ Fl_Scrollbar hscrollbar; </pre></td> <td><pre> function H_Bar - (This : in out Abstract_Browser) + (This : in out Browser) return Valuators.Sliders.Scrollbars.Scrollbar_Reference; </pre></td> </tr> @@ -84,7 +85,7 @@ Fl_Scrollbar scrollbar; </pre></td> <td><pre> function V_Bar - (This : in out Abstract_Browser) + (This : in out Browser) return Valuators.Sliders.Scrollbars.Scrollbar_Reference; </pre></td> </tr> @@ -104,7 +105,7 @@ Fl_Browser_(int X, int Y, int W, int H, const char *L=0); function Create (X, Y, W, H : in Integer; Text : in String := "") - return Abstract_Browser; + return Browser; </pre></td> </tr> @@ -121,9 +122,13 @@ int deselect(int docallbacks=0); </pre></td> <td><pre> function Deselect - (This : in out Abstract_Browser; + (This : in out Browser; Do_Callbacks : in Boolean := False) return Boolean; + +procedure Deselect + (This : in out Browser; + Do_Callbacks : in Boolean := False); </pre></td> </tr> @@ -133,7 +138,7 @@ void display(void *item); </pre></td> <td><pre> procedure Display - (This : in out Abstract_Browser; + (This : in out Browser; Item : in Item_Cursor); </pre></td> </tr> @@ -144,7 +149,7 @@ int handle(int event); </pre></td> <td><pre> function Handle - (This : in out Abstract_Browser; + (This : in out Browser; Event : in Event_Kind) return Event_Outcome; </pre></td> @@ -156,7 +161,7 @@ uchar has_scrollbar() const; </pre></td> <td><pre> function Get_Scrollbar_Mode - (This : in Abstract_Browser) + (This : in Browser) return Scrollbar_Mode; </pre></td> </tr> @@ -167,7 +172,7 @@ void has_scrollbar(uchar mode); </pre></td> <td><pre> procedure Set_Scrollbar_Mode - (This : in out Abstract_Browser; + (This : in out Browser; Mode : in Scrollbar_Mode); </pre></td> </tr> @@ -178,7 +183,7 @@ int hposition() const; </pre></td> <td><pre> function Get_H_Position - (This : in Abstract_Browser) + (This : in Browser) return Integer; </pre></td> </tr> @@ -189,7 +194,7 @@ void hposition(int); </pre></td> <td><pre> procedure Set_H_Position - (This : in out Abstract_Browser; + (This : in out Browser; Value : in Integer); </pre></td> </tr> @@ -200,7 +205,7 @@ int position() const; </pre></td> <td><pre> function Get_V_Position - (This : in Abstract_Browser) + (This : in Browser) return Integer; </pre></td> </tr> @@ -211,7 +216,7 @@ void position(int pos); </pre></td> <td><pre> procedure Set_V_Position - (This : in out Abstract_Browser; + (This : in out Browser; Value : in Integer); </pre></td> </tr> @@ -222,7 +227,7 @@ void resize(int X, int Y, int W, int H); </pre></td> <td><pre> procedure Resize - (This : in out Abstract_Browser; + (This : in out Browser; X, Y, W, H : in Integer); </pre></td> </tr> @@ -233,7 +238,7 @@ void scrollbar_left(); </pre></td> <td><pre> procedure Set_Vertical_Left - (This : in out Abstract_Browser); + (This : in out Browser); </pre></td> </tr> @@ -243,7 +248,7 @@ void scrollbar_right(); </pre></td> <td><pre> procedure Set_Vertical_Right - (This : in out Abstract_Browser); + (This : in out Browser); </pre></td> </tr> @@ -253,7 +258,7 @@ int scrollbar_size() const; </pre></td> <td><pre> function Get_Scrollbar_Size - (This : in Abstract_Browser) + (This : in Browser) return Integer; </pre></td> </tr> @@ -264,7 +269,7 @@ void scrollbar_size(int newSize); </pre></td> <td><pre> procedure Set_Scrollbar_Size - (This : in out Abstract_Browser; + (This : in out Browser; Value : in Integer); </pre></td> </tr> @@ -273,14 +278,14 @@ procedure Set_Scrollbar_Size <td><pre> int scrollbar_width() const; </pre></td> -<td>Deprecated, see scrollbar_size</td> +<td>Deprecated, see scrollbar_size();</td> </tr> <tr> <td><pre> void scrollbar_width(int width); </pre></td> -<td>Deprecated, see scrollbar_size</td> +<td>Deprecated, see scrollbar_size(int width);</td> </tr> <tr> @@ -289,11 +294,17 @@ int select(void *item, int val=1, int docallbacks=0); </pre></td> <td><pre> function Set_Select - (This : in out Abstract_Browser; + (This : in out Browser; Item : in Item_Cursor; State : in Boolean := True; Do_Callbacks : in Boolean := False) return Boolean; + +procedure Set_Select + (This : in out Browser; + Item : in Item_Cursor; + State : in Boolean := True; + Do_Callbacks : in Boolean := False); </pre></td> </tr> @@ -303,10 +314,15 @@ int select_only(void *item, int docallbacks=0); </pre></td> <td><pre> function Select_Only - (This : in out Abstract_Browser; + (This : in out Browser; Item : in Item_Cursor; Do_Callbacks : in Boolean := False) return Boolean; + +procedure Select_Only + (This : in out Browser; + Item : in Item_Cursor; + Do_Callbacks : in Boolean := False); </pre></td> </tr> @@ -316,7 +332,7 @@ void sort(int flags=0); </pre></td> <td><pre> procedure Sort - (This : in out Abstract_Browser; + (This : in out Browser; Order : in Sort_Order); </pre></td> </tr> @@ -327,7 +343,7 @@ Fl_Color textcolor() const; </pre></td> <td><pre> function Get_Text_Color - (This : in Abstract_Browser) + (This : in Browser) return Color; </pre></td> </tr> @@ -338,7 +354,7 @@ void textcolor(Fl_Color col); </pre></td> <td><pre> procedure Set_Text_Color - (This : in out Abstract_Browser; + (This : in out Browser; Value : in Color); </pre></td> </tr> @@ -349,7 +365,7 @@ Fl_Font textfont() const; </pre></td> <td><pre> function Get_Text_Font - (This : in Abstract_Browser) + (This : in Browser) return Font_Kind; </pre></td> </tr> @@ -360,7 +376,7 @@ void textfont(Fl_Font font); </pre></td> <td><pre> procedure Set_Text_Font - (This : in out Abstract_Browser; + (This : in out Browser; Font : in Font_Kind); </pre></td> </tr> @@ -371,7 +387,7 @@ Fl_Fontsize textsize() const; </pre></td> <td><pre> function Get_Text_Size - (This : in Abstract_Browser) + (This : in Browser) return Font_Size; </pre></td> </tr> @@ -382,7 +398,7 @@ void textsize(Fl_Fontsize newSize); </pre></td> <td><pre> procedure Set_Text_Size - (This : in out Abstract_Browser; + (This : in out Browser; Size : in Font_Size); </pre></td> </tr> @@ -400,7 +416,7 @@ void bbox(int &X, int &Y, int &W, int &H) const; </pre></td> <td><pre> procedure Bounding_Box - (This : in Abstract_Browser; + (This : in Browser; X, Y, W, H : out Integer); </pre></td> </tr> @@ -411,7 +427,7 @@ void deleting(void *item); </pre></td> <td><pre> procedure Deleting - (This : in out Abstract_Browser; + (This : in out Browser; Item : in Item_Cursor); </pre></td> </tr> @@ -422,7 +438,7 @@ int displayed(void *item) const; </pre></td> <td><pre> function Is_Displayed - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return Boolean; </pre></td> @@ -434,7 +450,7 @@ void draw(); </pre></td> <td><pre> procedure Draw - (This : in out Abstract_Browser); + (This : in out Browser); </pre></td> </tr> @@ -444,7 +460,7 @@ void * find_item(int ypos); </pre></td> <td><pre> function Find_Item - (This : in Abstract_Browser; + (This : in Browser; Y_Pos : in Integer) return Item_Cursor; </pre></td> @@ -456,7 +472,7 @@ virtual int full_height() const; </pre></td> <td><pre> function Full_List_Height - (This : in Abstract_Browser) + (This : in Browser) return Integer; </pre></td> </tr> @@ -467,7 +483,7 @@ virtual int full_width() const; </pre></td> <td><pre> function Full_List_Width - (This : in Abstract_Browser) + (This : in Browser) return Integer; </pre></td> </tr> @@ -478,7 +494,7 @@ virtual int incr_height() const; </pre></td> <td><pre> function Average_Item_Height - (This : in Abstract_Browser) + (This : in Browser) return Integer; </pre></td> </tr> @@ -489,7 +505,7 @@ void inserting(void *a, void *b); </pre></td> <td><pre> procedure Inserting - (This : in out Abstract_Browser; + (This : in out Browser; A, B : in Item_Cursor); </pre></td> </tr> @@ -500,7 +516,7 @@ virtual void * item_at(int index) const; </pre></td> <td><pre> function Item_At - (This : in Abstract_Browser; + (This : in Browser; Index : in Positive) return Item_Cursor; </pre></td> @@ -513,7 +529,7 @@ virtual void item_draw(void *item, </pre></td> <td><pre> procedure Item_Draw - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor; X, Y, W, H : in Integer); </pre></td> @@ -525,7 +541,7 @@ virtual void * item_first() const =0; </pre></td> <td><pre> function Item_First - (This : in Abstract_Browser) + (This : in Browser) return Item_Cursor; </pre></td> </tr> @@ -536,7 +552,7 @@ virtual int item_height(void *item) const =0; </pre></td> <td><pre> function Item_Height - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return Integer; </pre></td> @@ -548,7 +564,7 @@ virtual void * item_last() const; </pre></td> <td><pre> function Item_Last - (This : in Abstract_Browser) + (This : in Browser) return Item_Cursor; </pre></td> </tr> @@ -559,7 +575,7 @@ virtual void * item_next(void *item) const =0; </pre></td> <td><pre> function Item_Next - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return Item_Cursor; </pre></td> @@ -571,7 +587,7 @@ virtual void * item_prev(void *item) const =0; </pre></td> <td><pre> function Item_Previous - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return Item_Cursor; </pre></td> @@ -583,7 +599,7 @@ virtual int item_quick_height(void *item) const; </pre></td> <td><pre> function Item_Quick_Height - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return Integer; </pre></td> @@ -595,7 +611,7 @@ virtual void item_select(void *item, int val=1); </pre></td> <td><pre> procedure Item_Select - (This : in out Abstract_Browser; + (This : in out Browser; Item : in Item_Cursor; State : in Boolean := True); </pre></td> @@ -607,7 +623,7 @@ virtual int item_selected(void *item) const; </pre></td> <td><pre> function Item_Selected - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return Boolean; </pre></td> @@ -619,7 +635,7 @@ virtual void item_swap(void *a, void *b); </pre></td> <td><pre> procedure Item_Swap - (This : in out Abstract_Browser; + (This : in out Browser; A, B : in Item_Cursor); </pre></td> </tr> @@ -630,7 +646,7 @@ virtual const char * item_text(void *item) const; </pre></td> <td><pre> function Item_Text - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return String; </pre></td> @@ -642,7 +658,7 @@ virtual int item_width(void *item) const =0; </pre></td> <td><pre> function Item_Width - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return Integer; </pre></td> @@ -654,7 +670,7 @@ int leftedge() const; </pre></td> <td><pre> function Left_Edge - (This : in Abstract_Browser) + (This : in Browser) return Integer; </pre></td> </tr> @@ -665,7 +681,7 @@ void new_list(); </pre></td> <td><pre> procedure New_List - (This : in out Abstract_Browser); + (This : in out Browser); </pre></td> </tr> @@ -675,7 +691,7 @@ void redraw_line(void *item); </pre></td> <td><pre> procedure Redraw_Line - (This : in out Abstract_Browser; + (This : in out Browser; Item : in Item_Cursor); </pre></td> </tr> @@ -686,7 +702,7 @@ void redraw_lines(); </pre></td> <td><pre> procedure Redraw_List - (This : in out Abstract_Browser); + (This : in out Browser); </pre></td> </tr> @@ -696,7 +712,7 @@ void replacing(void *a, void *b); </pre></td> <td><pre> procedure Replacing - (This : in out Abstract_Browser; + (This : in out Browser; A, B : in Item_Cursor); </pre></td> </tr> @@ -707,7 +723,7 @@ void * selection() const; </pre></td> <td><pre> function Current_Selection - (This : in Abstract_Browser) + (This : in Browser) return Item_Cursor; </pre></td> </tr> @@ -718,7 +734,7 @@ void swapping(void *a, void *b); </pre></td> <td><pre> procedure Swapping - (This : in out Abstract_Browser; + (This : in out Browser; A, B : in Item_Cursor); </pre></td> </tr> @@ -729,7 +745,7 @@ void * top() const; </pre></td> <td><pre> function Top_Item - (This : in Abstract_Browser) + (This : in Browser) return Item_Cursor; </pre></td> </tr> diff --git a/src/fltk-widgets-groups-browsers.adb b/src/fltk-widgets-groups-browsers.adb index bdf79e2..08ebd60 100644 --- a/src/fltk-widgets-groups-browsers.adb +++ b/src/fltk-widgets-groups-browsers.adb @@ -330,7 +330,7 @@ package body FLTK.Widgets.Groups.Browsers is -- Exported Hooks -- ---------------------- - package Browser_Convert is new System.Address_To_Access_Conversions (Abstract_Browser'Class); + package Browser_Convert is new System.Address_To_Access_Conversions (Browser'Class); function Full_Width_Hook @@ -342,7 +342,7 @@ package body FLTK.Widgets.Groups.Browsers is (Ada_Addr : in Storage.Integer_Address) return Interfaces.C.int is - Ada_Object : access Abstract_Browser'Class := + Ada_Object : access Browser'Class := Browser_Convert.To_Pointer (Storage.To_Address (Ada_Addr)); begin return Interfaces.C.int (Ada_Object.Full_List_Width); @@ -358,7 +358,7 @@ package body FLTK.Widgets.Groups.Browsers is (Ada_Addr : in Storage.Integer_Address) return Interfaces.C.int is - Ada_Object : access Abstract_Browser'Class := + Ada_Object : access Browser'Class := Browser_Convert.To_Pointer (Storage.To_Address (Ada_Addr)); begin return Interfaces.C.int (Ada_Object.Full_List_Height); @@ -374,7 +374,7 @@ package body FLTK.Widgets.Groups.Browsers is (Ada_Addr : in Storage.Integer_Address) return Interfaces.C.int is - Ada_Object : access Abstract_Browser'Class := + Ada_Object : access Browser'Class := Browser_Convert.To_Pointer (Storage.To_Address (Ada_Addr)); begin return Interfaces.C.int (Ada_Object.Average_Item_Height); @@ -390,7 +390,7 @@ package body FLTK.Widgets.Groups.Browsers is (Ada_Addr, Item_Ptr : in Storage.Integer_Address) return Interfaces.C.int is - Ada_Object : access Abstract_Browser'Class := + Ada_Object : access Browser'Class := Browser_Convert.To_Pointer (Storage.To_Address (Ada_Addr)); begin return Interfaces.C.int (Ada_Object.Item_Quick_Height (Address_To_Cursor (Item_Ptr))); @@ -406,7 +406,7 @@ package body FLTK.Widgets.Groups.Browsers is (Ada_Addr, Item_Ptr : in Storage.Integer_Address) return Interfaces.C.int is - Ada_Object : access Abstract_Browser'Class := + Ada_Object : access Browser'Class := Browser_Convert.To_Pointer (Storage.To_Address (Ada_Addr)); begin return Interfaces.C.int (Ada_Object.Item_Width (Address_To_Cursor (Item_Ptr))); @@ -422,7 +422,7 @@ package body FLTK.Widgets.Groups.Browsers is (Ada_Addr, Item_Ptr : in Storage.Integer_Address) return Interfaces.C.int is - Ada_Object : access Abstract_Browser'Class := + Ada_Object : access Browser'Class := Browser_Convert.To_Pointer (Storage.To_Address (Ada_Addr)); begin return Interfaces.C.int (Ada_Object.Item_Height (Address_To_Cursor (Item_Ptr))); @@ -438,7 +438,7 @@ package body FLTK.Widgets.Groups.Browsers is (Ada_Addr : in Storage.Integer_Address) return Storage.Integer_Address is - Ada_Object : access Abstract_Browser'Class := + Ada_Object : access Browser'Class := Browser_Convert.To_Pointer (Storage.To_Address (Ada_Addr)); begin return Cursor_To_Address (Ada_Object.Item_First); @@ -454,7 +454,7 @@ package body FLTK.Widgets.Groups.Browsers is (Ada_Addr : in Storage.Integer_Address) return Storage.Integer_Address is - Ada_Object : access Abstract_Browser'Class := + Ada_Object : access Browser'Class := Browser_Convert.To_Pointer (Storage.To_Address (Ada_Addr)); begin return Cursor_To_Address (Ada_Object.Item_Last); @@ -470,7 +470,7 @@ package body FLTK.Widgets.Groups.Browsers is (Ada_Addr, Item_Ptr : in Storage.Integer_Address) return Storage.Integer_Address is - Ada_Object : access Abstract_Browser'Class := + Ada_Object : access Browser'Class := Browser_Convert.To_Pointer (Storage.To_Address (Ada_Addr)); begin return Cursor_To_Address (Ada_Object.Item_Next (Address_To_Cursor (Item_Ptr))); @@ -486,7 +486,7 @@ package body FLTK.Widgets.Groups.Browsers is (Ada_Addr, Item_Ptr : in Storage.Integer_Address) return Storage.Integer_Address is - Ada_Object : access Abstract_Browser'Class := + Ada_Object : access Browser'Class := Browser_Convert.To_Pointer (Storage.To_Address (Ada_Addr)); begin return Cursor_To_Address (Ada_Object.Item_Previous (Address_To_Cursor (Item_Ptr))); @@ -504,7 +504,7 @@ package body FLTK.Widgets.Groups.Browsers is Index : in Interfaces.C.int) return Storage.Integer_Address is - Ada_Object : access Abstract_Browser'Class := + Ada_Object : access Browser'Class := Browser_Convert.To_Pointer (Storage.To_Address (Ada_Addr)); use type Interfaces.C.int; begin @@ -521,7 +521,7 @@ package body FLTK.Widgets.Groups.Browsers is (Ada_Addr, Item_Ptr : in Storage.Integer_Address; Int_State : in Interfaces.C.int) is - Ada_Object : access Abstract_Browser'Class := + Ada_Object : access Browser'Class := Browser_Convert.To_Pointer (Storage.To_Address (Ada_Addr)); use type Interfaces.C.int; begin @@ -540,7 +540,7 @@ package body FLTK.Widgets.Groups.Browsers is (Ada_Addr, Item_Ptr : in Storage.Integer_Address) return Interfaces.C.int is - Ada_Object : access Abstract_Browser'Class := + Ada_Object : access Browser'Class := Browser_Convert.To_Pointer (Storage.To_Address (Ada_Addr)); begin return Boolean'Pos (Ada_Object.Item_Selected (Address_To_Cursor (Item_Ptr))); @@ -554,7 +554,7 @@ package body FLTK.Widgets.Groups.Browsers is procedure Item_Swap_Hook (Ada_Addr, A_Ptr, B_Ptr : in Storage.Integer_Address) is - Ada_Object : access Abstract_Browser'Class := + Ada_Object : access Browser'Class := Browser_Convert.To_Pointer (Storage.To_Address (Ada_Addr)); begin Ada_Object.Item_Swap (Address_To_Cursor (A_Ptr), Address_To_Cursor (B_Ptr)); @@ -573,9 +573,6 @@ package body FLTK.Widgets.Groups.Browsers is -- At the time of writing this I have no idea how task safe FLTK is anyway. - Text_Hook_Storage : Interfaces.C.Strings.chars_ptr_array (1 .. 2); - Current_Text_Store : Interfaces.C.size_t := 1; - function Item_Text_Hook (Ada_Addr, Item_Ptr : in Storage.Integer_Address) return Interfaces.C.Strings.chars_ptr; @@ -585,18 +582,18 @@ package body FLTK.Widgets.Groups.Browsers is (Ada_Addr, Item_Ptr : in Storage.Integer_Address) return Interfaces.C.Strings.chars_ptr is - Ada_Object : access Abstract_Browser'Class := + Ada_Object : access Browser'Class := Browser_Convert.To_Pointer (Storage.To_Address (Ada_Addr)); begin - Interfaces.C.Strings.Free (Text_Hook_Storage (Current_Text_Store)); - Text_Hook_Storage (Current_Text_Store) := Interfaces.C.Strings.New_String + Interfaces.C.Strings.Free (Ada_Object.Text_Store (Ada_Object.Current)); + Ada_Object.Text_Store (Ada_Object.Current) := Interfaces.C.Strings.New_String (Ada_Object.Item_Text (Address_To_Cursor (Item_Ptr))); return C_Char_Is_Not_A_String : Interfaces.C.Strings.chars_ptr := - Text_Hook_Storage (Current_Text_Store) + Ada_Object.Text_Store (Ada_Object.Current) do - Current_Text_Store := Current_Text_Store + 1; - if Current_Text_Store > Text_Hook_Storage'Last then - Current_Text_Store := Text_Hook_Storage'First; + Ada_Object.Current := Ada_Object.Current + 1; + if Ada_Object.Current > Ada_Object.Text_Store'Last then + Ada_Object.Current := Ada_Object.Text_Store'First; end if; end return; end Item_Text_Hook; @@ -611,7 +608,7 @@ package body FLTK.Widgets.Groups.Browsers is (Ada_Addr, Item_Ptr : in Storage.Integer_Address; X, Y, W, H : in Interfaces.C.int) is - Ada_Object : access Abstract_Browser'Class := + Ada_Object : access Browser'Class := Browser_Convert.To_Pointer (Storage.To_Address (Ada_Addr)); begin Ada_Object.Item_Draw @@ -630,16 +627,19 @@ package body FLTK.Widgets.Groups.Browsers is ----------------------------------- procedure Extra_Final - (This : in out Abstract_Browser) is + (This : in out Browser) is begin Extra_Final (Widget (This.Horizon)); Extra_Final (Widget (This.Vertigo)); Extra_Final (Group (This)); + for Index in This.Text_Store'Range loop + Interfaces.C.Strings.Free (This.Text_Store (Index)); + end loop; end Extra_Final; procedure Finalize - (This : in out Abstract_Browser) is + (This : in out Browser) is begin Extra_Final (This); if This.Void_Ptr /= Null_Pointer and This.Needs_Dealloc then @@ -649,15 +649,6 @@ package body FLTK.Widgets.Groups.Browsers is end Finalize; - procedure Finalize - (This : in out Item_Text_Hook_Final_Controller) is - begin - for Index in Text_Hook_Storage'Range loop - Interfaces.C.Strings.Free (Text_Hook_Storage (Index)); - end loop; - end Finalize; - - --------------------------- @@ -665,7 +656,7 @@ package body FLTK.Widgets.Groups.Browsers is --------------------------- procedure Extra_Init - (This : in out Abstract_Browser; + (This : in out Browser; X, Y, W, H : in Integer; Text : in String) is begin @@ -696,9 +687,9 @@ package body FLTK.Widgets.Groups.Browsers is function Create (X, Y, W, H : in Integer; Text : in String := "") - return Abstract_Browser is + return Browser is begin - return This : Abstract_Browser do + return This : Browser do This.Void_Ptr := new_fl_abstract_browser (Interfaces.C.int (X), Interfaces.C.int (Y), @@ -717,7 +708,7 @@ package body FLTK.Widgets.Groups.Browsers is -- Access to the Browser's self contained scrollbars function H_Bar - (This : in out Abstract_Browser) + (This : in out Browser) return Valuators.Sliders.Scrollbars.Scrollbar_Reference is begin return (Data => This.Horizon'Unchecked_Access); @@ -725,7 +716,7 @@ package body FLTK.Widgets.Groups.Browsers is function V_Bar - (This : in out Abstract_Browser) + (This : in out Browser) return Valuators.Sliders.Scrollbars.Scrollbar_Reference is begin return (Data => This.Vertigo'Unchecked_Access); @@ -737,7 +728,7 @@ package body FLTK.Widgets.Groups.Browsers is -- Item related settings function Set_Select - (This : in out Abstract_Browser; + (This : in out Browser; Item : in Item_Cursor; State : in Boolean := True; Do_Callbacks : in Boolean := False) @@ -756,8 +747,26 @@ package body FLTK.Widgets.Groups.Browsers is end Set_Select; + procedure Set_Select + (This : in out Browser; + Item : in Item_Cursor; + State : in Boolean := True; + Do_Callbacks : in Boolean := False) + is + Code : Interfaces.C.int := fl_abstract_browser_select + (This.Void_Ptr, + Cursor_To_Address (Item), + Boolean'Pos (State), + Boolean'Pos (Do_Callbacks)); + begin + if Code not in 0 .. 1 then + raise Internal_FLTK_Error; + end if; + end Set_Select; + + function Select_Only - (This : in out Abstract_Browser; + (This : in out Browser; Item : in Item_Cursor; Do_Callbacks : in Boolean := False) return Boolean @@ -774,8 +783,24 @@ package body FLTK.Widgets.Groups.Browsers is end Select_Only; + procedure Select_Only + (This : in out Browser; + Item : in Item_Cursor; + Do_Callbacks : in Boolean := False) + is + Code : Interfaces.C.int := fl_abstract_browser_select_only + (This.Void_Ptr, + Cursor_To_Address (Item), + Boolean'Pos (Do_Callbacks)); + begin + if Code not in 0 .. 1 then + raise Internal_FLTK_Error; + end if; + end Select_Only; + + function Current_Selection - (This : in Abstract_Browser) + (This : in Browser) return Item_Cursor is begin return Address_To_Cursor (fl_abstract_browser_selection (This.Void_Ptr)); @@ -783,7 +808,7 @@ package body FLTK.Widgets.Groups.Browsers is function Deselect - (This : in out Abstract_Browser; + (This : in out Browser; Do_Callbacks : in Boolean := False) return Boolean is @@ -798,8 +823,22 @@ package body FLTK.Widgets.Groups.Browsers is end Deselect; + procedure Deselect + (This : in out Browser; + Do_Callbacks : in Boolean := False) + is + Code : Interfaces.C.int := fl_abstract_browser_deselect + (This.Void_Ptr, + Boolean'Pos (Do_Callbacks)); + begin + if Code not in 0 .. 1 then + raise Internal_FLTK_Error; + end if; + end Deselect; + + procedure Display - (This : in out Abstract_Browser; + (This : in out Browser; Item : in Item_Cursor) is begin fl_abstract_browser_display (This.Void_Ptr, Cursor_To_Address (Item)); @@ -807,7 +846,7 @@ package body FLTK.Widgets.Groups.Browsers is function Is_Displayed - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return Boolean is @@ -823,7 +862,7 @@ package body FLTK.Widgets.Groups.Browsers is function Find_Item - (This : in Abstract_Browser; + (This : in Browser; Y_Pos : in Integer) return Item_Cursor is begin @@ -833,7 +872,7 @@ package body FLTK.Widgets.Groups.Browsers is function Top_Item - (This : in Abstract_Browser) + (This : in Browser) return Item_Cursor is begin return Address_To_Cursor (fl_abstract_browser_top (This.Void_Ptr)); @@ -841,7 +880,7 @@ package body FLTK.Widgets.Groups.Browsers is procedure Sort - (This : in out Abstract_Browser; + (This : in out Browser; Order : in Sort_Order) is Code : Interfaces.C.int := @@ -858,7 +897,7 @@ package body FLTK.Widgets.Groups.Browsers is -- Scrollbar related settings function Get_Scrollbar_Mode - (This : in Abstract_Browser) + (This : in Browser) return Scrollbar_Mode is begin return Uchar_To_Mode (fl_abstract_browser_get_has_scrollbar (This.Void_Ptr)); @@ -866,7 +905,7 @@ package body FLTK.Widgets.Groups.Browsers is procedure Set_Scrollbar_Mode - (This : in out Abstract_Browser; + (This : in out Browser; Mode : in Scrollbar_Mode) is begin fl_abstract_browser_set_has_scrollbar (This.Void_Ptr, Mode_To_Uchar (Mode)); @@ -874,7 +913,7 @@ package body FLTK.Widgets.Groups.Browsers is function Get_H_Position - (This : in Abstract_Browser) + (This : in Browser) return Integer is begin return Integer (fl_abstract_browser_get_hposition (This.Void_Ptr)); @@ -882,7 +921,7 @@ package body FLTK.Widgets.Groups.Browsers is procedure Set_H_Position - (This : in out Abstract_Browser; + (This : in out Browser; Value : in Integer) is begin fl_abstract_browser_set_hposition @@ -892,7 +931,7 @@ package body FLTK.Widgets.Groups.Browsers is function Get_V_Position - (This : in Abstract_Browser) + (This : in Browser) return Integer is begin return Integer (fl_abstract_browser_get_position (This.Void_Ptr)); @@ -900,7 +939,7 @@ package body FLTK.Widgets.Groups.Browsers is procedure Set_V_Position - (This : in out Abstract_Browser; + (This : in out Browser; Value : in Integer) is begin fl_abstract_browser_set_position @@ -910,21 +949,21 @@ package body FLTK.Widgets.Groups.Browsers is procedure Set_Vertical_Left - (This : in out Abstract_Browser) is + (This : in out Browser) is begin fl_abstract_browser_scrollbar_left (This.Void_Ptr); end Set_Vertical_Left; procedure Set_Vertical_Right - (This : in out Abstract_Browser) is + (This : in out Browser) is begin fl_abstract_browser_scrollbar_right (This.Void_Ptr); end Set_Vertical_Right; function Get_Scrollbar_Size - (This : in Abstract_Browser) + (This : in Browser) return Integer is begin return Integer (fl_abstract_browser_get_scrollbar_size (This.Void_Ptr)); @@ -932,7 +971,7 @@ package body FLTK.Widgets.Groups.Browsers is procedure Set_Scrollbar_Size - (This : in out Abstract_Browser; + (This : in out Browser; Value : in Integer) is begin fl_abstract_browser_set_scrollbar_size @@ -946,7 +985,7 @@ package body FLTK.Widgets.Groups.Browsers is -- Text related settings function Get_Text_Color - (This : in Abstract_Browser) + (This : in Browser) return Color is begin return Color (fl_abstract_browser_get_textcolor (This.Void_Ptr)); @@ -954,7 +993,7 @@ package body FLTK.Widgets.Groups.Browsers is procedure Set_Text_Color - (This : in out Abstract_Browser; + (This : in out Browser; Value : in Color) is begin fl_abstract_browser_set_textcolor (This.Void_Ptr, Interfaces.C.unsigned (Value)); @@ -962,7 +1001,7 @@ package body FLTK.Widgets.Groups.Browsers is function Get_Text_Font - (This : in Abstract_Browser) + (This : in Browser) return Font_Kind is begin return Font_Kind'Val (fl_abstract_browser_get_textfont (This.Void_Ptr)); @@ -970,7 +1009,7 @@ package body FLTK.Widgets.Groups.Browsers is procedure Set_Text_Font - (This : in out Abstract_Browser; + (This : in out Browser; Font : in Font_Kind) is begin fl_abstract_browser_set_textfont (This.Void_Ptr, Font_Kind'Pos (Font)); @@ -978,7 +1017,7 @@ package body FLTK.Widgets.Groups.Browsers is function Get_Text_Size - (This : in Abstract_Browser) + (This : in Browser) return Font_Size is begin return Font_Size (fl_abstract_browser_get_textsize (This.Void_Ptr)); @@ -986,7 +1025,7 @@ package body FLTK.Widgets.Groups.Browsers is procedure Set_Text_Size - (This : in out Abstract_Browser; + (This : in out Browser; Size : in Font_Size) is begin fl_abstract_browser_set_textsize (This.Void_Ptr, Interfaces.C.int (Size)); @@ -998,7 +1037,7 @@ package body FLTK.Widgets.Groups.Browsers is -- Graphical dimensions and redrawing procedure Resize - (This : in out Abstract_Browser; + (This : in out Browser; X, Y, W, H : in Integer) is begin fl_abstract_browser_resize @@ -1011,7 +1050,7 @@ package body FLTK.Widgets.Groups.Browsers is procedure Bounding_Box - (This : in Abstract_Browser; + (This : in Browser; X, Y, W, H : out Integer) is begin fl_abstract_browser_bbox @@ -1024,7 +1063,7 @@ package body FLTK.Widgets.Groups.Browsers is function Left_Edge - (This : in Abstract_Browser) + (This : in Browser) return Integer is begin return Integer (fl_abstract_browser_leftedge (This.Void_Ptr)); @@ -1032,7 +1071,7 @@ package body FLTK.Widgets.Groups.Browsers is procedure Redraw_Line - (This : in out Abstract_Browser; + (This : in out Browser; Item : in Item_Cursor) is begin fl_abstract_browser_redraw_line (This.Void_Ptr, Cursor_To_Address (Item)); @@ -1040,7 +1079,7 @@ package body FLTK.Widgets.Groups.Browsers is procedure Redraw_List - (This : in out Abstract_Browser) is + (This : in out Browser) is begin fl_abstract_browser_redraw_lines (This.Void_Ptr); end Redraw_List; @@ -1051,7 +1090,7 @@ package body FLTK.Widgets.Groups.Browsers is -- Optional Override API function Full_List_Width - (This : in Abstract_Browser) + (This : in Browser) return Integer is begin return Integer (fl_abstract_browser_full_width (This.Void_Ptr)); @@ -1059,7 +1098,7 @@ package body FLTK.Widgets.Groups.Browsers is function Full_List_Height - (This : in Abstract_Browser) + (This : in Browser) return Integer is begin return Integer (fl_abstract_browser_full_height (This.Void_Ptr)); @@ -1067,7 +1106,7 @@ package body FLTK.Widgets.Groups.Browsers is function Average_Item_Height - (This : in Abstract_Browser) + (This : in Browser) return Integer is begin return Integer (fl_abstract_browser_incr_height (This.Void_Ptr)); @@ -1075,7 +1114,7 @@ package body FLTK.Widgets.Groups.Browsers is function Item_Quick_Height - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return Integer is begin @@ -1090,96 +1129,96 @@ package body FLTK.Widgets.Groups.Browsers is -- Mandatory Override API function Item_Width - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return Integer is begin - return raise Program_Error with "Abstract_Browser Item_Width must be overridden"; + return raise Program_Error with "Browser Item_Width must be overridden"; end Item_Width; function Item_Height - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return Integer is begin - return raise Program_Error with "Abstract_Browser Item_Height must be overridden"; + return raise Program_Error with "Browser Item_Height must be overridden"; end Item_Height; function Item_First - (This : in Abstract_Browser) + (This : in Browser) return Item_Cursor is begin - return raise Program_Error with "Abstract_Browser Item_First must be overridden"; + return raise Program_Error with "Browser Item_First must be overridden"; end Item_First; function Item_Last - (This : in Abstract_Browser) + (This : in Browser) return Item_Cursor is begin - return raise Program_Error with "Abstract_Browser Item_Last must be overridden"; + return raise Program_Error with "Browser Item_Last must be overridden"; end Item_Last; function Item_Next - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return Item_Cursor is begin - return raise Program_Error with "Abstract_Browser Item_Next must be overridden"; + return raise Program_Error with "Browser Item_Next must be overridden"; end Item_Next; function Item_Previous - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return Item_Cursor is begin - return raise Program_Error with "Abstract_Browser Item_Previous must be overridden"; + return raise Program_Error with "Browser Item_Previous must be overridden"; end Item_Previous; function Item_At - (This : in Abstract_Browser; + (This : in Browser; Index : in Positive) return Item_Cursor is begin - return raise Program_Error with "Abstract_Browser Item_At must be overridden"; + return raise Program_Error with "Browser Item_At must be overridden"; end Item_At; procedure Item_Select - (This : in out Abstract_Browser; + (This : in out Browser; Item : in Item_Cursor; State : in Boolean := True) is begin - raise Program_Error with "Abstract_Browser Item_Select must be overridden"; + raise Program_Error with "Browser Item_Select must be overridden"; end Item_Select; function Item_Selected - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return Boolean is begin - return raise Program_Error with "Abstract_Browser Item_Selected must be overridden"; + return raise Program_Error with "Browser Item_Selected must be overridden"; end Item_Selected; procedure Item_Swap - (This : in out Abstract_Browser; + (This : in out Browser; A, B : in Item_Cursor) is begin - raise Program_Error with "Abstract_Browser Item_Swap must be overridden"; + raise Program_Error with "Browser Item_Swap must be overridden"; end Item_Swap; function Item_Text - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return String is begin - return raise Program_Error with "Abstract_Browser Item_Text must be overridden"; + return raise Program_Error with "Browser Item_Text must be overridden"; end Item_Text; procedure Item_Draw - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor; X, Y, W, H : in Integer) is begin - raise Program_Error with "Abstract_Browser Item_Draw must be overridden"; + raise Program_Error with "Browser Item_Draw must be overridden"; end Item_Draw; @@ -1188,14 +1227,14 @@ package body FLTK.Widgets.Groups.Browsers is -- Cache invalidation procedure New_List - (This : in out Abstract_Browser) is + (This : in out Browser) is begin fl_abstract_browser_new_list (This.Void_Ptr); end New_List; procedure Inserting - (This : in out Abstract_Browser; + (This : in out Browser; A, B : in Item_Cursor) is begin fl_abstract_browser_inserting @@ -1206,7 +1245,7 @@ package body FLTK.Widgets.Groups.Browsers is procedure Deleting - (This : in out Abstract_Browser; + (This : in out Browser; Item : in Item_Cursor) is begin fl_abstract_browser_deleting @@ -1216,7 +1255,7 @@ package body FLTK.Widgets.Groups.Browsers is procedure Replacing - (This : in out Abstract_Browser; + (This : in out Browser; A, B : in Item_Cursor) is begin fl_abstract_browser_replacing @@ -1227,7 +1266,7 @@ package body FLTK.Widgets.Groups.Browsers is procedure Swapping - (This : in out Abstract_Browser; + (This : in out Browser; A, B : in Item_Cursor) is begin fl_abstract_browser_swapping @@ -1242,14 +1281,14 @@ package body FLTK.Widgets.Groups.Browsers is -- Standard Override API procedure Draw - (This : in out Abstract_Browser) is + (This : in out Browser) is begin fl_abstract_browser_draw (This.Void_Ptr); end Draw; function Handle - (This : in out Abstract_Browser; + (This : in out Browser; Event : in Event_Kind) return Event_Outcome is begin diff --git a/src/fltk-widgets-groups-browsers.ads b/src/fltk-widgets-groups-browsers.ads index 66cfdd3..1ba16dd 100644 --- a/src/fltk-widgets-groups-browsers.ads +++ b/src/fltk-widgets-groups-browsers.ads @@ -11,17 +11,16 @@ with private with - Ada.Finalization, Ada.Unchecked_Conversion, - Interfaces.C; + Interfaces.C.Strings; package FLTK.Widgets.Groups.Browsers is - type Abstract_Browser is new Group with private; + type Browser is new Group with private; - type Abstract_Browser_Reference (Data : not null access Abstract_Browser'Class) is + type Browser_Reference (Data : not null access Browser'Class) is limited null record with Implicit_Dereference => Data; type Item_Cursor is mod System.Memory_Size; @@ -44,7 +43,7 @@ package FLTK.Widgets.Groups.Browsers is function Create (X, Y, W, H : in Integer; Text : in String := "") - return Abstract_Browser; + return Browser; end Forge; @@ -54,11 +53,11 @@ package FLTK.Widgets.Groups.Browsers is -- Access to the Browser's self contained scrollbars function H_Bar - (This : in out Abstract_Browser) + (This : in out Browser) return Valuators.Sliders.Scrollbars.Scrollbar_Reference; function V_Bar - (This : in out Abstract_Browser) + (This : in out Browser) return Valuators.Sliders.Scrollbars.Scrollbar_Reference; @@ -67,49 +66,64 @@ package FLTK.Widgets.Groups.Browsers is -- Item related settings function Set_Select - (This : in out Abstract_Browser; + (This : in out Browser; Item : in Item_Cursor; State : in Boolean := True; Do_Callbacks : in Boolean := False) return Boolean; + procedure Set_Select + (This : in out Browser; + Item : in Item_Cursor; + State : in Boolean := True; + Do_Callbacks : in Boolean := False); + function Select_Only - (This : in out Abstract_Browser; + (This : in out Browser; Item : in Item_Cursor; Do_Callbacks : in Boolean := False) return Boolean; + procedure Select_Only + (This : in out Browser; + Item : in Item_Cursor; + Do_Callbacks : in Boolean := False); + function Current_Selection - (This : in Abstract_Browser) + (This : in Browser) return Item_Cursor; function Deselect - (This : in out Abstract_Browser; + (This : in out Browser; Do_Callbacks : in Boolean := False) return Boolean; + procedure Deselect + (This : in out Browser; + Do_Callbacks : in Boolean := False); + procedure Display - (This : in out Abstract_Browser; + (This : in out Browser; Item : in Item_Cursor); function Is_Displayed - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return Boolean; function Find_Item - (This : in Abstract_Browser; + (This : in Browser; Y_Pos : in Integer) return Item_Cursor; function Top_Item - (This : in Abstract_Browser) + (This : in Browser) return Item_Cursor; -- Not task safe due to internal issues with converting Ada Strings to char* in C. -- Unsure how much that matters since unsure how task safe FLTK is anyway. procedure Sort - (This : in out Abstract_Browser; + (This : in out Browser; Order : in Sort_Order); @@ -118,41 +132,41 @@ package FLTK.Widgets.Groups.Browsers is -- Scrollbar related settings function Get_Scrollbar_Mode - (This : in Abstract_Browser) + (This : in Browser) return Scrollbar_Mode; procedure Set_Scrollbar_Mode - (This : in out Abstract_Browser; + (This : in out Browser; Mode : in Scrollbar_Mode); function Get_H_Position - (This : in Abstract_Browser) + (This : in Browser) return Integer; procedure Set_H_Position - (This : in out Abstract_Browser; + (This : in out Browser; Value : in Integer); function Get_V_Position - (This : in Abstract_Browser) + (This : in Browser) return Integer; procedure Set_V_Position - (This : in out Abstract_Browser; + (This : in out Browser; Value : in Integer); procedure Set_Vertical_Left - (This : in out Abstract_Browser); + (This : in out Browser); procedure Set_Vertical_Right - (This : in out Abstract_Browser); + (This : in out Browser); function Get_Scrollbar_Size - (This : in Abstract_Browser) + (This : in Browser) return Integer; procedure Set_Scrollbar_Size - (This : in out Abstract_Browser; + (This : in out Browser; Value : in Integer); @@ -161,27 +175,27 @@ package FLTK.Widgets.Groups.Browsers is -- Text related settings function Get_Text_Color - (This : in Abstract_Browser) + (This : in Browser) return Color; procedure Set_Text_Color - (This : in out Abstract_Browser; + (This : in out Browser; Value : in Color); function Get_Text_Font - (This : in Abstract_Browser) + (This : in Browser) return Font_Kind; procedure Set_Text_Font - (This : in out Abstract_Browser; + (This : in out Browser; Font : in Font_Kind); function Get_Text_Size - (This : in Abstract_Browser) + (This : in Browser) return Font_Size; procedure Set_Text_Size - (This : in out Abstract_Browser; + (This : in out Browser; Size : in Font_Size); @@ -190,23 +204,23 @@ package FLTK.Widgets.Groups.Browsers is -- Graphical dimensions and redrawing procedure Resize - (This : in out Abstract_Browser; + (This : in out Browser; X, Y, W, H : in Integer); procedure Bounding_Box - (This : in Abstract_Browser; + (This : in Browser; X, Y, W, H : out Integer); function Left_Edge - (This : in Abstract_Browser) + (This : in Browser) return Integer; procedure Redraw_Line - (This : in out Abstract_Browser; + (This : in out Browser; Item : in Item_Cursor); procedure Redraw_List - (This : in out Abstract_Browser); + (This : in out Browser); @@ -215,83 +229,83 @@ package FLTK.Widgets.Groups.Browsers is -- even though these are called from within FLTK. function Full_List_Width - (This : in Abstract_Browser) + (This : in Browser) return Integer; function Full_List_Height - (This : in Abstract_Browser) + (This : in Browser) return Integer; function Average_Item_Height - (This : in Abstract_Browser) + (This : in Browser) return Integer; function Item_Quick_Height - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return Integer; - -- You MUST override these subprograms if deriving a type from Abstract_Browser - -- or your program will crash, since they are called from within FLTK and do not - -- have any implementations given. By default here they will raise an exception. + -- You MUST override these subprograms if deriving a type from Browser or your + -- program will crash, since they are called from within FLTK and do not have + -- any implementations given. By default here they will raise an exception. function Item_Width - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return Integer; function Item_Height - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return Integer; function Item_First - (This : in Abstract_Browser) + (This : in Browser) return Item_Cursor; function Item_Last - (This : in Abstract_Browser) + (This : in Browser) return Item_Cursor; function Item_Next - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return Item_Cursor; function Item_Previous - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return Item_Cursor; function Item_At - (This : in Abstract_Browser; + (This : in Browser; Index : in Positive) return Item_Cursor; procedure Item_Select - (This : in out Abstract_Browser; + (This : in out Browser; Item : in Item_Cursor; State : in Boolean := True); function Item_Selected - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return Boolean; procedure Item_Swap - (This : in out Abstract_Browser; + (This : in out Browser; A, B : in Item_Cursor); function Item_Text - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor) return String; procedure Item_Draw - (This : in Abstract_Browser; + (This : in Browser; Item : in Item_Cursor; X, Y, W, H : in Integer); @@ -301,22 +315,22 @@ package FLTK.Widgets.Groups.Browsers is -- Cache invalidation procedure New_List - (This : in out Abstract_Browser); + (This : in out Browser); procedure Inserting - (This : in out Abstract_Browser; + (This : in out Browser; A, B : in Item_Cursor); procedure Deleting - (This : in out Abstract_Browser; + (This : in out Browser; Item : in Item_Cursor); procedure Replacing - (This : in out Abstract_Browser; + (This : in out Browser; A, B : in Item_Cursor); procedure Swapping - (This : in out Abstract_Browser; + (This : in out Browser; A, B : in Item_Cursor); @@ -326,10 +340,10 @@ package FLTK.Widgets.Groups.Browsers is -- even though these are called from within FLTK. procedure Draw - (This : in out Abstract_Browser); + (This : in out Browser); function Handle - (This : in out Abstract_Browser; + (This : in out Browser; Event : in Event_Kind) return Event_Outcome; @@ -337,21 +351,23 @@ package FLTK.Widgets.Groups.Browsers is private - type Abstract_Browser is new Group with record - Horizon : aliased Valuators.Sliders.Scrollbars.Scrollbar; - Vertigo : aliased Valuators.Sliders.Scrollbars.Scrollbar; + type Browser is new Group with record + Horizon : aliased Valuators.Sliders.Scrollbars.Scrollbar; + Vertigo : aliased Valuators.Sliders.Scrollbars.Scrollbar; + Text_Store : Interfaces.C.Strings.chars_ptr_array (1 .. 2); + Current : Interfaces.C.size_t := 1; end record; overriding procedure Finalize - (This : in out Abstract_Browser); + (This : in out Browser); procedure Extra_Init - (This : in out Abstract_Browser; + (This : in out Browser; X, Y, W, H : in Integer; Text : in String); procedure Extra_Final - (This : in out Abstract_Browser); + (This : in out Browser); pragma Assert @@ -428,15 +444,6 @@ private pragma Inline (Handle); - -- Needed to ensure chars_ptr storage is properly cleaned up - type Item_Text_Hook_Final_Controller is new Ada.Finalization.Controlled with null record; - - overriding procedure Finalize - (This : in out Item_Text_Hook_Final_Controller); - - Cleanup : Item_Text_Hook_Final_Controller; - - end FLTK.Widgets.Groups.Browsers; |