Wt examples
3.7.1
|
A JavaScript based popup window, encapsulating the Javascript functions alert(), confirm(), and prompt(). More...
#include <Popup.h>
Public Member Functions | |
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< void > & | 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 Popup * | createConfirm (const WString &message, WObject *parent=0) |
Create a confirm dialog. More... | |
static Popup * | createPrompt (const WString &message, const std::string defaultValue, WObject *parent=0) |
Create a prompt dialog with the given default value. More... | |
static Popup * | createAlert (const WString &message, WObject *parent=0) |
Create an alert dialog. More... | |
Public Attributes | |
JSlot | show |
Show the dialog. More... | |
Private Types | |
enum | Type { Confirm, Alert, Prompt } |
Popup type. More... | |
Private Member Functions | |
Popup (Type t, const WString &message, const std::string defaultValue, WObject *parent) | |
Popup constructor. More... | |
void | setJavaScript () |
Update the javascript code. More... | |
Private Attributes | |
JSignal< std::string > | okPressed_ |
JSignal< void > | cancelPressed_ |
Type | t_ |
WString | message_ |
std::string | defaultValue_ |
Additional Inherited Members | |
![]() | |
typedef void(WObject::* | Method) () |
![]() | |
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.
|
private |
Popup type.
Enumerator | |
---|---|
Confirm | |
Alert | |
Prompt |
|
private |
Popup constructor.
Definition at line 12 of file Popup.C.
|
inline |
Create an alert dialog.
Definition at line 77 of file Popup.C.
Create a confirm dialog.
Definition at line 72 of file Popup.C.
|
static |
Create a prompt dialog with the given default value.
Definition at line 82 of file Popup.C.
|
inline |
|
inline |
|
inline |
void Popup::setDefaultValue | ( | const std::string | defaultValue | ) |
Change the default value for a prompt dialog.
Definition at line 66 of file Popup.C.
|
private |
Update the javascript code.
Definition at line 24 of file Popup.C.
void Popup::setMessage | ( | const WString & | message | ) |
JSlot Popup::show |