00001
00032 #ifndef LLUICTRLFACTORY_H
00033 #define LLUICTRLFACTORY_H
00034
00035 #include <iosfwd>
00036 #include <stack>
00037
00038 #include "llcallbackmap.h"
00039 #include "llfloater.h"
00040
00041 class LLView;
00042 class LLPanel;
00043
00044 class LLUICtrlFactory : public LLSingleton<LLUICtrlFactory>
00045 {
00046 public:
00047 LLUICtrlFactory();
00048
00049 virtual ~LLUICtrlFactory();
00050
00051 void setupPaths();
00052
00053 void buildFloater(LLFloater* floaterp, const LLString &filename,
00054 const LLCallbackMap::map_t* factory_map = NULL, BOOL open = TRUE);
00055 BOOL buildPanel(LLPanel* panelp, const LLString &filename,
00056 const LLCallbackMap::map_t* factory_map = NULL);
00057
00058 void removePanel(LLPanel* panelp) { mBuiltPanels.erase(panelp->getHandle()); }
00059 void removeFloater(LLFloater* floaterp) { mBuiltFloaters.erase(floaterp->getHandle()); }
00060
00061 class LLMenuGL *buildMenu(const LLString &filename, LLView* parentp);
00062 class LLPieMenu *buildPieMenu(const LLString &filename, LLView* parentp);
00063
00064
00065
00066 S32 saveToXML(LLView* viewp, const LLString& filename);
00067
00068
00069 void rebuild();
00070
00071 static BOOL getAttributeColor(LLXMLNodePtr node, const LLString& name, LLColor4& color);
00072
00073 LLPanel* createFactoryPanel(LLString name);
00074
00075 virtual LLView* createCtrlWidget(LLPanel *parent, LLXMLNodePtr node);
00076 virtual LLView* createWidget(LLPanel *parent, LLXMLNodePtr node);
00077
00078 static bool getLayeredXMLNode(const LLString &filename, LLXMLNodePtr& root);
00079
00080 private:
00081
00082 typedef std::map<LLHandle<LLPanel>, LLString> built_panel_t;
00083 built_panel_t mBuiltPanels;
00084
00085 typedef std::map<LLHandle<LLFloater>, LLString> built_floater_t;
00086 built_floater_t mBuiltFloaters;
00087
00088 std::deque<const LLCallbackMap::map_t*> mFactoryStack;
00089
00090 static std::vector<LLString> mXUIPaths;
00091
00092 LLPanel* mDummyPanel;
00093 };
00094
00095
00096 #endif //LLUICTRLFACTORY_H