1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
#ifndef _2430e622_7ed5_481e_91df_1a6805bc9e49_
#define _2430e622_7ed5_481e_91df_1a6805bc9e49_
#include <sstream>
#include "WidgetContainer.h"
namespace tools
{
typedef MyGUI::delegates::CMultiDelegate0 Event_ChangeWidgets;
typedef MyGUI::delegates::CMultiDelegate3<MyGUI::Widget*, const MyGUI::IntCoord&, const std::string&> Event_ChangeWidgetCoord;
typedef std::vector<WidgetContainer*> VectorWidgetContainer;
typedef MyGUI::Enumerator<VectorWidgetContainer> EnumeratorWidgetContainer;
class EditorWidgets :
public MyGUI::IUnlinkWidget
{
MYGUI_SINGLETON_DECLARATION(EditorWidgets);
public:
EditorWidgets();
void initialise();
void shutdown();
bool load(const MyGUI::UString& _fileName);
bool save(const MyGUI::UString& _fileName);
void clear();
void loadxmlDocument(MyGUI::xml::Document* doc, bool _testMode = false);
MyGUI::xml::Document* savexmlDocument();
WidgetContainer* find(MyGUI::Widget* _widget);
WidgetContainer* find(const std::string& _name);
void add(WidgetContainer* _container);
void remove(MyGUI::Widget* _widget);
void remove(WidgetContainer* _container);
bool tryToApplyProperty(MyGUI::Widget* _widget, const std::string& _key, const std::string& _value, bool _testMode = false);
void onSetWidgetCoord(MyGUI::Widget* _widget, const MyGUI::IntCoord& _value, const std::string& _owner);
void invalidateWidgets();
EnumeratorWidgetContainer getWidgets();
std::string getSkinReplace(const std::string& _skinName);
const MyGUI::UString& getCurrentFileName() const;
const MyGUI::UString& getCurrentItemName() const;
Event_ChangeWidgets eventChangeWidgets;
Event_ChangeWidgetCoord eventChangeWidgetCoord;
void _unlinkWidget(MyGUI::Widget* _widget) override;
MyGUI::MapString& getCodeGeneratorSettings();
private:
WidgetContainer* _find(MyGUI::Widget* _widget, const std::string& _name, std::vector<WidgetContainer*> _widgets);
void parseWidget(MyGUI::xml::ElementEnumerator& _widget, MyGUI::Widget* _parent, bool _testMode = false);
void serialiseWidget(WidgetContainer* _container, MyGUI::xml::ElementPtr _node, bool _compatibility = false);
void loadIgnoreParameters(MyGUI::xml::ElementPtr _node, const std::string& _file, MyGUI::Version _version);
void loadSkinReplace(MyGUI::xml::ElementPtr _node, const std::string& _file, MyGUI::Version _version);
void notifyFrameStarted(float _time);
void destroyAllWidgets();
bool isSkinExist(const std::string& _skinName);
bool checkTemplate(const std::string& _skinName);
bool loadFromProject(const MyGUI::UString& _fileName, size_t _index);
bool saveToProject(const MyGUI::UString& _fileName, size_t _index);
bool unbind(WidgetContainer* _container);
void loadWidgetsFromXmlNode(MyGUI::xml::ElementPtr _root, bool _testMode = false);
void saveWidgetsToXmlNode(MyGUI::xml::ElementPtr _root, bool _compatibility = false);
void loadCodeGeneratorSettings(MyGUI::xml::ElementPtr _sectorNode);
void saveCodeGeneratorSettings(MyGUI::xml::ElementPtr _rootNode);
private:
bool mWidgetsChanged;
typedef std::vector<std::string> VectorString;
VectorString mIgnoreParameters;
VectorWidgetContainer mWidgets;
MyGUI::MapString mSkinReplaces;
MyGUI::UString mCurrentFileName;
MyGUI::UString mCurrentItemName;
MyGUI::MapString mCodeGeneratorSettings;
};
}
#endif
|