2012-08-10 19:28:34 +00:00
|
|
|
#ifndef _GUITHEME_H_
|
|
|
|
#define _GUITHEME_H_
|
|
|
|
|
|
|
|
#include "../GuiComponent.h"
|
|
|
|
#include "../pugiXML/pugixml.hpp"
|
2012-10-07 22:59:20 +00:00
|
|
|
#include "GuiBox.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.
|
2012-08-10 19:28:34 +00:00
|
|
|
class GuiTheme : public GuiComponent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GuiTheme(std::string path = "");
|
|
|
|
~GuiTheme();
|
|
|
|
|
|
|
|
void readXML(std::string path);
|
|
|
|
|
2012-08-13 18:32:53 +00:00
|
|
|
int getPrimaryColor();
|
|
|
|
int getSecondaryColor();
|
|
|
|
int getSelectorColor();
|
2012-10-01 03:29:55 +00:00
|
|
|
int getSelectedTextColor();
|
2012-08-13 18:32:53 +00:00
|
|
|
int getDescColor();
|
|
|
|
bool getHeaderHidden();
|
|
|
|
bool getDividersHidden();
|
2012-08-14 01:27:39 +00:00
|
|
|
bool getListCentered();
|
2012-09-15 21:24:33 +00:00
|
|
|
|
|
|
|
float getListOffsetX();
|
|
|
|
float getListTextOffsetX();
|
|
|
|
float getGameImageOffsetY();
|
2012-10-07 22:59:20 +00:00
|
|
|
|
|
|
|
GuiBoxData getBoxData();
|
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);
|
|
|
|
float resolveExp(std::string str);
|
2012-08-13 18:32:53 +00:00
|
|
|
int resolveColor(std::string str, int defaultColor = 0x000000);
|
|
|
|
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-08-10 19:28:34 +00:00
|
|
|
|
|
|
|
std::vector<GuiComponent*> mComponentVector;
|
2012-08-11 04:17:52 +00:00
|
|
|
std::string mPath;
|
2012-10-01 03:29:55 +00:00
|
|
|
int mListPrimaryColor, mListSecondaryColor, mListSelectorColor, mListSelectedColor, mDescColor;
|
2012-08-14 01:27:39 +00:00
|
|
|
bool mHideHeader, mHideDividers, mListCentered;
|
2012-09-15 21:24:33 +00:00
|
|
|
|
|
|
|
float mListOffsetX, mGameImageOffsetY, mListTextOffsetX;
|
2012-10-07 22:59:20 +00:00
|
|
|
|
|
|
|
GuiBoxData mBoxData;
|
2012-08-10 19:28:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|