/home/koen/project/wt/cvs/wt/examples/simplechat/SimpleChatWidget.h

Go to the documentation of this file.
00001 // This may look like C code, but it's really -*- C++ -*-
00002 /*
00003  * Copyright (C) 2007 Koen Deforche
00004  *
00005  * See the LICENSE file for terms of use.
00006  */
00007 
00008 #ifndef SIMPLECHATWIDGET_H_
00009 #define SIMPLECHATWIDGET_H_
00010 
00011 #include <Wt/WContainerWidget>
00012 
00013 namespace Wt {
00014   class WApplication;
00015   class WPushButton;
00016   class WText;
00017   class WLineEdit;
00018   class WTextArea;
00019 }
00020 
00021 class SimpleChatServer;
00022 class ChatEvent;
00023 
00028 
00031 class SimpleChatWidget : public Wt::WContainerWidget
00032 {
00033 public:
00036   SimpleChatWidget(SimpleChatServer& server, Wt::WContainerWidget *parent = 0);
00037 
00040   ~SimpleChatWidget();
00041 
00044   void letLogin();
00045 
00050   bool startChat(const Wt::WString& user);
00051 
00052 private:
00053   SimpleChatServer&     server_;
00054   Wt::WApplication     *app_;
00055 
00056   Wt::WString           user_;
00057 
00058   Wt::WLineEdit        *userNameEdit_;
00059   Wt::WText            *statusMsg_;
00060 
00061   Wt::WContainerWidget *messages_;
00062   Wt::WContainerWidget *messageEditArea_;
00063   Wt::WTextArea        *messageEdit_;
00064   Wt::WPushButton      *sendButton_;
00065   Wt::WContainerWidget *userList_;
00066 
00067   boost::signals::connection eventConnection_;
00068 
00069   void login();
00070   void logout();
00071   void send();
00072   void updateUsers();
00073 
00074   /* called from another session */
00075   void processChatEvent(const ChatEvent& event);
00076 
00077   void onEditBlur();
00078   void onEditFocus();
00079 };
00080 
00083 #endif // SIMPLECHATWIDGET

Generated on Fri Jul 25 17:05:59 2008 for Wt by doxygen 1.5.3