--
-- 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.
--
package Widgets.Containers.Game_Screens.Message is
-- The message screen is a blue bordered box in the center of the screen
-- with a character's picture on the left and up to three lines of text on
-- the right. It does not accept any input.
type Message_Screen is new Game_Screen and Key_Listener with private;
-- Creates a new message screen with a default icon of Keen and no text.
-- Set 'transparent' to False to hide the screen behind this one with a
-- black background.
function Create_Message_Screen( view : not null access Game_Views.Game_View'Class;
id : String;
transparent : Boolean := True ) return A_Game_Screen;
-- Sets whether or not the message screen can be closed by the user. The
-- default is False.
procedure Set_Closable( this : not null access Message_Screen'Class;
closable : Boolean );
-- Sets the icon to the left of the text in the message box.
procedure Set_Icon( this : not null access Message_Screen'Class;
filename : String );
-- If enabled, the message screen will auto-pause gameplay while the screen
-- is active. Don't put other opaque screens on top of the message popup
-- screen, because this will deactivate it.
procedure Set_Auto_Pause( this : not null access Message_Screen'Class;
enabled : Boolean );
-- Puts 'text' into the message box, splitting it into multiple lines on
-- whitespace boundaries, as necessary.
procedure Set_Text( this : not null access Message_Screen'Class; text : String );
-- Sets the text alignment in the message box. If it is aligned to the left,
-- the icon will be on the right. If it is aligned to the right, the icon
-- will be on the left. The default is Align_Right.
procedure Set_Text_Align( this : not null access Message_Screen'Class;
align : Align_Type );
private
type Message_Screen is new Game_Screen and Key_Listener with
record
text : Unbounded_String;
textAlign : Align_Type := Align_Right;
closable : Boolean := False;
autoPause : Boolean := False;
end record;
procedure Construct( this : access Message_Screen;
view : not null access Game_Views.Game_View'Class;
id : String;
transparent : Boolean );
-- Pauses the game if auto-pause is enabled.
procedure Activate( this : access Message_Screen );
-- Unpauses the game if auto-pause is enabled.
procedure Deactivate( this : access Message_Screen );
-- Exits the screen on a space/enter key press if the screen is closeable.
procedure Handle_Action( this : access Message_Screen;
action : A_Key_Action;
handled : out Boolean );
procedure Pack( this : access Message_Screen );
end Widgets.Containers.Game_Screens.Message;