diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llfloatergroupinvite.cpp | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/newview/llfloatergroupinvite.cpp')
-rw-r--r-- | linden/indra/newview/llfloatergroupinvite.cpp | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/linden/indra/newview/llfloatergroupinvite.cpp b/linden/indra/newview/llfloatergroupinvite.cpp new file mode 100644 index 0000000..a727f22 --- /dev/null +++ b/linden/indra/newview/llfloatergroupinvite.cpp | |||
@@ -0,0 +1,137 @@ | |||
1 | /** | ||
2 | * @file llfloatergroupinvite.cpp | ||
3 | * @brief Floater to invite new members into a group. | ||
4 | * | ||
5 | * Copyright (c) 2006-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #include "llviewerprecompiledheaders.h" | ||
29 | |||
30 | #include "llfloatergroupinvite.h" | ||
31 | #include "llpanelgroupinvite.h" | ||
32 | |||
33 | const char FLOATER_TITLE[] = "Group Invitation"; | ||
34 | const LLRect FGI_RECT(0, 380, 210, 0); | ||
35 | |||
36 | class LLFloaterGroupInvite::impl | ||
37 | { | ||
38 | public: | ||
39 | impl(const LLUUID& group_id); | ||
40 | ~impl(); | ||
41 | |||
42 | static void closeFloater(void* data); | ||
43 | |||
44 | public: | ||
45 | LLUUID mGroupID; | ||
46 | LLPanelGroupInvite* mInvitePanelp; | ||
47 | |||
48 | static std::map<LLUUID, LLFloaterGroupInvite*> sInstances; | ||
49 | }; | ||
50 | |||
51 | // | ||
52 | // Globals | ||
53 | // | ||
54 | std::map<LLUUID, LLFloaterGroupInvite*> LLFloaterGroupInvite::impl::sInstances; | ||
55 | |||
56 | LLFloaterGroupInvite::impl::impl(const LLUUID& group_id) | ||
57 | { | ||
58 | mGroupID = group_id; | ||
59 | } | ||
60 | |||
61 | LLFloaterGroupInvite::impl::~impl() | ||
62 | { | ||
63 | } | ||
64 | |||
65 | //static | ||
66 | void LLFloaterGroupInvite::impl::closeFloater(void* data) | ||
67 | { | ||
68 | LLFloaterGroupInvite* floaterp = (LLFloaterGroupInvite*) data; | ||
69 | |||
70 | if ( floaterp ) floaterp->close(); | ||
71 | } | ||
72 | |||
73 | //----------------------------------------------------------------------------- | ||
74 | // Implementation | ||
75 | //----------------------------------------------------------------------------- | ||
76 | LLFloaterGroupInvite::LLFloaterGroupInvite(const std::string& name, | ||
77 | const LLRect &rect, | ||
78 | const std::string& title, | ||
79 | const LLUUID& group_id) | ||
80 | : LLFloater(name, rect, title) | ||
81 | { | ||
82 | LLRect contents(mRect); | ||
83 | contents.mTop -= LLFLOATER_HEADER_SIZE; | ||
84 | |||
85 | mImpl = new impl(group_id); | ||
86 | |||
87 | mImpl->mInvitePanelp = new LLPanelGroupInvite("Group Invite Panel", | ||
88 | group_id); | ||
89 | |||
90 | mImpl->mInvitePanelp->setCloseCallback(impl::closeFloater, this); | ||
91 | |||
92 | mImpl->mInvitePanelp->setRect(contents); | ||
93 | addChild(mImpl->mInvitePanelp); | ||
94 | } | ||
95 | |||
96 | // virtual | ||
97 | LLFloaterGroupInvite::~LLFloaterGroupInvite() | ||
98 | { | ||
99 | if (mImpl->mGroupID.notNull()) | ||
100 | { | ||
101 | impl::sInstances.erase(mImpl->mGroupID); | ||
102 | } | ||
103 | |||
104 | delete mImpl->mInvitePanelp; | ||
105 | delete mImpl; | ||
106 | } | ||
107 | |||
108 | // static | ||
109 | void LLFloaterGroupInvite::showForGroup(const LLUUID& group_id) | ||
110 | { | ||
111 | // Make sure group_id isn't null | ||
112 | if (group_id.isNull()) | ||
113 | { | ||
114 | llwarns << "LLFloaterGroupInvite::showForGroup with null group_id!" << llendl; | ||
115 | return; | ||
116 | } | ||
117 | |||
118 | // If we don't have a floater for this group, create one. | ||
119 | LLFloaterGroupInvite *fgi = get_if_there(impl::sInstances, | ||
120 | group_id, | ||
121 | (LLFloaterGroupInvite*)NULL); | ||
122 | if (!fgi) | ||
123 | { | ||
124 | fgi = new LLFloaterGroupInvite("groupinfo", | ||
125 | FGI_RECT, | ||
126 | FLOATER_TITLE, | ||
127 | group_id); | ||
128 | |||
129 | impl::sInstances[group_id] = fgi; | ||
130 | |||
131 | fgi->mImpl->mInvitePanelp->clear(); | ||
132 | } | ||
133 | |||
134 | fgi->center(); | ||
135 | fgi->open(); | ||
136 | fgi->mImpl->mInvitePanelp->update(); | ||
137 | } | ||