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> 67 vLayout->
addLayout(hLayout, 0, AlignTop | AlignLeft);
93 "' is already taken.");
162 vLayout->
addLayout(hLayout, 0, AlignLeft);
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;" 266 messageEdit_->enterPressed().connect((
WWidget *)messageEdit_,
271 messageEdit_->enterPressed().preventDefaultAction();
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())
void setButtonsEnabled(bool enabled=true)
void setText(const WString &text)
Type type() const
Get the event type.
const WString & text() const
void sendMessage(const Wt::WString &user, const Wt::WString &message)
Send a message on behalve of a user.
const Wt::WString & data() const
Get the extra data for this event.
bool connect(Client *client, const ChatEventCallback &handleEvent)
Connects to the chat server.
Encapsulate a chat event.
UserSet users()
Get the users currently logged in.
void addLayout(std::unique_ptr< WLayout > layout, int stretch, WFlags< AlignmentFlag > alignment)
void addWidget(std::unique_ptr< WWidget > widget, int stretch, WFlags< AlignmentFlag > alignment)
Signal< WString > & valueChanged()
virtual void bindWidget(const std::string &varName, std::unique_ptr< WWidget > widget)
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.
bool setText(const WString &text)
Wt::WString suggestGuest()
Get a suggestion for a guest user name.
bool setTextFormat(TextFormat format)
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.
static WApplication * instance()
const Wt::WString formattedHTML(const Wt::WString &user, Wt::TextFormat format) const
Get the message formatted as HTML, rendered for the given user.
void setResizable(int index, bool enabled=true, const WLength &initialSize=WLength::Auto)
const WString & text() const
Wt::Signals::connection connect(F function)
const Wt::WString & user() const
Get the user who caused the event.
void doJavaScript(const std::string &javascript, bool afterLoaded=true)
void setJavaScript(const std::string &javaScript, int nbArgs=0)