tbx  0.7.6
Public Member Functions | List of all members
tbx::QuestionWindow Class Reference

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

#include <questionwindow.h>

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

Public Member Functions

 QuestionWindow (const std::string &question)
 Construct a question window with the give question. More...
 
void delete_commands ()
 Delete all commands added when dialog exits. More...
 
void add_yes_command (tbx::Command *yes_command)
 Add a command to be run if the yes button is selected. More...
 
void add_no_command (tbx::Command *no_command)
 Add a command to be run if the no button is selected. 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 question in a window in the centre of the screen, resizing the window to fit the question if necessary.

To use this window you must have a template called "Question" 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 - Yes action button 2 - No action 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 buttons are moved to stay at the same relative position to the bottom right of the window.

Constructor & Destructor Documentation

◆ QuestionWindow()

tbx::QuestionWindow::QuestionWindow ( const std::string &  question)

Construct a question window with the give question.

Parameters
questionThe question for the window

Member Function Documentation

◆ add_no_command()

void tbx::QuestionWindow::add_no_command ( tbx::Command no_command)

Add a command to be run if the no button is selected.

Parameters
no_commandcommand to run if "No" is selected.

◆ add_yes_command()

void tbx::QuestionWindow::add_yes_command ( tbx::Command yes_command)

Add a command to be run if the yes button is selected.

Parameters
yes_commandcommand to run if "Yes" is selected.

◆ delete_commands()

void tbx::QuestionWindow::delete_commands ( )

Delete all commands added when dialog exits.

Note: only command added after this call will be deleted


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