10#include <Wt/WApplication>
11#include <Wt/WContainerWidget>
12#include <Wt/WEnvironment>
13#include <Wt/WInPlaceEdit>
14#include <Wt/WHBoxLayout>
15#include <Wt/WVBoxLayout>
17#include <Wt/WLineEdit>
18#include <Wt/WTemplate>
20#include <Wt/WTextArea>
21#include <Wt/WPushButton>
22#include <Wt/WCheckBox>
93 "' is already taken.");
174 if (flags & RenderFull) {
184 WContainerWidget::render(flags);
231 (
"function(o, e) { setTimeout(function() {"
244 WApplication::instance()->setConnectionMonitor(
246 "'onChange':function(type, newV) {"
247 "var connected = window.monitor.status.connectionStatus != 0;"
295 if (!logoutButton->
parent())
329 for (SimpleChatServer::UserSet::iterator i = users.begin();
330 i != users.end(); ++i) {
334 UserMap::const_iterator j = oldUsers.find(*i);
335 if (j != oldUsers.end())
381 user_ =
event.data();
Encapsulate a chat event.
const Wt::WString formattedHTML(const Wt::WString &user, Wt::TextFormat format) const
Get the message formatted as HTML, rendered for the given user.
Type type() const
Get the event type.
const Wt::WString & user() const
Get the user who caused the event.
bool changeName(const Wt::WString &user, const Wt::WString &newUser)
Changes the name.
bool disconnect(Client *client)
Disconnect from the chat server.
UserSet users()
Get the users currently logged in.
void logout(const Wt::WString &user)
Logout from the server.
std::set< Wt::WString > UserSet
Typedef for a collection of user names.
bool connect(Client *client, const ChatEventCallback &handleEvent)
Connects to the chat server.
void sendMessage(const Wt::WString &user, const Wt::WString &message)
Send a message on behalve of a user.
Wt::WString suggestGuest()
Get a suggestion for a guest user name.
bool login(const Wt::WString &user)
Try to login with given user name.
void preventDefaultAction(bool prevent=true)
Wt::Signals::connection connect(const F &function)
void setJavaScript(const std::string &javaScript, int nbArgs=0)
void doJavaScript(const std::string &javascript, bool afterLoaded=true)
void enableUpdates(bool enabled=true)
void addLayout(WLayout *layout, int stretch=0, WFlags< AlignmentFlag > alignment=0)
void addWidget(WWidget *widget, int stretch=0, WFlags< AlignmentFlag > alignment=0)
void setResizable(int index, bool enabled=true, const WLength &initialSize=WLength::Auto)
Signal< WString > & valueChanged()
void setButtonsEnabled(bool enabled=true)
void setText(const WString &text)
const WString & text() const
static WObject * sender()
static const WString Empty
virtual void bindWidget(const std::string &varName, WWidget *widget)
virtual void setText(const WString &text)
const WString & text() const
bool setText(const WString &text)
bool setTextFormat(TextFormat format)