2012-08-10 19:28:34 +00:00
|
|
|
#ifndef _GUITHEME_H_
|
|
|
|
#define _GUITHEME_H_
|
|
|
|
|
2013-04-08 16:52:40 +00:00
|
|
|
#include "../Gui.h"
|
2012-08-10 19:28:34 +00:00
|
|
|
#include "../pugiXML/pugixml.hpp"
|
2012-10-07 22:59:20 +00:00
|
|
|
#include "GuiBox.h"
|
2012-10-13 18:29:53 +00:00
|
|
|
#include "../Sound.h"
|
2012-10-25 17:36:30 +00:00
|
|
|
#include "../Font.h"
|
2012-08-10 19:28:34 +00:00
|
|
|
|
2012-09-07 21:44:07 +00:00
|
|
|
//This class loads an XML-defined list of GuiComponents.
|
2013-04-08 16:52:40 +00:00
|
|
|
class GuiTheme : Gui
|
2012-08-10 19:28:34 +00:00
|
|
|
{
|
|
|
|
public:
|
2013-04-08 16:52:40 +00:00
|
|
|
GuiTheme(Window* window, bool detailed, std::string path = "");
|
2012-08-10 19:28:34 +00:00
|
|
|
~GuiTheme();
|
|
|
|
|
|
|
|
void readXML(std::string path);
|
|
|
|
|
2012-10-07 22:59:20 +00:00
|
|
|
GuiBoxData getBoxData();
|
2012-10-13 18:29:53 +00:00
|
|
|
|
2012-11-17 18:39:49 +00:00
|
|
|
unsigned int getColor(std::string name);
|
|
|
|
bool getBool(std::string name);
|
|
|
|
float getFloat(std::string name);
|
|
|
|
Sound* getSound(std::string name);
|
|
|
|
std::string getString(std::string name);
|
2012-10-31 14:46:06 +00:00
|
|
|
|
|
|
|
Font* getListFont();
|
|
|
|
Font* getDescriptionFont();
|
2013-03-17 17:16:40 +00:00
|
|
|
Font* getFastSelectFont();
|
2012-08-10 19:28:34 +00:00
|
|
|
private:
|
2012-08-14 01:27:39 +00:00
|
|
|
void setDefaults();
|
2012-08-10 19:28:34 +00:00
|
|
|
void deleteComponents();
|
2012-09-15 21:24:33 +00:00
|
|
|
void createComponentChildren(pugi::xml_node node, GuiComponent* parent);
|
2012-08-10 19:28:34 +00:00
|
|
|
GuiComponent* createElement(pugi::xml_node data, GuiComponent* parent);
|
2012-08-13 18:32:53 +00:00
|
|
|
|
|
|
|
//utility functions
|
2012-08-11 04:17:52 +00:00
|
|
|
std::string expandPath(std::string path);
|
2012-10-13 23:37:51 +00:00
|
|
|
float resolveExp(std::string str, float defaultVal = 0.0);
|
2012-10-17 18:21:56 +00:00
|
|
|
unsigned int resolveColor(std::string str, unsigned int defaultColor = 0x000000FF);
|
2012-08-13 18:32:53 +00:00
|
|
|
void splitString(std::string str, char delim, std::string* before, std::string* after);
|
2012-09-15 21:24:33 +00:00
|
|
|
float strToFloat(std::string str, float defaultVal = 0.0f);
|
2012-10-31 14:46:06 +00:00
|
|
|
Font* resolveFont(pugi::xml_node node, std::string defaultPath, unsigned int defaultSize);
|
2012-08-10 19:28:34 +00:00
|
|
|
|
2013-04-08 16:52:40 +00:00
|
|
|
std::vector<Gui*> mComponentVector;
|
2012-08-11 04:17:52 +00:00
|
|
|
std::string mPath;
|
2013-01-06 20:33:50 +00:00
|
|
|
bool mDetailed;
|
2012-10-25 17:36:30 +00:00
|
|
|
|
2012-11-17 18:39:49 +00:00
|
|
|
std::map<std::string, unsigned int> mColorMap;
|
|
|
|
std::map<std::string, bool> mBoolMap;
|
|
|
|
std::map<std::string, float> mFloatMap;
|
|
|
|
std::map<std::string, Sound*> mSoundMap;
|
|
|
|
std::map<std::string, std::string> mStringMap;
|
|
|
|
|
2012-10-07 22:59:20 +00:00
|
|
|
GuiBoxData mBoxData;
|
2012-10-31 14:46:06 +00:00
|
|
|
Font* mListFont;
|
|
|
|
Font* mDescFont;
|
2013-03-17 17:16:40 +00:00
|
|
|
Font* mFastSelectFont;
|
2012-08-10 19:28:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|