1. with Widgets.Menu_Items;                use Widgets.Menu_Items; 
  2.  
  3. package Widgets.Containers.Panels.Popups is 
  4.  
  5.     -- A popup widget is a menu widget that contains a single column of 
  6.     -- Menu_Items. It allows widgets to register for notifications when the 
  7.     -- widget loses visibility. It's minimum size is calculated from the minimum 
  8.     -- size of its children so its size can be computed automatically. The popup 
  9.     -- widget registers itself as a listener for menu items added to it, and 
  10.     -- hides automatically when the menu item is activated. 
  11.     type Popup is new Panel and Menu_Listener with private; 
  12.     type A_Popup is access all Popup'Class; 
  13.  
  14.     function Create_Popup( view  : not null access Game_Views.Game_View'Class; 
  15.                            id    : String; 
  16.                            title : String := ""; 
  17.                            icon  : String := "" ) return A_Popup; 
  18.     pragma Precondition( id'Length > 0 ); 
  19.     pragma Postcondition( Create_Popup'Result /= null ); 
  20.  
  21.     procedure Add( this    : access Popup; 
  22.                    child   : in out A_Widget; 
  23.                    consume : Boolean := True ); 
  24.     pragma Precondition( child /= null ); 
  25.     pragma Postcondition( consume xor child /= null ); 
  26.  
  27. private 
  28.  
  29.     type Popup is new Panel and Menu_Listener with null record; 
  30.  
  31.     procedure Construct( this  : access Popup; 
  32.                          view  : not null access Game_Views.Game_View'Class; 
  33.                          id    : String; 
  34.                          title : String; 
  35.                          icon  : String ); 
  36.     pragma Precondition( id'Length > 0 ); 
  37.  
  38.     function Get_Min_Height( this : access Popup ) return Natural; 
  39.  
  40.     function Get_Min_Width( this : access Popup ) return Natural; 
  41.  
  42.     -- Hides the widget when a child menu item is activated. 
  43.     procedure Handle_Action( this   : access Popup; 
  44.                              action : A_Menu_Action ); 
  45.  
  46.     procedure Pack( this : access Popup ); 
  47.  
  48. end Widgets.Containers.Panels.Popups;