Wt examples 3.3.12
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 bvba, Kessel-Lo, 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
14using namespace Wt;
15
20
32class Popup : public WObject
33{
34public:
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
71
75
79
80private:
84
87 Popup(Type t, const WString& message, const std::string defaultValue,
89
92
95 std::string defaultValue_;
96
99 void setJavaScript();
100};
101
104#endif // POPUP_H_
A JavaScript based popup window, encapsulating the Javascript functions alert(), confirm(),...
Definition Popup.h:33
void setMessage(const WString &message)
Change the message.
Definition Popup.C:60
static Popup * createConfirm(const WString &message, WObject *parent=0)
Create a confirm dialog.
Definition Popup.C:72
JSignal< std::string > & okPressed()
Signal emitted when ok pressed.
Definition Popup.h:74
const std::string & defaultValue() const
Get the default value for a prompt dialog.
Definition Popup.h:63
JSlot show
Show the dialog.
Definition Popup.h:70
Type t_
Definition Popup.h:93
WString message_
Definition Popup.h:94
void setDefaultValue(const std::string defaultValue)
Change the default value for a prompt dialog.
Definition Popup.C:66
const WString & message() const
Get the current message.
Definition Popup.h:59
JSignal< void > cancelPressed_
Definition Popup.h:91
std::string defaultValue_
Definition Popup.h:95
Type
Popup type.
Definition Popup.h:83
@ Alert
Definition Popup.h:83
@ Prompt
Definition Popup.h:83
@ Confirm
Definition Popup.h:83
static Popup * createAlert(const WString &message, WObject *parent=0)
Create an alert dialog.
Definition Popup.C:77
JSignal< std::string > okPressed_
Definition Popup.h:90
static Popup * createPrompt(const WString &message, const std::string defaultValue, WObject *parent=0)
Create a prompt dialog with the given default value.
Definition Popup.C:82
void setJavaScript()
Update the javascript code.
Definition Popup.C:24
JSignal< void > & cancelPressed()
Signal emitted when cancel is pressed.
Definition Popup.h:78
WObject * parent() const

Generated on Fri May 17 2024 for the C++ Web Toolkit (Wt) by doxygen 1.9.8