Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Examples

vos/applibs/chatgui/avatarlist.hh

Go to the documentation of this file.
00001 /*  $Id: avatarlist.hh,v 1.15 2003/07/29 23:03:47 reed Exp $
00002 
00003     Copyright (C) 2003 Reed Hedges
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 
00020 #ifndef _VOSCHATGUI_AVATAR_LIST_H_
00021 #define _VOSCHATGUI_AVATAR_LIST_H_
00022 
00023 
00024 #include <vos/corelibs/vos/vos.hh>
00025 #include <vos/metaobjects/property/property.hh>
00026 #include <vos/metaobjects/misc/talkative.hh>
00027 #include <vos/metaobjects/misc/avatar.hh>
00028 #include <vos/gui/gui/gui.hh>
00029 
00030 #if defined(_WIN32) && defined(_MSC_VER)
00031 # ifdef CHATGUI_EXPORTS
00032 #  define CHATGUI_API __declspec(dllexport)
00033 # else
00034 #  define CHATGUI_API __declspec(dllimport)
00035 # endif
00036 #else
00037 # define CHATGUI_API
00038 #endif
00039 
00040 /** @addtogroup applibs
00041  *  @{
00042  *
00043  *  Text chat user interface built with the VOS GUI. 
00044  */
00045 namespace VOSChatGUI {
00046 
00047 /** A list of avatar object in some "world" (children of some Vobject).
00048     Controls are also given to inspect info about the avatars, to change
00049     the info for "your" avatar, and to open a private message window 
00050     for one or more talkative avatars.
00051     @ingroup chatgui
00052     @ingroup applibs
00053 */
00054 
00055 class CHATGUI_API AvatarList : 
00056     public virtual ChildChangeListener, 
00057     public virtual ObjectExciseListener, 
00058     public virtual VOSGUI::LocalContainer
00059 {  
00060 
00061 protected:
00062     vRef<Vobject> world;
00063     vRef<VOSGUI::SelectList> list;
00064     vRef<Vobject> display;
00065     vRef<Avatar> yourAvatar;
00066     vRef<LocalSite> site;
00067     bool usePrivMsg;
00068 
00069 protected:
00070     /* Buttons in the window. */
00071     VOSGUI_DEFINE_BUTTON(PrivMsgButton, AvatarList, "Private Message")
00072     VOSGUI_DEFINE_BUTTON(UserInfoButton, AvatarList, "User Info")   
00073     VOSGUI_DEFINE_BUTTON(EditYourInfoButton, AvatarList, "Edit Your Info...")
00074 
00075 public:
00076     friend void UserInfoButton::push(const string& userid);
00077     friend void EditYourInfoButton::push(const string& userid);
00078     friend void PrivMsgButton::push(const string& userid);
00079 
00080 public:
00081 
00082     /** Register with MetaObject system */
00083     static void registerExtenders();
00084 
00085     /** Register MetaObject extenders for other ChatGUI classes that Avatarlist
00086         might use. */
00087     static void registerOtherExtenders();
00088 
00089     /** Setup. Listens to world for avatars. Sets up GUI widgets. Sets a default
00090         title.
00091         @param world Object to listen to for avatars. Acquires a reference.
00092         @param display Object to insert new windows into. Acquires a reference.
00093         @param you
00094     */
00095     void setup(Vobject* world, Vobject* display = 0, Avatar* yourAvatar = 0);
00096 
00097     /** Enable/disable the "Send Private Message" button */
00098     void enablePrivMsg(bool q = true);
00099 
00100     virtual ~AvatarList();
00101 
00102     AvatarList(MetaObject* s);
00103 
00104     static MetaObject* create(MetaObject* s, const string& type);
00105 
00106     VOSGUI::SelectList* getList() {
00107         return &list;
00108     }
00109 
00110     VOS::Vobject* getWorld() {
00111         return &world;
00112     }
00113 
00114     Avatar* getYourAvatar() {
00115         return &yourAvatar;
00116     }
00117 
00118 protected:
00119 
00120     /** Child added callback */
00121     virtual void notifyChildInserted(VobjectEvent&);
00122 
00123     /** Child replaced callback */
00124     virtual void notifyChildReplaced(VobjectEvent&);
00125 
00126     /** Child removed callback */
00127     virtual void notifyChildRemoved(VobjectEvent&);
00128 
00129     /** Child excised callback */
00130     virtual void notifyObjectExcise(RefCounted* obj);
00131 
00132 };
00133 
00134 }
00135 
00136 /** @} */
00137 
00138 #endif

Generated on Tue Aug 12 03:55:37 2003 for Interreality Project - VOS by doxygen 1.3.2