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.             toolGrp, 
  49.             layerGrp    : A_Button_Group := null; 
  50.             nextAction  : Dialog_Action := DA_None; 
  51.         end record; 
  52.  
  53.     procedure Delete( this : in out Ked_View ); 
  54.  
  55.     procedure Handle_Close_Request( this : access Ked_View ); 
  56.  
  57.     procedure Handle_Event( this : access Ked_View; 
  58.                             evt  : in out A_Event; 
  59.                             resp : out Response_Type ); 
  60.     pragma Precondition( evt /= null ); 
  61.  
  62.     procedure Handle_Paused( this : access Ked_View; paused : Boolean ); 
  63.  
  64.     function Is_Modified( this : not null access Ked_View'Class ) return Boolean; 
  65.  
  66.     function Is_World_Loaded( this : not null access Ked_View'Class ) return Boolean; 
  67.  
  68.     procedure Populate_View( this  : not null access Ked_View'Class; 
  69.                              xres, 
  70.                              yres, 
  71.                              scale : Integer ); 
  72.  
  73.     procedure Set_Filename( this : access Ked_View; filename : String ); 
  74.  
  75.     procedure Set_Gridsnap( this : access Ked_View; enabled : Boolean ); 
  76.  
  77.     procedure Set_Modified( this : access Ked_View; modified : Boolean ); 
  78.  
  79.     procedure Start( this : access Ked_View ); 
  80.  
  81.     procedure Stop( this : access Ked_View ); 
  82.  
  83.     procedure Tick( this : access Ked_View; upTime, dt : Time_Span ); 
  84.  
  85.     procedure Update_Win_Title( this : access Ked_View ); 
  86.  
  87. end Game_Views.Ked;