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/llui/lluictrlfactory.h | |
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/llui/lluictrlfactory.h')
-rw-r--r-- | linden/indra/llui/lluictrlfactory.h | 161 |
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 | |||
37 | class LLControlGroup; | ||
38 | class LLView; | ||
39 | class LLFontGL; | ||
40 | |||
41 | class LLFloater; | ||
42 | class LLPanel; | ||
43 | class LLButton; | ||
44 | class LLCheckBoxCtrl; | ||
45 | class LLComboBox; | ||
46 | class LLIconCtrl; | ||
47 | class LLLineEditor; | ||
48 | class LLMenuGL; | ||
49 | class LLMenuBarGL; | ||
50 | class LLMenuItemCallGL; | ||
51 | class LLNameListCtrl; | ||
52 | class LLPieMenu; | ||
53 | class LLRadioGroup; | ||
54 | class LLSearchEditor; | ||
55 | class LLScrollableContainerView; | ||
56 | class LLScrollListCtrl; | ||
57 | class LLSlider; | ||
58 | class LLSliderCtrl; | ||
59 | class LLSpinCtrl; | ||
60 | class LLTextBox; | ||
61 | class LLTextEditor; | ||
62 | class LLTextureCtrl; | ||
63 | class LLWebBrowserCtrl; | ||
64 | class LLViewBorder; | ||
65 | class LLColorSwatchCtrl; | ||
66 | class LLScrollingPanelList; | ||
67 | |||
68 | // Widget | ||
69 | |||
70 | class LLUICtrlFactory | ||
71 | { | ||
72 | public: | ||
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 | |||
134 | protected: | ||
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 | |||
151 | template<class T> | ||
152 | class LLUICtrlCreator | ||
153 | { | ||
154 | public: | ||
155 | static void registerCreator(LLString name, LLUICtrlFactory *factory) | ||
156 | { | ||
157 | factory->registerCreator(name, T::fromXML); | ||
158 | } | ||
159 | }; | ||
160 | |||
161 | #endif //LL_LLWIDGETFACTORY_H | ||