A popup chat widget.
More...
#include <PopupChatWidget.h>
|
virtual void | createLayout (Wt::WWidget *messages, Wt::WWidget *userList, Wt::WWidget *messageEdit, Wt::WWidget *sendButton, Wt::WWidget *logoutButton) |
|
virtual void | updateUsers () |
|
virtual void | newMessage () |
|
virtual void | render (Wt::WFlags< Wt::RenderFlag > flags) |
|
bool | loggedIn () const |
|
A popup chat widget.
Definition at line 20 of file PopupChatWidget.h.
§ PopupChatWidget()
PopupChatWidget::PopupChatWidget |
( |
SimpleChatServer & |
server, |
|
|
const std::string & |
id |
|
) |
| |
Definition at line 19 of file PopupChatWidget.C.
26 if (Wt::WApplication::instance()->environment().agentIsIE()) {
27 if (Wt::WApplication::instance()->environment().agent()
28 == Wt::WEnvironment::IE6)
29 setPositionScheme(Wt::Absolute);
31 setPositionScheme(Wt::Fixed);
37 """var s = $('#" +
id +
"');" 38 """s.toggleClass('chat-maximized chat-minimized');" 39 + Wt::WApplication::instance()->javaScriptClass()
40 +
".layouts2.scheduleAdjust(true);" 45 setStyleClass(
"chat-widget chat-minimized");
§ createBar()
Wt::WContainerWidget * PopupChatWidget::createBar |
( |
| ) |
|
|
private |
Definition at line 70 of file PopupChatWidget.C.
72 Wt::WContainerWidget *bar =
new Wt::WContainerWidget();
73 bar->setStyleClass(
"chat-bar");
75 Wt::WText *toggleButton =
new Wt::WText();
76 toggleButton->setInline(
false);
77 toggleButton->setStyleClass(
"chat-minmax");
81 bar->addWidget(toggleButton);
83 title_ =
new Wt::WText(bar);
§ createLayout()
void PopupChatWidget::createLayout |
( |
Wt::WWidget * |
messages, |
|
|
Wt::WWidget * |
userList, |
|
|
Wt::WWidget * |
messageEdit, |
|
|
Wt::WWidget * |
sendButton, |
|
|
Wt::WWidget * |
logoutButton |
|
) |
| |
|
protectedvirtual |
Reimplemented from SimpleChatWidget.
Definition at line 119 of file PopupChatWidget.C.
125 Wt::WVBoxLayout *layout =
new Wt::WVBoxLayout();
126 layout->setContentsMargins(0, 0, 0, 0);
127 layout->setSpacing(0);
131 layout->addWidget(bar);
132 bar->setMinimumSize(Wt::WLength::Auto, 20);
133 layout->addWidget(messages, 1);
134 layout->addWidget(messageEdit);
§ goOnline()
void PopupChatWidget::goOnline |
( |
| ) |
|
|
private |
Definition at line 95 of file PopupChatWidget.C.
101 Wt::WString name =
name_;
109 name =
name_ + boost::lexical_cast<std::string>(++tries);
116 bar_->removeStyleClass(
"alert");
Wt::WString suggestGuest()
Get a suggestion for a guest user name.
§ minimized()
bool PopupChatWidget::minimized |
( |
| ) |
const |
|
private |
§ newMessage()
void PopupChatWidget::newMessage |
( |
| ) |
|
|
protectedvirtual |
§ setName()
void PopupChatWidget::setName |
( |
const Wt::WString & |
name | ) |
|
Definition at line 54 of file PopupChatWidget.C.
63 n = name + boost::lexical_cast<std::string>(++tries);
bool changeName(const Wt::WString &user, const Wt::WString &newUser)
Changes the name.
§ toggleSize()
void PopupChatWidget::toggleSize |
( |
| ) |
|
|
private |
§ updateUsers()
void PopupChatWidget::updateUsers |
( |
| ) |
|
|
protectedvirtual |
Reimplemented from SimpleChatWidget.
Definition at line 139 of file PopupChatWidget.C.
147 title_->setText(
"Thoughts? Ventilate.");
149 title_->setText(
"Chat: 1 user online");
151 title_->setText(Wt::WString(
"Chat: {1} users online").arg(count));
153 title_->setText(Wt::WString(
"Chat: <span class=\"self\">{1}</span>" 154 " <span class=\"online\">({2} user{3})</span>")
155 .arg(
userName()).arg(count).arg(count == 1 ?
"" :
"s"));
UserSet users()
Get the users currently logged in.
§ bar_
Wt::WWidget* PopupChatWidget::bar_ |
|
private |
§ minimized_
bool PopupChatWidget::minimized_ |
|
private |
§ missedMessages_
int PopupChatWidget::missedMessages_ |
|
private |
§ name_
Wt::WString PopupChatWidget::name_ |
|
private |
§ online_
bool PopupChatWidget::online_ |
|
private |
§ title_
Wt::WText* PopupChatWidget::title_ |
|
private |
The documentation for this class was generated from the following files: