1. with Events.Listeners;                  use Events.Listeners; 
  2. with Tiles.Matrices;                    use Tiles.Matrices; 
  3.  
  4. private with Ada.Containers.Vectors; 
  5. private with Events; 
  6. private with Tiles.Libraries; 
  7.  
  8. package Widgets.Palettes.Matrices is 
  9.  
  10.     type Matrix_Palette is abstract new Palette and Event_Listener with private; 
  11.  
  12.     function Create_Matrix_Palette( view : not null access Game_Views.Game_View'Class; 
  13.                                     id   : String ) return A_Palette; 
  14.  
  15.     -- Raises an error if tile library 'name' can't be loaded. 
  16.     procedure Set_Library_Name( this : access Matrix_Palette; name : String ); 
  17.  
  18. private 
  19.  
  20.     use Events; 
  21.     use Tiles.Libraries; 
  22.  
  23.     ---------------------------------------------------------------------------- 
  24.  
  25.     type Matrix_Rec is 
  26.         record 
  27.             matrix : A_Tile_Matrix := null; 
  28.             row, 
  29.             col, 
  30.             height, 
  31.             width      : Natural := 0; 
  32.         end record; 
  33.  
  34.     function "="( l, r : Matrix_Rec ) return Boolean; 
  35.  
  36.     package Matrix_Vectors is new Ada.Containers.Vectors( Positive, Matrix_Rec, "=" ); 
  37.  
  38.     ---------------------------------------------------------------------------- 
  39.  
  40.     type Matrix_Palette is new Palette and Event_Listener with 
  41.         record 
  42.             lib       : A_Tile_Library := null; 
  43.             matrices  : Matrix_Vectors.Vector; 
  44.             itemCount : Integer := 0;      -- number of slots in the palette 
  45.         end record; 
  46.  
  47.     procedure Construct( this : access Matrix_Palette; 
  48.                          view : not null access Game_Views.Game_View'Class; 
  49.                          id   : String ); 
  50.  
  51.     procedure Delete( this : in out Matrix_Palette ); 
  52.  
  53.     procedure Get_Item_Details( this   : access Matrix_Palette; 
  54.                                 row, 
  55.                                 col    : Natural; 
  56.                                 bmp    : out A_Bitmap; 
  57.                                 border : out Color_Type ); 
  58.  
  59.     function Get_Scroll_Inc_Y( this : access Matrix_Palette ) return Integer; 
  60.  
  61.     function Get_Item_Count( this : access Matrix_Palette ) return Natural; 
  62.  
  63.     procedure Handle_Event( this : access Matrix_Palette; 
  64.                             evt  : in out A_Event; 
  65.                             resp : out Response_Type ); 
  66.  
  67.     procedure Handle_Mouse_Press( this : access Matrix_Palette; 
  68.                                   evt  : not null A_Mouse_Button_Event ); 
  69.  
  70. end Widgets.Palettes.Matrices;