1. private with Ada.Containers.Doubly_Linked_Lists; 
  2.  
  3. package Widgets.Buttons.Groups is 
  4.  
  5.     type Button_Group is new Object and Button_Listener with private; 
  6.     type A_Button_Group is access all Button_Group'Class; 
  7.  
  8.     function Create_Button_Group return A_Button_Group; 
  9.     pragma Postcondition( Create_Button_Group'Result /= null ); 
  10.  
  11.     procedure Add( this : access Button_Group; button : not null A_Button ); 
  12.  
  13.     procedure Clear( this : access Button_Group ); 
  14.  
  15.     procedure Unset( this : access Button_Group ); 
  16.  
  17.     procedure Set_Keep_Selected( this : access Button_Group; keep : Boolean ); 
  18.  
  19.     -- Deletes the Button_Group. 
  20.     procedure Delete( this : in out A_Button_Group ); 
  21.     pragma Postcondition( this = null ); 
  22.  
  23. private 
  24.  
  25.     package Button_Collection is new Ada.Containers.Doubly_Linked_Lists( A_Button, "=" ); 
  26.     use Button_Collection; 
  27.  
  28.     ---------------------------------------------------------------------------- 
  29.  
  30.     type Button_Group is new Object and Button_Listener with 
  31.         record 
  32.             buttons       : Button_Collection.List; 
  33.             pressed       : A_Button := null; 
  34.             keep_selected : Boolean := True;  -- force a button to remain selected 
  35.         end record; 
  36.  
  37.     procedure Delete( this : in out Button_Group ); 
  38.  
  39.     procedure Handle_Action( this   : access Button_Group; 
  40.                              action : A_Button_Action ); 
  41.  
  42.     -- action has an action_id (hashed string) 
  43.     -- button_action extends action 
  44.     -- determine the type of button action by looking at the action.id 
  45.     -- for something like input_action, get the text from the input_action passed to the handler 
  46.     -- widgets store list of generic action listeners 
  47.     --   specific widget types allow adding specific action listeners 
  48.     --   recast from generic collection in widget class to specific listeners when dispatching action 
  49.  
  50.     function To_String( this : access Button_Group ) return String; 
  51.  
  52. end Widgets.Buttons.Groups;