Wt examples
4.5.0
|
A self-contained chat widget. More...
#include <SimpleChatWidget.h>
Public Member Functions | |
SimpleChatWidget (SimpleChatServer &server) | |
Create a chat widget that will connect to the given server. More... | |
~SimpleChatWidget () | |
Delete a chat widget. More... | |
void | connect () |
void | disconnect () |
void | letLogin () |
Show a simple login screen. More... | |
bool | startChat (const Wt::WString &user) |
Start a chat for the given user. More... | |
void | logout () |
SimpleChatServer & | server () |
int | userCount () |
const Wt::WString & | userName () const |
Protected Member Functions | |
virtual void | createLayout (std::unique_ptr< Wt::WWidget > messages, std::unique_ptr< Wt::WWidget > userList, std::unique_ptr< Wt::WWidget > messageEdit, std::unique_ptr< Wt::WWidget > sendButton, std::unique_ptr< Wt::WWidget > logoutButton) |
virtual void | updateUsers () |
virtual void | newMessage () |
virtual void | render (Wt::WFlags< Wt::RenderFlag > flags) |
bool | loggedIn () const |
Private Types | |
typedef std::map< Wt::WString, bool > | UserMap |
Private Member Functions | |
void | login () |
void | changeName (const Wt::WString &name) |
void | send () |
void | updateUser (Wt::WCheckBox *b) |
void | processChatEvent (const ChatEvent &event) |
Private Attributes | |
UserMap | users_ |
SimpleChatServer & | server_ |
bool | loggedIn_ |
Wt::JSlot | clearInput_ |
Wt::WString | user_ |
Wt::WLineEdit * | userNameEdit_ |
Wt::WText * | statusMsg_ |
Wt::WContainerWidget * | messages_ |
Wt::WTextArea * | messageEdit_ |
Wt::Core::observing_ptr< Wt::WPushButton > | sendButton_ |
Wt::Core::observing_ptr< Wt::WContainerWidget > | userList_ |
std::unique_ptr< Wt::WSound > | messageReceived_ |
A self-contained chat widget.
Definition at line 26 of file SimpleChatWidget.h.
|
private |
Definition at line 74 of file SimpleChatWidget.h.
SimpleChatWidget::SimpleChatWidget | ( | SimpleChatServer & | server | ) |
Create a chat widget that will connect to the given server.
Definition at line 26 of file SimpleChatWidget.C.
SimpleChatWidget::~SimpleChatWidget | ( | ) |
|
private |
Definition at line 306 of file SimpleChatWidget.C.
void SimpleChatWidget::connect | ( | ) |
Definition at line 43 of file SimpleChatWidget.C.
|
protectedvirtual |
Definition at line 109 of file SimpleChatWidget.C.
void SimpleChatWidget::disconnect | ( | ) |
Definition at line 50 of file SimpleChatWidget.C.
void SimpleChatWidget::letLogin | ( | ) |
|
protected |
Definition at line 171 of file SimpleChatWidget.C.
|
private |
Definition at line 84 of file SimpleChatWidget.C.
void SimpleChatWidget::logout | ( | ) |
Definition at line 98 of file SimpleChatWidget.C.
|
protectedvirtual |
|
private |
Definition at line 358 of file SimpleChatWidget.C.
|
protectedvirtual |
Definition at line 176 of file SimpleChatWidget.C.
|
private |
Definition at line 314 of file SimpleChatWidget.C.
|
inline |
Definition at line 54 of file SimpleChatWidget.h.
bool SimpleChatWidget::startChat | ( | const Wt::WString & | user | ) |
Start a chat for the given user.
Returns false if the user could not login.
Definition at line 191 of file SimpleChatWidget.C.
|
private |
Definition at line 353 of file SimpleChatWidget.C.
|
protectedvirtual |
Reimplemented in PopupChatWidget.
Definition at line 320 of file SimpleChatWidget.C.
|
inline |
Definition at line 56 of file SimpleChatWidget.h.
|
inline |
Definition at line 58 of file SimpleChatWidget.h.
|
private |
Definition at line 80 of file SimpleChatWidget.h.
|
private |
Definition at line 78 of file SimpleChatWidget.h.
|
private |
Definition at line 88 of file SimpleChatWidget.h.
|
private |
Definition at line 92 of file SimpleChatWidget.h.
|
private |
Definition at line 87 of file SimpleChatWidget.h.
|
private |
Definition at line 89 of file SimpleChatWidget.h.
|
private |
Definition at line 77 of file SimpleChatWidget.h.
|
private |
Definition at line 85 of file SimpleChatWidget.h.
|
private |
Definition at line 82 of file SimpleChatWidget.h.
|
private |
Definition at line 90 of file SimpleChatWidget.h.
|
private |
Definition at line 84 of file SimpleChatWidget.h.
|
private |
Definition at line 75 of file SimpleChatWidget.h.