aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/lluictrlfactory.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llui/lluictrlfactory.h')
-rw-r--r--linden/indra/llui/lluictrlfactory.h161
1 files changed, 161 insertions, 0 deletions
diff --git a/linden/indra/llui/lluictrlfactory.h b/linden/indra/llui/lluictrlfactory.h
new file mode 100644
index 0000000..ed2a396
--- /dev/null
+++ b/linden/indra/llui/lluictrlfactory.h
@@ -0,0 +1,161 @@
1/**
2 * @file lluictrlfactory.h
3 * @brief Factory class for creating UI controls
4 *
5 * Copyright (c) 2003-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#ifndef LLUICTRLFACTORY_H
29#define LLUICTRLFACTORY_H
30
31#include <iosfwd>
32#include <stack>
33
34#include "llcallbackmap.h"
35#include "llfloater.h"
36
37class LLControlGroup;
38class LLView;
39class LLFontGL;
40
41class LLFloater;
42class LLPanel;
43class LLButton;
44class LLCheckBoxCtrl;
45class LLComboBox;
46class LLIconCtrl;
47class LLLineEditor;
48class LLMenuGL;
49class LLMenuBarGL;
50class LLMenuItemCallGL;
51class LLNameListCtrl;
52class LLPieMenu;
53class LLRadioGroup;
54class LLSearchEditor;
55class LLScrollableContainerView;
56class LLScrollListCtrl;
57class LLSlider;
58class LLSliderCtrl;
59class LLSpinCtrl;
60class LLTextBox;
61class LLTextEditor;
62class LLTextureCtrl;
63class LLWebBrowserCtrl;
64class LLViewBorder;
65class LLColorSwatchCtrl;
66class LLScrollingPanelList;
67
68// Widget
69
70class LLUICtrlFactory
71{
72public:
73 LLUICtrlFactory();
74 // do not call! needs to be public so run-time can clean up the singleton
75 virtual ~LLUICtrlFactory();
76
77 void buildFloater(LLFloater* floaterp, const LLString &filename,
78 const LLCallbackMap::map_t* factory_map = NULL, BOOL open = TRUE);
79
80 void buildPanel(LLPanel* panelp, const LLString &filename,
81 const LLCallbackMap::map_t* factory_map = NULL);
82
83 LLMenuGL *buildMenu(const LLString &filename, LLView* parentp);
84
85 LLPieMenu *buildPieMenu(const LLString &filename, LLView* parentp);
86
87 // Does what you want for LLFloaters and LLPanels
88 // Returns 0 on success
89 S32 saveToXML(LLView* viewp, const LLString& filename);
90
91 void removePanel(LLPanel* panelp);
92 void removeFloater(LLFloater* floaterp);
93
94 void rebuild();
95
96 static EWidgetType getWidgetType(const LLString& ctrl_type);
97 static LLString getWidgetType(EWidgetType ctrl_type);
98 static BOOL getAttributeColor(LLXMLNodePtr node, const LLString& name, LLColor4& color);
99
100 // specific typed getters
101 static LLButton* getButtonByName( LLPanel* panelp, const LLString& name);
102 static LLCheckBoxCtrl* getCheckBoxByName( LLPanel* panelp, const LLString& name);
103 static LLComboBox* getComboBoxByName( LLPanel* panelp, const LLString& name);
104 static LLIconCtrl* getIconByName( LLPanel* panelp, const LLString& name);
105 static LLLineEditor* getLineEditorByName( LLPanel* panelp, const LLString& name);
106 static LLNameListCtrl* getNameListByName( LLPanel* panelp, const LLString& name);
107 static LLRadioGroup* getRadioGroupByName( LLPanel* panelp, const LLString& name);
108 static LLScrollListCtrl* getScrollListByName( LLPanel* panelp, const LLString& name);
109 static LLSliderCtrl* getSliderByName( LLPanel* panelp, const LLString& name);
110 static LLSlider* getSliderBarByName( LLPanel* panelp, const LLString& name);
111 static LLSpinCtrl* getSpinnerByName( LLPanel* panelp, const LLString& name);
112 static LLTextBox* getTextBoxByName( LLPanel* panelp, const LLString& name);
113 static LLTextEditor* getTextEditorByName( LLPanel* panelp, const LLString& name);
114 static LLTabContainerCommon* getTabContainerByName( LLPanel* panelp, const LLString& name);
115 static LLScrollableContainerView* getScrollableContainerByName(LLPanel* panelp, const LLString& name);
116 static LLTextureCtrl* getTexturePickerByName( LLPanel* panelp, const LLString& name);
117 static LLPanel* getPanelByName(LLPanel* panelp, const LLString& name);
118 static LLColorSwatchCtrl* getColorSwatchByName(LLPanel* panelp, const LLString& name);
119 static LLWebBrowserCtrl* getWebBrowserCtrlByName(LLPanel* panelp, const LLString& name);
120 static LLMenuItemCallGL* getMenuItemCallByName(LLPanel* panelp, const LLString& name);
121 static LLScrollingPanelList* getScrollingPanelList(LLPanel* panelp, const LLString& name);
122
123 LLPanel* createFactoryPanel(LLString name);
124
125 virtual LLView* createCtrlWidget(LLPanel *parent, LLXMLNodePtr node);
126 virtual void createWidget(LLPanel *parent, LLXMLNodePtr node);
127
128 // Creator library
129 typedef LLView* (*creator_function_t)(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
130 void registerCreator(LLString ctrlname, creator_function_t function);
131
132 static bool getLayeredXMLNode(const LLString &filename, LLXMLNodePtr& root);
133
134protected:
135
136
137 typedef std::map<LLViewHandle, LLString> built_panel_t;
138 built_panel_t mBuiltPanels;
139 typedef std::map<LLViewHandle, LLString> built_floater_t;
140 built_floater_t mBuiltFloaters;
141
142 std::deque<const LLCallbackMap::map_t*> mFactoryStack;
143
144 static const LLString sUICtrlNames[];
145
146 typedef std::map<LLString, creator_function_t> creator_list_t;
147 creator_list_t mCreatorFunctions;
148 static std::vector<LLString> mXUIPaths;
149};
150
151template<class T>
152class LLUICtrlCreator
153{
154public:
155 static void registerCreator(LLString name, LLUICtrlFactory *factory)
156 {
157 factory->registerCreator(name, T::fromXML);
158 }
159};
160
161#endif //LL_LLWIDGETFACTORY_H