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/llviewchildren.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 '')
-rw-r--r-- | linden/indra/newview/llviewchildren.cpp | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/linden/indra/newview/llviewchildren.cpp b/linden/indra/newview/llviewchildren.cpp new file mode 100644 index 0000000..f279ac0 --- /dev/null +++ b/linden/indra/newview/llviewchildren.cpp | |||
@@ -0,0 +1,118 @@ | |||
1 | /** | ||
2 | * @file llviewchildren.cpp | ||
3 | * @brief LLViewChildren class implementation | ||
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 "llviewchildren.h" | ||
31 | |||
32 | #include "lluictrlfactory.h" | ||
33 | |||
34 | // viewer includes | ||
35 | #include "llbutton.h" | ||
36 | #include "lliconctrl.h" | ||
37 | #include "lltextbox.h" | ||
38 | #include "lluuid.h" | ||
39 | #include "llpanel.h" | ||
40 | #include "llviewercontrol.h" | ||
41 | |||
42 | |||
43 | // *NOTE: Do not use mParent reference in the constructor, since it is | ||
44 | // potentially not fully constructud. | ||
45 | LLViewChildren::LLViewChildren(LLPanel& parent) | ||
46 | : mParent(parent) | ||
47 | { | ||
48 | } | ||
49 | |||
50 | |||
51 | void LLViewChildren::show(const char* id, bool visible) | ||
52 | { | ||
53 | mParent.childSetVisible(id, visible); | ||
54 | } | ||
55 | |||
56 | void LLViewChildren::enable(const char* id, bool enabled) | ||
57 | { | ||
58 | mParent.childSetEnabled(id, enabled); | ||
59 | } | ||
60 | |||
61 | void LLViewChildren::setText( | ||
62 | const char* id, const std::string& text, bool visible) | ||
63 | { | ||
64 | LLTextBox* child = LLUICtrlFactory::getTextBoxByName(&mParent, id); | ||
65 | if (child) | ||
66 | { | ||
67 | child->setVisible(visible); | ||
68 | child->setText(text); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | void LLViewChildren::setWrappedText( | ||
73 | const char* id, const std::string& text, bool visible) | ||
74 | { | ||
75 | LLTextBox* child = LLUICtrlFactory::getTextBoxByName(&mParent, id); | ||
76 | if (child) | ||
77 | { | ||
78 | child->setVisible(visible); | ||
79 | child->setWrappedText(text); | ||
80 | } | ||
81 | } | ||
82 | |||
83 | void LLViewChildren::setBadge(const char* id, Badge badge, bool visible) | ||
84 | { | ||
85 | static LLUUID badgeOK(gViewerArt.getString("badge_ok.tga")); | ||
86 | static LLUUID badgeNote(gViewerArt.getString("badge_note.tga")); | ||
87 | static LLUUID badgeWarn(gViewerArt.getString("badge_warn.tga")); | ||
88 | static LLUUID badgeError(gViewerArt.getString("badge_error.tga")); | ||
89 | |||
90 | LLUUID badgeUUID; | ||
91 | switch (badge) | ||
92 | { | ||
93 | default: | ||
94 | case BADGE_OK: badgeUUID = badgeOK; break; | ||
95 | case BADGE_NOTE: badgeUUID = badgeNote; break; | ||
96 | case BADGE_WARN: badgeUUID = badgeWarn; break; | ||
97 | case BADGE_ERROR: badgeUUID = badgeError; break; | ||
98 | } | ||
99 | |||
100 | LLIconCtrl* child = LLUICtrlFactory::getIconByName(&mParent, id); | ||
101 | if (child) | ||
102 | { | ||
103 | child->setVisible(visible); | ||
104 | child->setImage(badgeUUID); | ||
105 | } | ||
106 | } | ||
107 | |||
108 | void LLViewChildren::setAction(const char* id, | ||
109 | void(*function)(void*), void* value) | ||
110 | { | ||
111 | LLButton* button = LLUICtrlFactory::getButtonByName(&mParent, id); | ||
112 | if (button) | ||
113 | { | ||
114 | button->setClickedCallback(function, value); | ||
115 | } | ||
116 | } | ||
117 | |||
118 | |||