Wt::WMessageBox Class Reference

WMessageBox provides simple dialog windows. More...

#include <WMessageBox>

Inherits Wt::WDialog.

Inheritance diagram for Wt::WMessageBox:

Inheritance graph
[legend]
List of all members.

Public Types

 NoIcon = 0
 No icon.
 Information = 1
 An information icon (not implemented).
 Warning = 2
 An warning icon (not implemented).
 Critical = 3
 An critical icon (not implemented).
 Question = 4
 An question icon (not implemented).
 NoButton = 0x00
 No button.
 Ok = 0x01
 An OK button.
 Cancel = 0x02
 A Cancel button.
 Yes = 0x04
 A Yes button.
 No = 0x08
 A No button.
 Abort = 0x10
 An Abort button.
 Retry = 0x20
 A Retry button.
 Ignore = 0x40
 An Ignore button.
 YesAll = 0x80
 A Yes-to-All button.
 NoAll = 0x100
 A No-to-All button.
enum  Icon {
  NoIcon = 0, Information = 1, Warning = 2, Critical = 3,
  Question = 4
}
 A standard icon for the message box. More...
enum  StandardButton {
  NoButton = 0x00, Ok = 0x01, Cancel = 0x02, Yes = 0x04,
  No = 0x08, Abort = 0x10, Retry = 0x20, Ignore = 0x40,
  YesAll = 0x80, NoAll = 0x100
}
 A standard button for the message box. More...

Public Member Functions

 WMessageBox (bool i18n=false)
 Create an empty message box.
 WMessageBox (const WString &caption, const WString &text, Icon icon, int buttons, bool i18n=false)
 Create a message box with given caption, text, icon, and buttons.
void setText (const WString &text)
 Set the text for the message box.
const WStringtext () const
 Get the message box text.
WTexttextWidget () const
 Get the text widget.
void setIcon (Icon icon)
 Set the icon.
Icon icon () const
 Get the icon.
WPushButtonaddButton (const WString &text, StandardButton result)
 Add a custom button with given text.
void setButtons (int buttons)
 Set standard buttons for the message box.
int buttons () const
 Get the standard buttons.
WPushButtonbutton (StandardButton b)
 Get the button widget for the given standard button.
StandardButton result ()
 Get the result of this message box.

Static Public Member Functions

static StandardButton show (const WString &caption, const WString &text, int buttons, bool i18n=false)
 Convenience method to show a message box, blocking the current thread.

Public Attributes

Signal< StandardButtonbuttonClicked
 Signal emitted when a button is clicked.

Detailed Description

WMessageBox provides simple dialog windows.

The message box shows a message in a dialog window, with a number of buttons. These buttons may be standard buttons, or customized.

There are two distinct ways for using a WMessageBox, which reflect the two ways of dealing with a WDialog box.

The easiest way is using the static show() method, which shows a message box, blocks the current thread, and returns the button that was pressed by the user. Since this uses the WDialog::exec(), it suffers from the same scalability issues.

The more elaborate way is by creating a WMessageBox, and connecting the buttonClicked signal to a method. This method then interpretes the result and deletes the message box.


Member Enumeration Documentation

enum Wt::WMessageBox::Icon

A standard icon for the message box.

Enumerator:
NoIcon  No icon.
Information  An information icon (not implemented).
Warning  An warning icon (not implemented).
Critical  An critical icon (not implemented).
Question  An question icon (not implemented).

enum Wt::WMessageBox::StandardButton

A standard button for the message box.

Multiple buttons may be specified by logically or'ing these values together, e.g.

Enumerator:
NoButton  No button.
Ok  An OK button.
Cancel  A Cancel button.
Yes  A Yes button.
No  A No button.
Abort  An Abort button.
Retry  A Retry button.
Ignore  An Ignore button.
YesAll  A Yes-to-All button.
NoAll  A No-to-All button.


Constructor & Destructor Documentation

Wt::WMessageBox::WMessageBox ( bool  i18n = false  ) 

Create an empty message box.

The button labels may be set fixed English (if i18n = false), or fetched from a resource bundle if i18n = true. In that case, the key for each button is exactly the same as the English text.

Wt::WMessageBox::WMessageBox ( const WString caption,
const WString text,
Icon  icon,
int  buttons,
bool  i18n = false 
)

Create a message box with given caption, text, icon, and buttons.

The button labels may be set fixed English (if i18n = false), or fetched from a resource bundle if i18n = true. In that case, the key for each button is exactly the same as the English text.


Member Function Documentation

WPushButton * Wt::WMessageBox::addButton ( const WString text,
StandardButton  result 
)

Add a custom button with given text.

When the button is clicked, the associated result will be returned.

WPushButton * Wt::WMessageBox::button ( StandardButton  b  ) 

Get the button widget for the given standard button.

This may be useful to customize the style or layout of the button.

StandardButton Wt::WMessageBox::result (  )  [inline]

Get the result of this message box.

This value is only defined after a button has been clicked.

WMessageBox::StandardButton Wt::WMessageBox::show ( const WString caption,
const WString text,
int  buttons,
bool  i18n = false 
) [static]

Convenience method to show a message box, blocking the current thread.

Show a message box, blocking the current thread until the message box is closed, and return the result.

WText* Wt::WMessageBox::textWidget (  )  const [inline]

Get the text widget.

This may be useful to customize the style or layout of the displayed text.


The documentation for this class was generated from the following files:
Generated on Sun Jul 1 19:37:18 2007 for Wt by doxygen 1.4.7