Wt examples
4.11.3
|
A JavaScript based popup window, encapsulating the Javascript functions alert(), confirm(), and prompt(). More...
#include <Popup.h>
Public Types | |
enum | Type { Confirm , Alert , Prompt } |
Popup type. More... | |
![]() | |
typedef void(WObject::* | Method) () |
Public Member Functions | |
Popup (Type t, const WString &message, const std::string defaultValue) | |
Popup constructor. More... | |
void | setMessage (const WString &message) |
Change the message. More... | |
void | setDefaultValue (const std::string defaultValue) |
Change the default value for a prompt dialog. More... | |
const WString & | message () const |
Get the current message. More... | |
const std::string & | defaultValue () const |
Get the default value for a prompt dialog. More... | |
JSignal< std::string > & | okPressed () |
Signal emitted when ok pressed. More... | |
JSignal & | cancelPressed () |
Signal emitted when cancel is pressed. More... | |
![]() | |
void | addChild (std::unique_ptr< WObject > child) |
Child * | addChild (std::unique_ptr< Child > child) |
std::unique_ptr< WObject > | removeChild (WObject *child) |
std::unique_ptr< Child > | removeChild (Child *child) |
virtual const std::string | id () const |
virtual void | setObjectName (const std::string &name) |
virtual std::string | objectName () const |
void | resetLearnedSlots () |
void | resetLearnedSlot (void(T::*method)()) |
WStatelessSlot * | implementStateless (void(T::*method)()) |
WStatelessSlot * | implementStateless (void(T::*method)(), void(T::*undoMethod)()) |
void | isNotStateless () |
WStatelessSlot * | implementJavaScript (void(T::*method)(), const std::string &jsCode) |
![]() | |
observable () noexcept | |
virtual | ~observable () |
auto | bindSafe (void(C::*method)(Args...)) noexcept |
auto | bindSafe (void(C::*method)(Args...) const) const noexcept |
auto | bindSafe (const Function &function) noexcept |
Static Public Member Functions | |
static std::unique_ptr< Popup > | createConfirm (const WString &message) |
Create a confirm dialog. More... | |
static std::unique_ptr< Popup > | createPrompt (const WString &message, const std::string defaultValue) |
Create a prompt dialog with the given default value. More... | |
static std::unique_ptr< Popup > | createAlert (const WString &message) |
Create an alert dialog. More... | |
Public Attributes | |
JSlot | show |
Show the dialog. More... | |
Private Member Functions | |
void | setJavaScript () |
Update the javascript code. More... | |
Private Attributes | |
JSignal< std::string > | okPressed_ |
JSignal | cancelPressed_ |
Type | t_ |
WString | message_ |
std::string | defaultValue_ |
Additional Inherited Members | |
![]() | |
virtual WStatelessSlot * | getStateless (Method method) |
A JavaScript based popup window, encapsulating the Javascript functions alert(), confirm(), and prompt().
Use one of the create static methods to create a popup. This will not display the popup, until either the show slot is triggered from an event handler, or is executed using it's exec() method.
When the user closes the popup, either the okPressed or cancelPressed signal is emitted. For a prompt dialog, the value is passed as a parameter to the okPressed signal.
enum Popup::Type |
Popup constructor.
Definition at line 14 of file Popup.C.
|
inline |
|
static |
Create a prompt dialog with the given default value.
|
inline |
|
inline |
|
inline |
void Popup::setDefaultValue | ( | const std::string | defaultValue | ) |
Change the default value for a prompt dialog.
|
private |
void Popup::setMessage | ( | const WString & | message | ) |
Change the message.
JSlot Popup::show |