diff options
author | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
commit | cd17687f01420952712a500107e0f93e7ab8d5f8 (patch) | |
tree | ce48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/llfloaterchatterbox.h | |
parent | Second Life viewer sources 1.19.0.5 (diff) | |
download | meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2 meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz |
Second Life viewer sources 1.19.1.0
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llfloaterchatterbox.h | 123 |
1 files changed, 95 insertions, 28 deletions
diff --git a/linden/indra/newview/llfloaterchatterbox.h b/linden/indra/newview/llfloaterchatterbox.h index 185cea3..93601ea 100644 --- a/linden/indra/newview/llfloaterchatterbox.h +++ b/linden/indra/newview/llfloaterchatterbox.h | |||
@@ -36,32 +36,12 @@ | |||
36 | 36 | ||
37 | #include "llfloater.h" | 37 | #include "llfloater.h" |
38 | #include "llstring.h" | 38 | #include "llstring.h" |
39 | #include "llimview.h" | ||
40 | #include "llimpanel.h" | ||
39 | 41 | ||
40 | class LLTabContainerCommon; | 42 | class LLTabContainer; |
41 | 43 | ||
42 | class LLFloaterMyFriends : public LLFloater, public LLUISingleton<LLFloaterMyFriends> | 44 | class LLFloaterChatterBox : public LLMultiFloater, public LLUISingleton<LLFloaterChatterBox, LLFloaterChatterBox> |
43 | { | ||
44 | public: | ||
45 | LLFloaterMyFriends(const LLSD& seed); | ||
46 | virtual ~LLFloaterMyFriends(); | ||
47 | |||
48 | virtual BOOL postBuild(); | ||
49 | |||
50 | void onClose(bool app_quitting); | ||
51 | |||
52 | // override LLUISingleton behavior | ||
53 | static LLFloaterMyFriends* showInstance(const LLSD& id = LLSD()); | ||
54 | static void hideInstance(const LLSD& id); | ||
55 | static BOOL instanceVisible(const LLSD& id); | ||
56 | |||
57 | static void* createFriendsPanel(void* data); | ||
58 | static void* createGroupsPanel(void* data); | ||
59 | |||
60 | protected: | ||
61 | LLTabContainerCommon* mTabs; | ||
62 | }; | ||
63 | |||
64 | class LLFloaterChatterBox : public LLMultiFloater, public LLUISingleton<LLFloaterChatterBox> | ||
65 | { | 45 | { |
66 | public: | 46 | public: |
67 | LLFloaterChatterBox(const LLSD& seed); | 47 | LLFloaterChatterBox(const LLSD& seed); |
@@ -75,16 +55,103 @@ public: | |||
75 | /*virtual*/ void removeFloater(LLFloater* floaterp); | 55 | /*virtual*/ void removeFloater(LLFloater* floaterp); |
76 | /*virtual*/ void addFloater(LLFloater* floaterp, | 56 | /*virtual*/ void addFloater(LLFloater* floaterp, |
77 | BOOL select_added_floater, | 57 | BOOL select_added_floater, |
78 | LLTabContainerCommon::eInsertionPoint insertion_point = LLTabContainerCommon::END); | 58 | LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END); |
79 | |||
80 | static LLFloaterChatterBox* showInstance(const LLSD& seed = LLSD()); | ||
81 | static BOOL instanceVisible(const LLSD& seed); | ||
82 | 59 | ||
83 | static LLFloater* getCurrentVoiceFloater(); | 60 | static LLFloater* getCurrentVoiceFloater(); |
61 | |||
62 | // visibility policy for LLUISingleton | ||
63 | static bool visible(LLFloater* instance, const LLSD& key) | ||
64 | { | ||
65 | LLFloater* floater_to_check = ((LLFloaterChatterBox*)instance)->getFloater(key); | ||
66 | |||
67 | if (floater_to_check) | ||
68 | { | ||
69 | return floater_to_check->isInVisibleChain(); | ||
70 | } | ||
71 | |||
72 | // otherwise use default visibility rule for chatterbox | ||
73 | return VisibilityPolicy<LLFloater>::visible(instance, key); | ||
74 | } | ||
75 | |||
76 | static void show(LLFloater* instance, const LLSD& key) | ||
77 | { | ||
78 | LLFloater* floater_to_show = ((LLFloaterChatterBox*)instance)->getFloater(key); | ||
79 | VisibilityPolicy<LLFloater>::show(instance, key); | ||
80 | |||
81 | if (floater_to_show) | ||
82 | { | ||
83 | floater_to_show->open(); | ||
84 | } | ||
85 | } | ||
86 | |||
87 | static void hide(LLFloater* instance, const LLSD& key) | ||
88 | { | ||
89 | VisibilityPolicy<LLFloater>::hide(instance, key); | ||
90 | } | ||
91 | |||
92 | private: | ||
93 | LLFloater* getFloater(const LLSD& key) | ||
94 | { | ||
95 | LLFloater* floater = NULL; | ||
96 | |||
97 | //try to show requested session | ||
98 | LLUUID session_id = key.asUUID(); | ||
99 | if (session_id.notNull()) | ||
100 | { | ||
101 | floater = LLIMMgr::getInstance()->findFloaterBySession(session_id); | ||
102 | } | ||
103 | |||
104 | // if TRUE, show tab for active voice channel, otherwise, just show last tab | ||
105 | if (key.asBoolean()) | ||
106 | { | ||
107 | floater = getCurrentVoiceFloater(); | ||
108 | } | ||
109 | |||
110 | return floater; | ||
111 | } | ||
84 | 112 | ||
85 | protected: | 113 | protected: |
86 | LLFloater* mActiveVoiceFloater; | 114 | LLFloater* mActiveVoiceFloater; |
87 | }; | 115 | }; |
88 | 116 | ||
89 | 117 | ||
118 | class LLFloaterMyFriends : public LLFloater, public LLUISingleton<LLFloaterMyFriends, LLFloaterMyFriends> | ||
119 | { | ||
120 | public: | ||
121 | LLFloaterMyFriends(const LLSD& seed); | ||
122 | virtual ~LLFloaterMyFriends(); | ||
123 | |||
124 | virtual BOOL postBuild(); | ||
125 | |||
126 | void onClose(bool app_quitting); | ||
127 | |||
128 | static void* createFriendsPanel(void* data); | ||
129 | static void* createGroupsPanel(void* data); | ||
130 | |||
131 | // visibility policy for LLUISingleton | ||
132 | static bool visible(LLFloater* instance, const LLSD& key) | ||
133 | { | ||
134 | LLFloaterMyFriends* floaterp = (LLFloaterMyFriends*)instance; | ||
135 | return floaterp->isInVisibleChain() && floaterp->mTabs->getCurrentPanelIndex() == key.asInteger(); | ||
136 | } | ||
137 | |||
138 | static void show(LLFloater* instance, const LLSD& key) | ||
139 | { | ||
140 | VisibilityPolicy<LLFloater>::show(instance, key); | ||
141 | // garbage values in id will be interpreted as 0, or the friends tab | ||
142 | ((LLFloaterMyFriends*)instance)->mTabs->selectTab(key); | ||
143 | } | ||
144 | |||
145 | static void hide(LLFloater* instance, const LLSD& key) | ||
146 | { | ||
147 | if (visible(instance, key)) | ||
148 | { | ||
149 | LLFloaterChatterBox::hideInstance(); | ||
150 | } | ||
151 | } | ||
152 | |||
153 | protected: | ||
154 | LLTabContainer* mTabs; | ||
155 | }; | ||
156 | |||
90 | #endif // LL_LLFLOATERCHATTERBOX_H | 157 | #endif // LL_LLFLOATERCHATTERBOX_H |