1. -- 
  2. -- Copyright (c) 2012 Kevin Wellwood 
  3. -- All rights reserved. 
  4. -- 
  5. -- This source code is distributed under the Modified BSD License. For terms and 
  6. -- conditions, see license.txt. 
  7. -- 
  8.  
  9. with Scrollables;                       use Scrollables; 
  10.  
  11. package Widgets.Palettes is 
  12.  
  13.     type Palette is abstract new Widget and Scrollable with private; 
  14.     type A_Palette is access all Palette'Class; 
  15.  
  16.     function Get_Item_Count( this : access Palette ) return Natural is abstract; 
  17.  
  18.     procedure Get_Item_Details( this   : access Palette; 
  19.                                 row, 
  20.                                 col    : Natural; 
  21.                                 bmp    : out A_Allegro_Bitmap; 
  22.                                 border : out Allegro_Color ) is abstract; 
  23.  
  24.     procedure Set_Columns( this : not null access Palette'Class; columns : Natural ); 
  25.  
  26.     procedure Set_Icon_Size( this   : not null access Palette'Class; 
  27.                              width, 
  28.                              height : Positive ); 
  29.  
  30. private 
  31.  
  32.     type Palette is abstract new Widget and Scrollable with 
  33.         record 
  34.             columns      : Natural := 1; 
  35.             iconHeight, 
  36.             iconWidth    : Positive := 16; 
  37.             highlightRow, 
  38.             highlightCol : Integer := 0; 
  39.             selectedItem : Integer := 0; 
  40.         end record; 
  41.  
  42.     procedure Construct( this : access Palette; 
  43.                          view : not null access Game_Views.Game_View'Class; 
  44.                          id   : String ); 
  45.     pragma Precondition( id'Length > 0 ); 
  46.  
  47.     procedure Draw_Content( this : access Palette ); 
  48.  
  49.     function Get_Min_Height( this : access Palette ) return Natural; 
  50.  
  51.     function Get_Min_Width( this : access Palette ) return Natural; 
  52.  
  53.     function Get_Scroll_Inc_X( this : access Palette ) return Integer; 
  54.  
  55.     function Get_Scroll_Inc_Y( this : access Palette ) return Integer; 
  56.  
  57.     procedure Get_Selected( this : not null access Palette'Class; 
  58.                             row, 
  59.                             col  : out Natural ); 
  60.  
  61.     procedure On_Exit( this : access Palette ); 
  62.  
  63.     procedure On_Mouse_Move( this : access Palette; 
  64.                              evt  : not null A_Mouse_Event ); 
  65.  
  66. end Widgets.Palettes;