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-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.
|
2012-08-10 19:28:34 +00:00
|
|
|
class GuiTheme : public GuiComponent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GuiTheme(std::string path = "");
|
|
|
|
~GuiTheme();
|
|
|
|
|
|
|
|
void readXML(std::string path);
|
|
|
|
|
2012-10-17 18:21:56 +00:00
|
|
|
unsigned int getPrimaryColor();
|
|
|
|
unsigned int getSecondaryColor();
|
|
|
|
unsigned int getSelectorColor();
|
|
|
|
unsigned int getSelectedTextColor();
|
|
|
|
unsigned int getDescColor();
|
|
|
|
unsigned int getFastSelectColor();
|
2012-08-13 18:32:53 +00:00
|
|
|
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();
|
2012-10-13 23:37:51 +00:00
|
|
|
|
|
|
|
float getGameImageOffsetX();
|
2012-09-15 21:24:33 +00:00
|
|
|
float getGameImageOffsetY();
|
2012-10-13 23:37:51 +00:00
|
|
|
float getGameImageWidth();
|
|
|
|
float getGameImageHeight();
|
|
|
|
float getGameImageOriginX();
|
|
|
|
float getGameImageOriginY();
|
2012-10-07 22:59:20 +00:00
|
|
|
|
|
|
|
GuiBoxData getBoxData();
|
2012-10-13 18:29:53 +00:00
|
|
|
|
|
|
|
Sound* getMenuScrollSound();
|
2012-10-13 20:05:43 +00:00
|
|
|
Sound* getMenuSelectSound();
|
|
|
|
Sound* getMenuBackSound();
|
|
|
|
Sound* getMenuOpenSound();
|
2012-10-25 17:36:30 +00:00
|
|
|
|
|
|
|
std::string getImageNotFoundPath();
|
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-25 17:36:30 +00:00
|
|
|
Font* resolveFont(pugi::xml_node node, Font* def);
|
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-25 17:36:30 +00:00
|
|
|
|
2012-10-17 18:21:56 +00:00
|
|
|
unsigned int mListPrimaryColor, mListSecondaryColor, mListSelectorColor, mListSelectedColor, mDescColor, mFastSelectColor;
|
2012-08-14 01:27:39 +00:00
|
|
|
bool mHideHeader, mHideDividers, mListCentered;
|
2012-10-13 23:37:51 +00:00
|
|
|
float mListOffsetX, mListTextOffsetX, mGameImageOffsetX, mGameImageOffsetY, mGameImageWidth, mGameImageHeight, mGameImageOriginX, mGameImageOriginY;
|
2012-10-07 22:59:20 +00:00
|
|
|
GuiBoxData mBoxData;
|
2012-10-13 20:05:43 +00:00
|
|
|
Sound mMenuScrollSound, mMenuSelectSound, mMenuBackSound, mMenuOpenSound;
|
2012-10-25 17:36:30 +00:00
|
|
|
std::string mImageNotFoundPath;
|
2012-08-10 19:28:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|