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>
95 statusMsg_->setText(
"Sorry, name '" + escapeText(name) +
96 "' is already taken.");
176 if (flags & RenderFull) {
182 +
messages_->jsRef() +
".scrollHeight;}, 0);");
186 WContainerWidget::render(flags);
211 messages_->setOverflow(WContainerWidget::OverflowAuto);
212 userList_->setOverflow(WContainerWidget::OverflowAuto);
232 (
"function(o, e) { setTimeout(function() {"
257 joinMsg->bindWidget(
"name", nameEdit);
270 if (!logoutButton->parent())
304 for (SimpleChatServer::UserSet::iterator i = users.begin();
305 i != users.end(); ++i) {
309 UserMap::const_iterator j = oldUsers.find(*i);
310 if (j != oldUsers.end())
399 +
messages_->jsRef() +
".scrollHeight;");
void setButtonsEnabled(bool enabled=true)
void setText(const WString &text)
void addLayout(WLayout *layout, int stretch=0, WFlags< AlignmentFlag > alignment=0)
void sendMessage(const Wt::WString &user, const Wt::WString &message)
Send a message on behalve of a user.
bool connect(Client *client, const ChatEventCallback &handleEvent)
Connects to the chat server.
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.
UserSet users()
Get the users currently logged in.
Signal< WString > & valueChanged()
std::set< Wt::WString > UserSet
Typedef for a collection of user names.
bool changeName(const Wt::WString &user, const Wt::WString &newUser)
Changes the name.
Wt::WString suggestGuest()
Get a suggestion for a guest user name.
bool login(const Wt::WString &user)
Try to login with given user name.
bool disconnect(Client *client)
Disconnect from the chat server.
void enableUpdates(bool enabled=true)
virtual void setText(const WString &text)
void logout(const Wt::WString &user)
Logout from the server.
const WString & text() const
static WApplication * instance()
void setResizable(int index, bool enabled=true, const WLength &initialSize=WLength::Auto)
void setJavaScript(const std::string &javaScript)
const Wt::WString & user() const
Get the user who caused the event.
void addWidget(WWidget *widget, int stretch=0, WFlags< AlignmentFlag > alignment=0)
Type type() const
Get the event type.
void doJavaScript(const std::string &javascript, bool afterLoaded=true)
const Wt::WString & data() const
Get the extra data for this event.