Wt examples
3.7.1
public-git
wt
examples
javascript
Popup.h
Go to the documentation of this file.
1
// This may look like C code, but it's really -*- C++ -*-
2
/*
3
* Copyright (C) 2008 Emweb bv, Herent, Belgium.
4
*
5
* See the LICENSE file for terms of use.
6
*/
7
#ifndef POPUP_H_
8
#define POPUP_H_
9
10
#include <Wt/WObject>
11
#include <Wt/WString>
12
#include <Wt/WJavaScript>
13
14
using namespace
Wt
;
15
20
32
class
Popup
:
public
WObject
33
{
34
public
:
37
static
Popup
*createConfirm(
const
WString
& message,
WObject
*parent = 0);
38
41
static
Popup
*createPrompt(
const
WString
& message,
42
const
std::string defaultValue,
43
WObject
*parent = 0);
44
47
static
Popup
*createAlert(
const
WString
& message,
WObject
*parent = 0);
48
51
void
setMessage(
const
WString
& message);
52
55
void
setDefaultValue(
const
std::string defaultValue);
56
59
const
WString
&
message
()
const
{
return
message_; }
60
63
const
std::string&
defaultValue
()
const
{
return
defaultValue_; }
64
70
JSlot
show
;
71
74
JSignal<std::string>
&
okPressed
() {
return
okPressed_; }
75
78
JSignal<void>
&
cancelPressed
() {
return
cancelPressed_; }
79
80
private
:
83
enum
Type
{ Confirm, Alert, Prompt };
84
87
Popup
(
Type
t,
const
WString
& message,
const
std::string defaultValue,
88
WObject
*parent);
89
90
JSignal<std::string>
okPressed_
;
91
JSignal<void>
cancelPressed_
;
92
93
Type
t_
;
94
WString
message_
;
95
std::string
defaultValue_
;
96
99
void
setJavaScript();
100
};
101
104
#endif // POPUP_H_
Popup::show
JSlot show
Show the dialog.
Definition:
Popup.h:70
Wt::JSignal< std::string >
Wt::JSlot
Popup::message_
WString message_
Definition:
Popup.h:94
Wt::WString
Popup::defaultValue_
std::string defaultValue_
Definition:
Popup.h:95
Popup::cancelPressed_
JSignal< void > cancelPressed_
Definition:
Popup.h:91
Wt
Popup::okPressed
JSignal< std::string > & okPressed()
Signal emitted when ok pressed.
Definition:
Popup.h:74
Popup::cancelPressed
JSignal< void > & cancelPressed()
Signal emitted when cancel is pressed.
Definition:
Popup.h:78
Popup::defaultValue
const std::string & defaultValue() const
Get the default value for a prompt dialog.
Definition:
Popup.h:63
Popup::message
const WString & message() const
Get the current message.
Definition:
Popup.h:59
Popup::t_
Type t_
Definition:
Popup.h:93
Popup::okPressed_
JSignal< std::string > okPressed_
Definition:
Popup.h:90
Popup
A JavaScript based popup window, encapsulating the Javascript functions alert(), confirm(), and prompt().
Definition:
Popup.h:32
Popup::Type
Type
Popup type.
Definition:
Popup.h:83
Wt::WObject
Generated on Tue Dec 15 2020 for
the C++ Web Toolkit (Wt)
by
1.8.13