tbx  0.7.3
Public Member Functions | List of all members
tbx::MessageWindow Class Reference

Class to show a message in a window in the centre of the screen, resizing the window to fit the message if necessary. More...

#include <messagewindow.h>

Inheritance diagram for tbx::MessageWindow:
tbx::TextDisplayWindow tbx::RedrawListener tbx::HasBeenHiddenListener tbx::Listener tbx::Listener

Public Member Functions

 MessageWindow (const std::string &msg)
 Construct a message window with the give message. More...
 
void sprite (const std::string &sprite_name)
 Set the name of the sprite to show in the message box. More...
 
- Public Member Functions inherited from tbx::TextDisplayWindow
 TextDisplayWindow (const std::string &text, const char *buttons, int default_button=-1, int cancel_button=-1, int button_width=200)
 Construct a text display window with the given text and buttons. More...
 
virtual ~TextDisplayWindow ()
 Destructor, delete close command if necessary.
 
void title (const std::string &title)
 Set the title for the text display window. More...
 
tbx::Window window ()
 Get underlying window used for the message window.
 
void delete_on_hide ()
 Set up text display window to delete itself when it is hidden. More...
 
void close_command (tbx::Command *close_command, bool delete_command=false)
 Set command to be run when message window is closed. More...
 
void show ()
 Show the text display window. More...
 
void show_as_menu ()
 Show the text display window as a menu. More...
 
- Public Member Functions inherited from tbx::Listener
virtual ~Listener ()
 Destroy the listener object.
 

Additional Inherited Members

- Protected Member Functions inherited from tbx::Listener
 Listener ()
 Construct the Listener object.
 
- Protected Attributes inherited from tbx::TextDisplayWindow
tbx::Window _window
 

Detailed Description

Class to show a message in a window in the centre of the screen, resizing the window to fit the message if necessary.

To use this window you must have a template called "Message" in your resources with the following characteristics.

The visible area shown is the minimum size of the window. The extent of the window sets the maximum width and height of the window.

Gadgets: 0 - Button with the needs help flag set. This is used as a guide to position the message and is resized if necessary. 1 - Action button to close the window 2 - Button to show a sprite. 3 - Button with R2 validation to provide a rule between the text and the button.

A window you can copy to provide this is provided in TbxRes in the !Tbx directory.

If the depth or width of the window is changed due to the size of the text the button is moved to stay at the same relative position to the bottom right of the window and the rule is moved down to stay at the same relative position to the bottom of the window.

Constructor & Destructor Documentation

tbx::MessageWindow::MessageWindow ( const std::string &  msg)

Construct a message window with the give message.

Parameters
msgThe message for the window

Member Function Documentation

void tbx::MessageWindow::sprite ( const std::string &  sprite_name)

Set the name of the sprite to show in the message box.

Parameters
sprite_namename of sprite shown in the message box.

The documentation for this class was generated from the following files: