1. private with Ada.Strings.Unbounded; 
  2. private with Widgets.Buttons; 
  3. private with Widgets.Buttons.Groups; 
  4.  
  5. package Game_Views.Ked is 
  6.  
  7.     type Dialog_Action is ( DA_None, DA_New, DA_Open, DA_Import, DA_Quit, DA_Save ); 
  8.  
  9.     type Ked_View is new Game_View with private; 
  10.     type A_Ked_View is access all Ked_View'Class; 
  11.  
  12.     -- Performs a dialog action. If the world has been modified and saveChanges 
  13.     -- is True, the dialog action will be postponed and the Save Changes 
  14.     -- confirmation dialog will be shown first. 
  15.     procedure Do_Dialog_Action( this        : access Ked_View; 
  16.                                 action      : Dialog_Action; 
  17.                                 saveChanges : Boolean ); 
  18.  
  19.     -- Performs the previously requested dialog action, or nothing if one hasn't 
  20.     -- been requested yet. If saveChanges is true then changes will be saved 
  21.     -- before performing the dialog action if the current world has a filename. 
  22.     -- If the world doesn't have a filename, the previously requested dialog 
  23.     -- action will be postponed and the save world dialog will be shown first. 
  24.     procedure Do_Dialog_Action( this        : access Ked_View; 
  25.                                 saveChanges : Boolean ); 
  26.  
  27.     function Get_Filename( this : not null access Ked_View'Class ) return String; 
  28.  
  29.     -- Raises an exception on error. 
  30.     procedure Save_World( this : access Ked_View; filename : String ); 
  31.     pragma Precondition( filename'Length > 0 ); 
  32.  
  33. private 
  34.  
  35.     use Ada.Strings.Unbounded; 
  36.     use Widgets.Buttons; 
  37.     use Widgets.Buttons.Groups; 
  38.  
  39.     ---------------------------------------------------------------------------- 
  40.  
  41.     type Ked_View is new Game_View with 
  42.         record 
  43.             initialized : Boolean := False; 
  44.             loaded      : Boolean := False;     -- world is loaded 
  45.             modified    : Boolean := False;     -- world modified since load/create? 
  46.             filename    : Unbounded_String;     -- world filename 
  47.             gridsnap    : Boolean := True;      -- snap items to grid 
  48.             paletteGrp, 
  49.             layerGrp    : A_Button_Group := null; 
  50.             nextAction  : Dialog_Action := DA_None; 
  51.             paletteOn   : Boolean := False; 
  52.         end record; 
  53.  
  54.     procedure Delete( this : in out Ked_View ); 
  55.  
  56.     procedure Handle_Close_Request( this : access Ked_View ); 
  57.  
  58.     procedure Handle_Event( this : access Ked_View; 
  59.                             evt  : in out A_Event; 
  60.                             resp : out Response_Type ); 
  61.     pragma Precondition( evt /= null ); 
  62.  
  63.     procedure Handle_Paused( this : access Ked_View; paused : Boolean ); 
  64.  
  65.     function Is_Modified( this : not null access Ked_View'Class ) return Boolean; 
  66.  
  67.     function Is_World_Loaded( this : not null access Ked_View'Class ) return Boolean; 
  68.  
  69.     procedure Populate_View( this  : not null access Ked_View'Class; 
  70.                              xres, 
  71.                              yres, 
  72.                              scale : Integer ); 
  73.  
  74.     procedure Set_Filename( this : access Ked_View; filename : String ); 
  75.  
  76.     procedure Set_Gridsnap( this : access Ked_View; enabled : Boolean ); 
  77.  
  78.     procedure Set_Modified( this : access Ked_View; modified : Boolean ); 
  79.  
  80.     procedure Start( this : access Ked_View ); 
  81.  
  82.     procedure Stop( this : access Ked_View ); 
  83.  
  84.     procedure Toggle_Palette( this : access Ked_View; on : Boolean ); 
  85.  
  86.     procedure Update_Win_Title( this : access Ked_View ); 
  87.  
  88. end Game_Views.Ked;