--
-- Copyright (c) 2012 Kevin Wellwood
-- All rights reserved.
--
-- This source code is distributed under the Modified BSD License. For terms and
-- conditions, see license.txt.
--
with Widgets.Containers; use Widgets.Containers;
with Widgets.Containers.Game_Screens; use Widgets.Containers.Game_Screens;
package Widgets.Containers.Screen_Managers is
-- A Screen_Manager manages a collection of Game_Screens as a stack,
-- displaying the top screen. A Game_Screen obscures the screens beneath it
-- unless it is a lightweight popup screen that is intended to have a
-- transparent background.
type Screen_Manager is new Container and Animated with private;
type A_Screen_Manager is access all Screen_Manager'Class;
-- Creates a new, empty screen manager.
function Create_Screen_Manager( view : not null access Game_Views.Game_View'Class;
id : String ) return A_Screen_Manager;
-- Adds a new screen to the top of the screen stack, activating it. If the
-- screen is a popup, then the screen(s) beneath it will remain visible.
-- Otherwise 'screen' will obscure the current top screen and the currently
-- active screen(s) will be deactivated. 'screen' will be consumed.
procedure Add_Screen( this : not null access Screen_Manager'Class;
screen : in out A_Game_Screen );
pragma Precondition( screen /= null );
pragma Postcondition( screen = null );
private
type Screen_Manager is new Container and Animated with null record;
procedure Construct( this : access Screen_Manager;
view : not null access Game_Views.Game_View'Class;
id : String );
-- Handled notifications when the screen manager becomes shown or unshown on
-- the screen.
procedure On_Shown( this : access Screen_Manager; shown : Boolean );
procedure Tick( this : access Screen_Manager; time : Tick_Time );
-- Removes a screen from the manager. The screen's Deactivate procedure will
-- be called and the screen(s) at the front of the manager will be activated
-- if necessary.
procedure Remove_Screen( this : not null access Screen_Manager'Class;
screen : not null A_Game_Screen );
end Widgets.Containers.Screen_Managers;