tbx
0.7.5
|
Class to show some text in a window in the centre of the screen, with an icon to the left and one or buttons at the bottom. More...
#include <textdisplaywindow.h>
Public Member Functions | |
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... | |
![]() | |
virtual | ~Listener () |
Destroy the listener object. | |
Protected Attributes | |
tbx::Window | _window |
Additional Inherited Members | |
![]() | |
Listener () | |
Construct the Listener object. | |
Class to show some text in a window in the centre of the screen, with an icon to the left and one or buttons at the bottom.
The window is created to fit the text.
The buttons are created with the component ids 10 and up.
Subclasses can use the _window protected member to modify the window and add event handlers.
The MessageWindow and QuestionWindow both derived from this class.
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.
If the default button or cancel button are given a value other than -1 the window will be given the input focus when shown.
text | The message for the window |
buttons | string contains semi-colon seperated list of button text |
default_button | index (from 0) of button that is default button or -1 if there is not a default button |
cancel_button | index (from 0) of button that is cancel button or -1 if there is not a cancel button |
button_width | width of buttons (default 200 OS units) |
void tbx::TextDisplayWindow::close_command | ( | tbx::Command * | close_command, |
bool | delete_command = false |
||
) |
Set command to be run when message window is closed.
Closing includes using the close button or clicking outside it if it has been shown as a menu
close_command | command to run on close |
delete_close_command | delete the close command when the window is deleted |
void tbx::TextDisplayWindow::delete_on_hide | ( | ) |
Set up text display window to delete itself when it is hidden.
The text display window should have been created using new.
void tbx::TextDisplayWindow::show | ( | ) |
Show the text display window.
The size of the message is calculated and the window resized and gadgets moved accordingly at this point.
void tbx::TextDisplayWindow::show_as_menu | ( | ) |
Show the text display window as a menu.
When shown as a menu clicking outside of the window will close it.
The size of the message is calculated and the window resized and gadgets moved accordingly at this point.
void tbx::TextDisplayWindow::title | ( | const std::string & | new_title | ) |
Set the title for the text display window.
new_title | New caption for the text display window |