aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloaterevent.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:16 -0500
committerJacek Antonelli2008-08-15 23:45:16 -0500
commit3f27ba891ac4d032753b219b4b96d1ffbc9fb488 (patch)
tree504932ee91a0356fba7ea48798887c96867e492f /linden/indra/newview/llfloaterevent.cpp
parentSecond Life viewer sources 1.18.4.3 (diff)
downloadmeta-impy-3f27ba891ac4d032753b219b4b96d1ffbc9fb488.zip
meta-impy-3f27ba891ac4d032753b219b4b96d1ffbc9fb488.tar.gz
meta-impy-3f27ba891ac4d032753b219b4b96d1ffbc9fb488.tar.bz2
meta-impy-3f27ba891ac4d032753b219b4b96d1ffbc9fb488.tar.xz
Second Life viewer sources 1.18.5.0-RC
Diffstat (limited to 'linden/indra/newview/llfloaterevent.cpp')
-rw-r--r--linden/indra/newview/llfloaterevent.cpp120
1 files changed, 120 insertions, 0 deletions
diff --git a/linden/indra/newview/llfloaterevent.cpp b/linden/indra/newview/llfloaterevent.cpp
new file mode 100644
index 0000000..d237fc9
--- /dev/null
+++ b/linden/indra/newview/llfloaterevent.cpp
@@ -0,0 +1,120 @@
1/**
2 * @file llfloaterevent.cpp
3 * @brief LLFloaterEventInfo class implementation
4 *
5 * Event information as shown in a floating window from secondlife:// command
6 * handler.
7 *
8 * $LicenseInfo:firstyear=2002&license=internal$
9 *
10 * Copyright (c) 2002-2007, Linden Research, Inc.
11 *
12 * The following source code is PROPRIETARY AND CONFIDENTIAL. Use of
13 * this source code is governed by the Linden Lab Source Code Disclosure
14 * Agreement ("Agreement") previously entered between you and Linden
15 * Lab. By accessing, using, copying, modifying or distributing this
16 * software, you acknowledge that you have been informed of your
17 * obligations under the Agreement and agree to abide by those obligations.
18 *
19 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
20 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
21 * COMPLETENESS OR PERFORMANCE.
22 * $/LicenseInfo$
23 */
24
25#include "llviewerprecompiledheaders.h"
26
27#include "llfloaterevent.h"
28
29// viewer project includes
30#include "llcommandhandler.h"
31#include "llpanelevent.h"
32#include "llvieweruictrlfactory.h"
33
34// linden library includes
35#include "lluuid.h"
36
37////////////////////////////////////////////////////////////////////////////
38// LLFloaterEventInfo
39
40//-----------------------------------------------------------------------------
41// Globals
42//-----------------------------------------------------------------------------
43
44LLMap< U32, LLFloaterEventInfo* > gEventInfoInstances;
45
46class LLEventHandler : public LLCommandHandler
47{
48public:
49 LLEventHandler() : LLCommandHandler("event") { }
50 bool handle(const std::vector<std::string>& tokens)
51 {
52 if (tokens.size() < 2)
53 {
54 return false;
55 }
56 U32 event_id = atoi(tokens[0].c_str());
57 if (tokens[1] == "about")
58 {
59 LLFloaterEventInfo::show(event_id);
60 return true;
61 }
62 return false;
63 }
64};
65LLEventHandler gEventHandler;
66
67LLFloaterEventInfo::LLFloaterEventInfo(const std::string& name, const U32 event_id)
68: LLFloater(name),
69 mEventID( event_id )
70{
71
72 mFactoryMap["event_details_panel"] = LLCallbackMap(LLFloaterEventInfo::createEventDetail, this);
73 gUICtrlFactory->buildFloater(this, "floater_preview_event.xml", &getFactoryMap());
74 gEventInfoInstances.addData(event_id, this);
75}
76
77LLFloaterEventInfo::~LLFloaterEventInfo()
78{
79 // child views automatically deleted
80 gEventInfoInstances.removeData(mEventID);
81}
82
83void LLFloaterEventInfo::displayEventInfo(const U32 event_id)
84{
85 mPanelEventp->setEventID(event_id);
86 this->setFrontmost(true);
87}
88
89// static
90void* LLFloaterEventInfo::createEventDetail(void* userdata)
91{
92 LLFloaterEventInfo *self = (LLFloaterEventInfo*)userdata;
93 self->mPanelEventp = new LLPanelEvent();
94 gUICtrlFactory->buildPanel(self->mPanelEventp, "panel_event.xml");
95
96 return self->mPanelEventp;
97}
98
99// static
100LLFloaterEventInfo* LLFloaterEventInfo::show(const U32 event_id)
101{
102 LLFloaterEventInfo *floater;
103 if (gEventInfoInstances.checkData(event_id))
104 {
105 // ...bring that window to front
106 floater = gEventInfoInstances.getData(event_id);
107 floater->open(); /*Flawfinder: ignore*/
108 floater->setFrontmost(true);
109 }
110 else
111 {
112 floater = new LLFloaterEventInfo("eventinfo", event_id );
113 floater->center();
114 floater->open(); /*Flawfinder: ignore*/
115 floater->displayEventInfo(event_id);
116 floater->setFrontmost(true);
117 }
118
119 return floater;
120}