summaryrefslogtreecommitdiff
path: root/indra/llui/llpanel.h
diff options
context:
space:
mode:
authorMonroe Linden <monroe@lindenlab.com>2010-08-27 16:58:33 -0700
committerMonroe Linden <monroe@lindenlab.com>2010-08-27 16:58:33 -0700
commitb62b10dd260c8c01e82e5b206c17a410cedc79f4 (patch)
tree2ea582bb63476566ddabfbd5a0a8f3747eb3fc8e /indra/llui/llpanel.h
parentbef304c0a34bfcd7997bd7799995229ddcc1de31 (diff)
parent51311875b6e23fa9475c42b6d15637aa668729c5 (diff)
Post-convert merge by convert_monolith.py from ./viewer-experience
Diffstat (limited to 'indra/llui/llpanel.h')
-rw-r--r--indra/llui/llpanel.h62
1 files changed, 60 insertions, 2 deletions
diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h
index a7224648c1..c1a1a06f39 100644
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -104,7 +104,10 @@ protected:
LLPanel(const LLPanel::Params& params = getDefaultParams());
public:
-// LLPanel(const std::string& name, const LLRect& rect = LLRect(), BOOL bordered = TRUE);
+ BOOL buildFromFile(const std::string &filename, LLXMLNodePtr output_node = NULL, const LLPanel::Params&default_params = getDefaultParams());
+
+ static LLPanel* createFactoryPanel(const std::string& name);
+
/*virtual*/ ~LLPanel();
// LLView interface
@@ -157,7 +160,7 @@ public:
EnableCallbackRegistry::ScopedRegistrar& getEnableCallbackRegistrar() { return mEnableCallbackRegistrar; }
void initFromParams(const Params& p);
- BOOL initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node = NULL);
+ BOOL initPanelXML( LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node, const LLPanel::Params& default_params);
bool hasString(const std::string& name);
std::string getString(const std::string& name, const LLStringUtil::format_map_t& args) const;
@@ -256,6 +259,8 @@ protected:
commit_signal_t* mVisibleSignal; // Called when visibility changes, passes new visibility as LLSD()
std::string mHelpTopic; // the name of this panel's help topic to display in the Help Viewer
+ typedef std::deque<const LLCallbackMap::map_t*> factory_stack_t;
+ static factory_stack_t sFactoryStack;
private:
BOOL mBgVisible; // any background at all?
@@ -285,4 +290,57 @@ extern template class LLPanel* LLView::getChild<class LLPanel>(
const std::string& name, BOOL recurse) const;
#endif
+typedef boost::function<LLPanel* (void)> LLPanelClassCreatorFunc;
+
+// local static instance for registering a particular panel class
+
+class LLRegisterPanelClass
+: public LLSingleton< LLRegisterPanelClass >
+{
+public:
+ // reigister with either the provided builder, or the generic templated builder
+ void addPanelClass(const std::string& tag,LLPanelClassCreatorFunc func)
+ {
+ mPanelClassesNames[tag] = func;
+ }
+
+ LLPanel* createPanelClass(const std::string& tag)
+ {
+ param_name_map_t::iterator iT = mPanelClassesNames.find(tag);
+ if(iT == mPanelClassesNames.end())
+ return 0;
+ return iT->second();
+ }
+ template<typename T>
+ static T* defaultPanelClassBuilder()
+ {
+ T* pT = new T();
+ return pT;
+ }
+
+private:
+ typedef std::map< std::string, LLPanelClassCreatorFunc> param_name_map_t;
+
+ param_name_map_t mPanelClassesNames;
+};
+
+
+// local static instance for registering a particular panel class
+template<typename T>
+class LLRegisterPanelClassWrapper
+: public LLRegisterPanelClass
+{
+public:
+ // reigister with either the provided builder, or the generic templated builder
+ LLRegisterPanelClassWrapper(const std::string& tag);
+};
+
+
+template<typename T>
+LLRegisterPanelClassWrapper<T>::LLRegisterPanelClassWrapper(const std::string& tag)
+{
+ LLRegisterPanelClass::instance().addPanelClass(tag,&LLRegisterPanelClass::defaultPanelClassBuilder<T>);
+}
+
+
#endif