Classes | |
class | PopupChatWidget |
A popup chat widget. More... | |
class | ChatApplication |
A chat demo application. More... | |
class | ChatWidget |
A chat application widget. More... | |
class | ChatEvent |
Encapsulate a chat event. More... | |
class | SimpleChatServer |
A simple chat server. More... | |
class | SimpleChatWidget |
A self-contained chat widget. More... | |
Functions | |
WApplication * | createApplication (const WEnvironment &env) |
WApplication * | createWidget (const WEnvironment &env) |
int | main (int argc, char **argv) |
ChatApplication::ChatApplication (const WEnvironment &env) | |
Create a new instance. | |
void | ChatApplication::addChatWidget () |
Add another chat client. | |
ChatWidget::ChatWidget (const WEnvironment &env) | |
Variables | |
SimpleChatServer | theServer |
The single chat server instance. |
void ChatApplication::addChatWidget | ( | ) | [private, inherited] |
Add another chat client.
Definition at line 62 of file simpleChat.C.
{ SimpleChatWidget *chatWidget2 = new SimpleChatWidget(theServer, root()); chatWidget2->setStyleClass("chat"); }
ChatApplication::ChatApplication | ( | const WEnvironment & | env ) | [inherited] |
Create a new instance.
Definition at line 43 of file simpleChat.C.
: WApplication(env) { setTitle("Wt Chat"); useStyleSheet("chatapp.css"); messageResourceBundle().use(Wt::WApplication::appRoot() + "simplechat"); root()->addWidget(new WText(WString::tr("introduction"))); SimpleChatWidget *chatWidget = new SimpleChatWidget(theServer, root()); chatWidget->setStyleClass("chat"); root()->addWidget(new WText(WString::tr("details"))); WPushButton *b = new WPushButton("I'm schizophrenic ...", root()); b->clicked().connect(b, &WPushButton::hide); b->clicked().connect(this, &ChatApplication::addChatWidget); }
ChatWidget::ChatWidget | ( | const WEnvironment & | env ) | [inherited] |
Definition at line 79 of file simpleChat.C.
: WApplication(env), login_(this, "login") { useStyleSheet("chatwidget.css"); useStyleSheet("chatwidget_ie6.css", "lt IE 7"); const std::string *div = env.getParameter("div"); if (div) { setJavaScriptClass(*div); PopupChatWidget *chatWidget = new PopupChatWidget(theServer); bindWidget(chatWidget, *div); login_.connect(chatWidget, &PopupChatWidget::setName); std::string chat = javaScriptClass(); doJavaScript("if (window." + chat + "User) " + chat + ".emit(" + chat + ", 'login', " + chat + "User);" + "document.body.appendChild(" + chatWidget->jsRef() + ");"); } else { std::cerr << "Missing: parameter: 'div'" << std::endl; quit(); } }
WApplication* createApplication | ( | const WEnvironment & | env ) |
Definition at line 105 of file simpleChat.C.
{ return new ChatApplication(env); }
WApplication* createWidget | ( | const WEnvironment & | env ) |
Definition at line 110 of file simpleChat.C.
{ return new ChatWidget(env); }
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 115 of file simpleChat.C.
{ Wt::WServer server(argv[0]); server.setServerConfiguration(argc, argv, WTHTTP_CONFIGURATION); server.addEntryPoint(Wt::Application, createApplication); server.addEntryPoint(Wt::WidgetSet, createWidget, "/chat.js"); if (server.start()) { Wt::WServer::waitForShutdown(); server.stop(); } }
The single chat server instance.
Definition at line 26 of file simpleChat.C.