aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/llpanel.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/llui/llpanel.h
parentREADME.txt (diff)
downloadmeta-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/llui/llpanel.h')
-rw-r--r--linden/indra/llui/llpanel.h248
1 files changed, 248 insertions, 0 deletions
diff --git a/linden/indra/llui/llpanel.h b/linden/indra/llui/llpanel.h
new file mode 100644
index 0000000..975c747
--- /dev/null
+++ b/linden/indra/llui/llpanel.h
@@ -0,0 +1,248 @@
1/**
2 * @file llpanel.h
3 * @author James Cook, Tom Yedwab
4 * @brief LLPanel base class
5 *
6 * Copyright (c) 2001-2007, Linden Research, Inc.
7 *
8 * The source code in this file ("Source Code") is provided by Linden Lab
9 * to you under the terms of the GNU General Public License, version 2.0
10 * ("GPL"), unless you have obtained a separate licensing agreement
11 * ("Other License"), formally executed by you and Linden Lab. Terms of
12 * the GPL can be found in doc/GPL-license.txt in this distribution, or
13 * online at http://secondlife.com/developers/opensource/gplv2
14 *
15 * There are special exceptions to the terms and conditions of the GPL as
16 * it is applied to this Source Code. View the full text of the exception
17 * in the file doc/FLOSS-exception.txt in this software distribution, or
18 * online at http://secondlife.com/developers/opensource/flossexception
19 *
20 * By copying, modifying or distributing this software, you acknowledge
21 * that you have read and understood your obligations described above,
22 * and agree to abide by those obligations.
23 *
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE.
27 */
28
29#ifndef LL_LLPANEL_H
30#define LL_LLPANEL_H
31
32// Opaque view with a background and a border. Can contain LLUICtrls.
33
34#include "llcallbackmap.h"
35#include "lluictrl.h"
36#include "llviewborder.h"
37#include "v4color.h"
38#include <list>
39
40const S32 LLPANEL_BORDER_WIDTH = 1;
41const BOOL BORDER_YES = TRUE;
42const BOOL BORDER_NO = FALSE;
43
44class LLViewerImage;
45class LLUUID;
46class LLCheckBoxCtrl;
47class LLComboBox;
48class LLIconCtrl;
49class LLLineEditor;
50class LLRadioGroup;
51class LLScrollListCtrl;
52class LLSliderCtrl;
53class LLSpinCtrl;
54class LLTextBox;
55class LLTextEditor;
56
57class LLAlertInfo
58{
59public:
60 LLString mLabel;
61 LLString::format_map_t mArgs;
62
63 LLAlertInfo(LLString label, LLString::format_map_t args)
64 : mLabel(label), mArgs(args) { }
65
66 LLAlertInfo() { }
67};
68
69class LLPanel : public LLUICtrl
70{
71public:
72 virtual EWidgetType getWidgetType() const;
73 virtual LLString getWidgetTag() const;
74
75 // defaults to TRUE
76 virtual BOOL isPanel();
77
78 // minimal constructor for data-driven initialization
79 LLPanel();
80 LLPanel(const LLString& name);
81
82 // Position and size not saved
83 LLPanel(const LLString& name, const LLRect& rect, BOOL bordered = TRUE);
84
85 // Position and size are saved to rect_control
86 LLPanel(const LLString& name, const LLString& rect_control, BOOL bordered = TRUE);
87
88 void addBorder( LLViewBorder::EBevel border_bevel = LLViewBorder::BEVEL_OUT,
89 LLViewBorder::EStyle border_style = LLViewBorder::STYLE_LINE,
90 S32 border_thickness = LLPANEL_BORDER_WIDTH );
91
92 virtual ~LLPanel();
93 virtual void draw();
94 virtual void refresh(); // called in setFocus()
95 virtual void setFocus( BOOL b );
96 void setFocusRoot(BOOL b) { mIsFocusRoot = b; }
97 virtual BOOL handleKeyHere( KEY key, MASK mask, BOOL called_from_parent );
98 virtual BOOL handleKey( KEY key, MASK mask, BOOL called_from_parent );
99 virtual BOOL postBuild();
100
101 void requires(LLString name, EWidgetType type = WIDGET_TYPE_DONTCARE);
102 BOOL checkRequirements();
103
104 static void alertXml(LLString label, LLString::format_map_t args = LLString::format_map_t());
105 static BOOL nextAlert(LLAlertInfo &alert);
106
107 void setBackgroundColor( const LLColor4& color );
108 void setTransparentColor(const LLColor4& color);
109 void setBackgroundVisible( BOOL b ) { mBgVisible = b; }
110 void setBackgroundOpaque(BOOL b) { mBgOpaque = b; }
111 void setDefaultBtn(LLButton* btn = NULL);
112 void setDefaultBtn(const LLString& id);
113 void setLabel(LLString label) { mLabel = label; }
114 LLString getLabel() const { return mLabel; }
115
116 void setRectControl(const LLString& rect_control) { mRectControl.assign(rect_control); }
117
118 void setBorderVisible( BOOL b );
119
120 void setCtrlsEnabled(BOOL b);
121 virtual void clearCtrls();
122
123 LLViewHandle getHandle() { return mViewHandle; }
124
125 S32 getLastTabGroup() { return mLastTabGroup; }
126
127 LLView* getCtrlByNameAndType(const LLString& name, EWidgetType type);
128
129 static LLPanel* getPanelByHandle(LLViewHandle handle);
130
131 virtual const LLCallbackMap::map_t& getFactoryMap() const { return mFactoryMap; }
132
133 virtual LLXMLNodePtr getXML(bool save_children = true) const;
134 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
135 void initPanelXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
136 void setPanelParameters(LLXMLNodePtr node, LLView *parentp);
137
138 // ** Wrappers for setting child properties by name ** -TomY
139
140 // Override to set not found list
141 virtual LLView* getChildByName(const LLString& name, BOOL recurse = FALSE) const;
142
143 // LLView
144 void childSetVisible(const LLString& name, bool visible);
145 void childShow(const LLString& name) { childSetVisible(name, true); }
146 void childHide(const LLString& name) { childSetVisible(name, false); }
147 bool childIsVisible(const LLString& id) const;
148 void childSetTentative(const LLString& name, bool tentative);
149
150 void childSetEnabled(const LLString& name, bool enabled);
151 void childEnable(const LLString& name) { childSetEnabled(name, true); }
152 void childDisable(const LLString& name) { childSetEnabled(name, false); };
153 bool childIsEnabled(const LLString& id) const;
154
155 void childSetToolTip(const LLString& id, const LLString& msg);
156 void childSetRect(const LLString& id, const LLRect &rect);
157 bool childGetRect(const LLString& id, LLRect& rect) const;
158
159 // LLUICtrl
160 void childSetFocus(const LLString& id, BOOL focus = TRUE);
161 BOOL childHasFocus(const LLString& id);
162 void childSetFocusChangedCallback(const LLString& id, void (*cb)(LLUICtrl*, void*));
163
164 void childSetCommitCallback(const LLString& id, void (*cb)(LLUICtrl*, void*), void* userdata = NULL );
165 void childSetDoubleClickCallback(const LLString& id, void (*cb)(void*), void* userdata = NULL );
166 void childSetValidate(const LLString& id, BOOL (*cb)(LLUICtrl*, void*) );
167 void childSetUserData(const LLString& id, void* userdata);
168
169 void childSetColor(const LLString& id, const LLColor4& color);
170
171 LLCtrlSelectionInterface* childGetSelectionInterface(const LLString& id);
172 LLCtrlListInterface* childGetListInterface(const LLString& id);
173 LLCtrlScrollInterface* childGetScrollInterface(const LLString& id);
174
175 // This is the magic bullet for data-driven UI
176 void childSetValue(const LLString& id, LLSD value);
177 LLSD childGetValue(const LLString& id) const;
178
179 // For setting text / label replacement params, e.g. "Hello [NAME]"
180 // Not implemented for all types, defaults to noop, returns FALSE if not applicaple
181 BOOL childSetTextArg(const LLString& id, const LLString& key, const LLString& text);
182 BOOL childSetLabelArg(const LLString& id, const LLString& key, const LLString& text);
183
184 // LLSlider / LLSpinCtrl
185 void childSetMinValue(const LLString& id, LLSD min_value);
186 void childSetMaxValue(const LLString& id, LLSD max_value);
187
188 // LLTabContainer
189 void childShowTab(const LLString& id, const LLString& tabname, bool visible = true);
190 LLPanel *childGetVisibleTab(const LLString& id);
191 void childSetTabChangeCallback(const LLString& id, const LLString& tabname, void (*on_tab_clicked)(void*, bool), void *userdata);
192
193 // LLTextBox
194 void childSetWrappedText(const LLString& id, const LLString& text, bool visible = true);
195
196 // LLTextBox/LLTextEditor/LLLineEditor
197 void childSetText(const LLString& id, const LLString& text);
198 LLString childGetText(const LLString& id);
199
200 // LLLineEditor
201 void childSetKeystrokeCallback(const LLString& id, void (*keystroke_callback)(LLLineEditor* caller, void* user_data), void *user_data);
202 void childSetPrevalidate(const LLString& id, BOOL (*func)(const LLWString &) );
203
204 // LLButton
205 void childSetAction(const LLString& id, void(*function)(void*), void* value);
206 void childSetActionTextbox(const LLString& id, void(*function)(void*));
207 void childSetControlName(const LLString& id, const LLString& control_name);
208
209 // Error reporting
210 void childNotFound(const LLString& id) const;
211 void childDisplayNotFound();
212
213 typedef std::queue<LLAlertInfo> alert_queue_t;
214 static alert_queue_t sAlertQueue;
215
216private:
217 // common constructor
218 void init();
219
220protected:
221 virtual void addCtrl( LLUICtrl* ctrl, S32 tab_group );
222 virtual void addCtrlAtEnd( LLUICtrl* ctrl, S32 tab_group);
223
224 // Unified error reporting for the child* functions
225 typedef std::set<LLString> expected_members_list_t;
226 mutable expected_members_list_t mExpectedMembers;
227 mutable expected_members_list_t mNewExpectedMembers;
228
229 LLString mRectControl;
230 LLColor4 mBgColorAlpha;
231 LLColor4 mBgColorOpaque;
232 LLColor4 mDefaultBtnHighlight;
233 BOOL mBgVisible;
234 BOOL mBgOpaque;
235 LLViewBorder* mBorder;
236 LLButton* mDefaultBtn;
237 LLCallbackMap::map_t mFactoryMap;
238 LLString mLabel;
239 S32 mLastTabGroup;
240
241 typedef std::map<LLString, EWidgetType> requirements_map_t;
242 requirements_map_t mRequirements;
243
244 typedef std::map<LLViewHandle, LLPanel*> panel_map_t;
245 static panel_map_t sPanelMap;
246};
247
248#endif