summaryrefslogtreecommitdiff
path: root/xml/skin.h
blob: b29bdbd80efc464dea70ccfd44b33ecc5688128e (plain)
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
/*
 *  $Id: skin.h,v 1.3 2005/01/01 23:44:36 lordjaxom Exp $
 */

#ifndef VDR_TEXT2SKIN_XML_SKIN_H 
#define VDR_TEXT2SKIN_XML_SKIN_H 

#include "xml/display.h"
#include <vdr/osd.h>
#include <expat.h>
#include <map>
#include <string>

// --- cxSkin -----------------------------------------------------------------

class cText2SkinI18n;
class cText2SkinTheme;

class cxSkin {
	friend bool xStartElem(const std::string &name, std::map<std::string,std::string> &attrs);
	friend bool xEndElem(const std::string &name);

	/* Skin Editor */
	friend class VSkinnerView;

public:
	enum eScreenBase {
		relative,
		absolute,
#define __COUNT_BASE__ (absolute + 1)
	};

private:
	eScreenBase      mBase;
	txPoint          mBaseOffset;
	txSize           mBaseSize;
	std::string      mName;
	std::string      mTitle;
	std::string      mVersion;
	
	cxDisplays       mDisplays;
	
	cText2SkinI18n  *mI18n; // TODO: should move here completely
	cText2SkinTheme *mTheme;

public:
	cxSkin(const std::string &Name, cText2SkinI18n *I18n, cText2SkinTheme *Theme);

	cxDisplay *Get(cxDisplay::eType Type);

	bool ParseBase(const std::string &Text);
	void SetBase(eScreenBase Base = (eScreenBase)-1);

	eScreenBase        Base(void)       const { return mBase; }
	const txPoint     &BaseOffset(void) const { return mBaseOffset; }
	const txSize      &BaseSize(void)   const { return mBaseSize; }
	const std::string &Name(void)       const { return mName; }
	const std::string &Title(void)      const { return mTitle; }
	const std::string &Version(void)    const { return mVersion; }

	// functions for object classes to obtain dynamic item information
	std::string        Translate(const std::string &Text);
};

inline cxDisplay *cxSkin::Get(cxDisplay::eType Type) {
	if (mDisplays.find(Type) != mDisplays.end())
		return mDisplays[Type];
	return NULL;
}

#endif // VDR_TEXT2SKIN_XML_SKIN_H