llfloaterchatterbox.h

Go to the documentation of this file.
00001 
00034 #ifndef LL_LLFLOATERCHATTERBOX_H
00035 #define LL_LLFLOATERCHATTERBOX_H
00036 
00037 #include "llfloater.h"
00038 #include "llstring.h"
00039 #include "llimview.h"
00040 #include "llimpanel.h"
00041 
00042 class LLTabContainer;
00043 
00044 class LLFloaterChatterBox : public LLMultiFloater, public LLUISingleton<LLFloaterChatterBox, LLFloaterChatterBox>
00045 {
00046 public:
00047         LLFloaterChatterBox(const LLSD& seed);
00048         virtual ~LLFloaterChatterBox();
00049 
00050         /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
00051         /*virtual*/ void draw();
00052         /*virtual*/ void onOpen();
00053         /*virtual*/ void onClose(bool app_quitting);
00054         /*virtual*/ void setMinimized(BOOL minimized);
00055 
00056         /*virtual*/ void removeFloater(LLFloater* floaterp);
00057         /*virtual*/ void addFloater(LLFloater* floaterp, 
00058                                                                 BOOL select_added_floater, 
00059                                                                 LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END);
00060 
00061         static LLFloater* getCurrentVoiceFloater();
00062         
00063         // visibility policy for LLUISingleton
00064         static bool visible(LLFloater* instance, const LLSD& key)
00065         {
00066                 LLFloater* floater_to_check = ((LLFloaterChatterBox*)instance)->getFloater(key);
00067 
00068                 if (floater_to_check)
00069                 {
00070                         return floater_to_check->isInVisibleChain();
00071                 }
00072 
00073                 // otherwise use default visibility rule for chatterbox
00074                 return VisibilityPolicy<LLFloater>::visible(instance, key);
00075         }
00076 
00077         static void show(LLFloater* instance, const LLSD& key)
00078         {
00079                 LLFloater* floater_to_show = ((LLFloaterChatterBox*)instance)->getFloater(key);
00080                 VisibilityPolicy<LLFloater>::show(instance, key);
00081 
00082                 if (floater_to_show)
00083                 {
00084                         floater_to_show->open();
00085                 }
00086         }
00087 
00088         static void hide(LLFloater* instance, const LLSD& key)
00089         {
00090                 VisibilityPolicy<LLFloater>::hide(instance, key);
00091         }
00092 
00093 private:
00094         LLFloater* getFloater(const LLSD& key)
00095         {
00096                 LLFloater* floater = NULL;
00097 
00098                 //try to show requested session
00099                 LLUUID session_id = key.asUUID();
00100                 if (session_id.notNull())
00101                 {
00102                         floater = LLIMMgr::getInstance()->findFloaterBySession(session_id);
00103                 }
00104 
00105                 // if TRUE, show tab for active voice channel, otherwise, just show last tab
00106                 if (key.asBoolean())
00107                 {
00108                         floater = getCurrentVoiceFloater();
00109                 }
00110 
00111                 return floater;
00112         }
00113 
00114 protected:
00115         LLFloater* mActiveVoiceFloater;
00116 };
00117 
00118 
00119 class LLFloaterMyFriends : public LLFloater, public LLUISingleton<LLFloaterMyFriends, LLFloaterMyFriends>
00120 {
00121 public:
00122         LLFloaterMyFriends(const LLSD& seed);
00123         virtual ~LLFloaterMyFriends();
00124 
00125         virtual BOOL postBuild();
00126 
00127         void onClose(bool app_quitting);
00128 
00129         static void* createFriendsPanel(void* data);
00130         static void* createGroupsPanel(void* data);
00131 
00132         // visibility policy for LLUISingleton
00133         static bool visible(LLFloater* instance, const LLSD& key)
00134         {
00135                 LLFloaterMyFriends* floaterp = (LLFloaterMyFriends*)instance;
00136                 return floaterp->isInVisibleChain() && floaterp->mTabs->getCurrentPanelIndex() == key.asInteger();
00137         }
00138 
00139         static void show(LLFloater* instance, const LLSD& key)
00140         {
00141                 VisibilityPolicy<LLFloater>::show(instance, key);
00142                 // garbage values in id will be interpreted as 0, or the friends tab
00143                 ((LLFloaterMyFriends*)instance)->mTabs->selectTab(key);
00144         }
00145 
00146         static void hide(LLFloater* instance, const LLSD& key)
00147         {
00148                 if (visible(instance, key))
00149                 {
00150                         LLFloaterChatterBox::hideInstance();
00151                 }
00152         }
00153 
00154 protected:
00155         LLTabContainer* mTabs;
00156 };
00157 
00158 #endif // LL_LLFLOATERCHATTERBOX_H

Generated on Fri May 16 08:33:23 2008 for SecondLife by  doxygen 1.5.5