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 Events.Listeners;                  use Events.Listeners; 
  10. with Tiles.Libraries;                   use Tiles.Libraries; 
  11.  
  12. private with Ada.Containers.Vectors; 
  13. private with Events; 
  14.  
  15. package Widgets.Palettes.Tiles is 
  16.  
  17.     type Tile_Palette is abstract new Palette and Event_Listener with private; 
  18.  
  19.     function Create_Tile_Palette( view : not null access Game_Views.Game_View'Class; 
  20.                                   id   : String ) return A_Palette; 
  21.  
  22.     -- Raises an error if tile library 'name' can't be loaded. 
  23.     procedure Set_Library_Name( this : not null access Tile_Palette'Class; 
  24.                                 name : String ); 
  25.  
  26. private 
  27.  
  28.     use Events; 
  29.  
  30.     package Integer_Vectors is new Ada.Containers.Vectors( Positive, Natural, "=" ); 
  31.  
  32.     ---------------------------------------------------------------------------- 
  33.  
  34.     type Tile_Palette is new Palette and Event_Listener with 
  35.         record 
  36.             lib   : A_Tile_Library := null; 
  37.             slots : Integer_Vectors.Vector; 
  38.         end record; 
  39.  
  40.     procedure Construct( this : access Tile_Palette; 
  41.                          view : not null access Game_Views.Game_View'Class; 
  42.                          id   : String ); 
  43.  
  44.     procedure Delete( this : in out Tile_Palette ); 
  45.  
  46.     procedure Get_Item_Details( this   : access Tile_Palette; 
  47.                                 row, 
  48.                                 col    : Natural; 
  49.                                 bmp    : out A_Allegro_Bitmap; 
  50.                                 border : out Allegro_Color ); 
  51.  
  52.     function Get_Scroll_Inc_Y( this : access Tile_Palette ) return Integer; 
  53.  
  54.     function Get_Item_Count( this : access Tile_Palette ) return Natural; 
  55.  
  56.     procedure Handle_Event( this : access Tile_Palette; 
  57.                             evt  : in out A_Event; 
  58.                             resp : out Response_Type ); 
  59.  
  60.     procedure On_Mouse_Press( this : access Tile_Palette; 
  61.                               evt  : not null A_Mouse_Button_Event ); 
  62.  
  63. end Widgets.Palettes.Tiles;