diff options
author | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
commit | cd17687f01420952712a500107e0f93e7ab8d5f8 (patch) | |
tree | ce48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/llui/lluictrlfactory.h | |
parent | Second Life viewer sources 1.19.0.5 (diff) | |
download | meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2 meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz |
Second Life viewer sources 1.19.1.0
Diffstat (limited to 'linden/indra/llui/lluictrlfactory.h')
-rw-r--r-- | linden/indra/llui/lluictrlfactory.h | 127 |
1 files changed, 51 insertions, 76 deletions
diff --git a/linden/indra/llui/lluictrlfactory.h b/linden/indra/llui/lluictrlfactory.h index fbb8d96..e6a2cd3 100644 --- a/linden/indra/llui/lluictrlfactory.h +++ b/linden/indra/llui/lluictrlfactory.h | |||
@@ -38,68 +38,35 @@ | |||
38 | #include "llcallbackmap.h" | 38 | #include "llcallbackmap.h" |
39 | #include "llfloater.h" | 39 | #include "llfloater.h" |
40 | 40 | ||
41 | class LLControlGroup; | ||
42 | class LLView; | 41 | class LLView; |
43 | class LLFontGL; | ||
44 | |||
45 | class LLFloater; | ||
46 | class LLPanel; | 42 | class LLPanel; |
47 | class LLButton; | ||
48 | class LLCheckBoxCtrl; | ||
49 | class LLComboBox; | ||
50 | class LLIconCtrl; | ||
51 | class LLLineEditor; | ||
52 | class LLMenuGL; | ||
53 | class LLMenuBarGL; | ||
54 | class LLMenuItemCallGL; | ||
55 | class LLNameListCtrl; | ||
56 | class LLPieMenu; | ||
57 | class LLRadioGroup; | ||
58 | class LLSearchEditor; | ||
59 | class LLScrollableContainerView; | ||
60 | class LLScrollListCtrl; | ||
61 | class LLSlider; | ||
62 | class LLSliderCtrl; | ||
63 | class LLSpinCtrl; | ||
64 | class LLTextBox; | ||
65 | class LLTextEditor; | ||
66 | class LLTextureCtrl; | ||
67 | class LLWebBrowserCtrl; | ||
68 | class LLViewBorder; | ||
69 | class LLColorSwatchCtrl; | ||
70 | class LLScrollingPanelList; | ||
71 | class LLCtrlListInterface; | ||
72 | class LLCtrlSelectionInterface; | ||
73 | class LLCtrlScrollInterface; | ||
74 | |||
75 | // Widget | ||
76 | 43 | ||
77 | class LLUICtrlFactory | 44 | class LLUICtrlFactory |
78 | { | 45 | { |
79 | public: | 46 | public: |
80 | LLUICtrlFactory(); | 47 | LLUICtrlFactory(); |
81 | // do not call! needs to be public so run-time can clean up the singleton | 48 | // do not call! needs to be public so run-time can clean up the singleton |
82 | virtual ~LLUICtrlFactory(); | 49 | virtual ~LLUICtrlFactory() {} |
83 | 50 | ||
84 | void setupPaths(); | 51 | void setupPaths(); |
85 | 52 | ||
86 | void buildFloater(LLFloater* floaterp, const LLString &filename, | 53 | void buildFloater(LLFloater* floaterp, const LLString &filename, |
87 | const LLCallbackMap::map_t* factory_map = NULL, BOOL open = TRUE); | 54 | const LLCallbackMap::map_t* factory_map = NULL, BOOL open = TRUE); |
88 | |||
89 | BOOL buildPanel(LLPanel* panelp, const LLString &filename, | 55 | BOOL buildPanel(LLPanel* panelp, const LLString &filename, |
90 | const LLCallbackMap::map_t* factory_map = NULL); | 56 | const LLCallbackMap::map_t* factory_map = NULL); |
91 | 57 | ||
92 | LLMenuGL *buildMenu(const LLString &filename, LLView* parentp); | 58 | void removePanel(LLPanel* panelp) { mBuiltPanels.erase(panelp->getHandle()); } |
59 | void removeFloater(LLFloater* floaterp) { mBuiltFloaters.erase(floaterp->getHandle()); } | ||
93 | 60 | ||
94 | LLPieMenu *buildPieMenu(const LLString &filename, LLView* parentp); | 61 | class LLMenuGL *buildMenu(const LLString &filename, LLView* parentp); |
62 | class LLPieMenu *buildPieMenu(const LLString &filename, LLView* parentp); | ||
95 | 63 | ||
96 | // Does what you want for LLFloaters and LLPanels | 64 | // Does what you want for LLFloaters and LLPanels |
97 | // Returns 0 on success | 65 | // Returns 0 on success |
98 | S32 saveToXML(LLView* viewp, const LLString& filename); | 66 | S32 saveToXML(LLView* viewp, const LLString& filename); |
99 | 67 | ||
100 | void removePanel(LLPanel* panelp); | ||
101 | void removeFloater(LLFloater* floaterp); | ||
102 | 68 | ||
69 | // Rebuilds all currently built panels. | ||
103 | void rebuild(); | 70 | void rebuild(); |
104 | 71 | ||
105 | static EWidgetType getWidgetType(const LLString& ctrl_type); | 72 | static EWidgetType getWidgetType(const LLString& ctrl_type); |
@@ -107,38 +74,44 @@ public: | |||
107 | static BOOL getAttributeColor(LLXMLNodePtr node, const LLString& name, LLColor4& color); | 74 | static BOOL getAttributeColor(LLXMLNodePtr node, const LLString& name, LLColor4& color); |
108 | 75 | ||
109 | // specific typed getters | 76 | // specific typed getters |
110 | static LLButton* getButtonByName( LLPanel* panelp, const LLString& name); | 77 | static class LLButton* getButtonByName( const LLPanel* panelp, const LLString& name); |
111 | static LLCheckBoxCtrl* getCheckBoxByName( LLPanel* panelp, const LLString& name); | 78 | static class LLCheckBoxCtrl* getCheckBoxByName( const LLPanel* panelp, const LLString& name); |
112 | static LLComboBox* getComboBoxByName( LLPanel* panelp, const LLString& name); | 79 | static class LLComboBox* getComboBoxByName( const LLPanel* panelp, const LLString& name); |
113 | static LLIconCtrl* getIconByName( LLPanel* panelp, const LLString& name); | 80 | static class LLIconCtrl* getIconByName( const LLPanel* panelp, const LLString& name); |
114 | static LLLineEditor* getLineEditorByName( LLPanel* panelp, const LLString& name); | 81 | static class LLLineEditor* getLineEditorByName( const LLPanel* panelp, const LLString& name); |
115 | static LLNameListCtrl* getNameListByName( LLPanel* panelp, const LLString& name); | 82 | static class LLRadioGroup* getRadioGroupByName( const LLPanel* panelp, const LLString& name); |
116 | static LLRadioGroup* getRadioGroupByName( LLPanel* panelp, const LLString& name); | 83 | static class LLScrollListCtrl* getScrollListByName( const LLPanel* panelp, const LLString& name); |
117 | static LLScrollListCtrl* getScrollListByName( LLPanel* panelp, const LLString& name); | 84 | static class LLSliderCtrl* getSliderByName( const LLPanel* panelp, const LLString& name); |
118 | static LLSliderCtrl* getSliderByName( LLPanel* panelp, const LLString& name); | 85 | static class LLSlider* getSliderBarByName( const LLPanel* panelp, const LLString& name); |
119 | static LLSlider* getSliderBarByName( LLPanel* panelp, const LLString& name); | 86 | static class LLSpinCtrl* getSpinnerByName( const LLPanel* panelp, const LLString& name); |
120 | static LLSpinCtrl* getSpinnerByName( LLPanel* panelp, const LLString& name); | 87 | static class LLTextBox* getTextBoxByName( const LLPanel* panelp, const LLString& name); |
121 | static LLTextBox* getTextBoxByName( LLPanel* panelp, const LLString& name); | 88 | static class LLTextEditor* getTextEditorByName( const LLPanel* panelp, const LLString& name); |
122 | static LLTextEditor* getTextEditorByName( LLPanel* panelp, const LLString& name); | 89 | static class LLTabContainer* getTabContainerByName( const LLPanel* panelp, const LLString& name); |
123 | static LLTabContainerCommon* getTabContainerByName( LLPanel* panelp, const LLString& name); | 90 | static class LLScrollableContainerView* getScrollableContainerByName(const LLPanel* panelp, const LLString& name); |
124 | static LLScrollableContainerView* getScrollableContainerByName(LLPanel* panelp, const LLString& name); | 91 | static class LLPanel* getPanelByName( const LLPanel* panelp, const LLString& name); |
125 | static LLTextureCtrl* getTexturePickerByName( LLPanel* panelp, const LLString& name); | 92 | static class LLMenuItemCallGL* getMenuItemCallByName( const LLPanel* panelp, const LLString& name); |
126 | static LLPanel* getPanelByName(LLPanel* panelp, const LLString& name); | 93 | static class LLScrollingPanelList* getScrollingPanelList( const LLPanel* panelp, const LLString& name); |
127 | static LLColorSwatchCtrl* getColorSwatchByName(LLPanel* panelp, const LLString& name); | 94 | static class LLMultiSliderCtrl* getMultiSliderByName( const LLPanel* panelp, const LLString& name); |
128 | static LLWebBrowserCtrl* getWebBrowserCtrlByName(LLPanel* panelp, const LLString& name); | 95 | static class LLMultiSlider* getMultiSliderBarByName(const LLPanel* panelp, const LLString& name); |
129 | static LLMenuItemCallGL* getMenuItemCallByName(LLPanel* panelp, const LLString& name); | ||
130 | static LLScrollingPanelList* getScrollingPanelList(LLPanel* panelp, const LLString& name); | ||
131 | 96 | ||
132 | // interface getters | 97 | // interface getters |
133 | static LLCtrlListInterface* getListInterfaceByName(LLPanel* panelp, const LLString& name); | 98 | static LLCtrlListInterface* getListInterfaceByName( const LLPanel* panelp, const LLString& name); |
134 | static LLCtrlSelectionInterface* getSelectionInterfaceByName(LLPanel* panelp, const LLString& name); | 99 | static LLCtrlSelectionInterface* getSelectionInterfaceByName(const LLPanel* panelp, const LLString& name); |
135 | static LLCtrlScrollInterface* getScrollInterfaceByName(LLPanel* panelp, const LLString& name); | 100 | static LLCtrlScrollInterface* getScrollInterfaceByName(const LLPanel* panelp, const LLString& name); |
136 | 101 | ||
137 | LLPanel* createFactoryPanel(LLString name); | 102 | LLPanel* createFactoryPanel(LLString name); |
138 | 103 | ||
139 | virtual LLView* createCtrlWidget(LLPanel *parent, LLXMLNodePtr node); | 104 | virtual LLView* createCtrlWidget(LLPanel *parent, LLXMLNodePtr node); |
140 | virtual void createWidget(LLPanel *parent, LLXMLNodePtr node); | 105 | virtual void createWidget(LLPanel *parent, LLXMLNodePtr node); |
141 | 106 | ||
107 | template <class T> T* createDummyWidget(const LLString& name) | ||
108 | { | ||
109 | return NULL; | ||
110 | //static LLPanel dummy_panel; | ||
111 | //LLXMLNodePtr new_node_ptr = new LLXMLNode(T::getWidgetTag(), FALSE); | ||
112 | //return createWidget(&dummy_panel, new_node_ptr); | ||
113 | } | ||
114 | |||
142 | // Creator library | 115 | // Creator library |
143 | typedef LLView* (*creator_function_t)(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); | 116 | typedef LLView* (*creator_function_t)(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); |
144 | void registerCreator(LLString ctrlname, creator_function_t function); | 117 | void registerCreator(LLString ctrlname, creator_function_t function); |
@@ -147,10 +120,21 @@ public: | |||
147 | 120 | ||
148 | protected: | 121 | protected: |
149 | 122 | ||
123 | template<class T> | ||
124 | class LLUICtrlCreator | ||
125 | { | ||
126 | public: | ||
127 | static void registerCreator(LLString name, LLUICtrlFactory *factory) | ||
128 | { | ||
129 | factory->registerCreator(name, T::fromXML); | ||
130 | } | ||
131 | }; | ||
132 | |||
133 | private: | ||
150 | 134 | ||
151 | typedef std::map<LLViewHandle, LLString> built_panel_t; | 135 | typedef std::map<LLHandle<LLPanel>, LLString> built_panel_t; |
152 | built_panel_t mBuiltPanels; | 136 | built_panel_t mBuiltPanels; |
153 | typedef std::map<LLViewHandle, LLString> built_floater_t; | 137 | typedef std::map<LLHandle<LLFloater>, LLString> built_floater_t; |
154 | built_floater_t mBuiltFloaters; | 138 | built_floater_t mBuiltFloaters; |
155 | 139 | ||
156 | std::deque<const LLCallbackMap::map_t*> mFactoryStack; | 140 | std::deque<const LLCallbackMap::map_t*> mFactoryStack; |
@@ -162,14 +146,5 @@ protected: | |||
162 | static std::vector<LLString> mXUIPaths; | 146 | static std::vector<LLString> mXUIPaths; |
163 | }; | 147 | }; |
164 | 148 | ||
165 | template<class T> | ||
166 | class LLUICtrlCreator | ||
167 | { | ||
168 | public: | ||
169 | static void registerCreator(LLString name, LLUICtrlFactory *factory) | ||
170 | { | ||
171 | factory->registerCreator(name, T::fromXML); | ||
172 | } | ||
173 | }; | ||
174 | 149 | ||
175 | #endif //LL_LLWIDGETFACTORY_H | 150 | #endif //LLUICTRLFACTORY_H |