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 Keyboard;                          use Keyboard; 
  10. with Objects;                           use Objects; 
  11. with Worlds;                            use Worlds; 
  12.  
  13. package Tools is 
  14.  
  15.     type Tool_Type is ( 
  16.         Pointer_Tool, 
  17.         Paint_Tool, 
  18.         Matrix_Tool, 
  19.         Entity_Tool, 
  20.         Trigger_Tool 
  21.     ); 
  22.  
  23.     type Function_Type is ( Primary, Secondary, Tertiary ); 
  24.  
  25.     -- Provided to the tool when it is applied, to encapsulate all the 
  26.     -- information necessary for the tool to apply itself. 
  27.     type Tool_Context is 
  28.         record 
  29.             func      : Function_Type; 
  30.             modifiers : Modifiers_Array; 
  31.             first     : Boolean; 
  32.             world     : A_World; 
  33.             worldX, 
  34.             worldY, 
  35.             layer     : Integer; 
  36.         end record; 
  37.  
  38.     type Tool is abstract new Object with private; 
  39.     type A_Tool is access all Tool'Class; 
  40.  
  41.     procedure Apply( this    : access Tool; 
  42.                      context : Tool_Context ) is abstract; 
  43.  
  44.     function Get_Type( this : access Tool ) return Tool_Type is abstract; 
  45.  
  46.     function Copy( src : A_Tool ) return A_Tool; 
  47.     pragma Postcondition( Copy'Result /= src or else src = null ); 
  48.  
  49.     -- Deletes the Tool. 
  50.     procedure Delete( this : in out A_Tool ); 
  51.  
  52. private 
  53.  
  54.     type Tool is abstract new Object with null record; 
  55.  
  56. end Tools;