2013-06-02 15:08:32 +00:00
|
|
|
#ifndef _THEMECOMPONENT_H_
|
|
|
|
#define _THEMECOMPONENT_H_
|
2012-08-10 19:28:34 +00:00
|
|
|
|
2013-05-14 19:31:39 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2013-06-02 15:08:32 +00:00
|
|
|
#include "../GuiComponent.h"
|
2012-08-10 19:28:34 +00:00
|
|
|
#include "../pugiXML/pugixml.hpp"
|
2012-10-07 22:59:20 +00:00
|
|
|
#include "GuiBox.h"
|
2013-05-14 19:31:39 +00:00
|
|
|
#include "../AudioManager.h"
|
2012-10-25 17:36:30 +00:00
|
|
|
#include "../Font.h"
|
2012-08-10 19:28:34 +00:00
|
|
|
|
2013-04-08 17:40:15 +00:00
|
|
|
//This class loads an XML-defined list of Guis.
|
2013-06-02 15:08:32 +00:00
|
|
|
class ThemeComponent : public GuiComponent
|
2012-08-10 19:28:34 +00:00
|
|
|
{
|
|
|
|
public:
|
2013-06-02 15:08:32 +00:00
|
|
|
ThemeComponent(Window* window, bool detailed, std::string path = "");
|
|
|
|
virtual ~ThemeComponent();
|
2012-08-10 19:28:34 +00:00
|
|
|
|
|
|
|
void readXML(std::string path);
|
|
|
|
|
2012-10-07 22:59:20 +00:00
|
|
|
GuiBoxData getBoxData();
|
2012-10-13 18:29:53 +00:00
|
|
|
|
2013-04-10 17:29:07 +00:00
|
|
|
void init();
|
|
|
|
void deinit();
|
|
|
|
|
2012-11-17 18:39:49 +00:00
|
|
|
unsigned int getColor(std::string name);
|
|
|
|
bool getBool(std::string name);
|
|
|
|
float getFloat(std::string name);
|
2013-05-14 19:31:39 +00:00
|
|
|
std::shared_ptr<Sound> & getSound(std::string name);
|
2012-11-17 18:39:49 +00:00
|
|
|
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();
|
2013-06-02 15:08:32 +00:00
|
|
|
|
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();
|
2013-06-02 15:08:32 +00:00
|
|
|
void createComponentChildren(pugi::xml_node node, GuiComponent* parent);
|
|
|
|
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
|
|
|
|
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;
|
2013-05-14 19:31:39 +00:00
|
|
|
std::map<std::string, std::shared_ptr<Sound>> mSoundMap;
|
2012-11-17 18:39:49 +00:00
|
|
|
std::map<std::string, std::string> mStringMap;
|
|
|
|
|
2012-10-07 22:59:20 +00:00
|
|
|
GuiBoxData mBoxData;
|
2013-06-02 15:08:32 +00:00
|
|
|
|
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
|