-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgui.cpccCSS.h
76 lines (52 loc) · 1.73 KB
/
gui.cpccCSS.h
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
72
73
74
75
76
/* *****************************************
* File: cpccCss.h
* Version: 1.0
* Purpose: Portable (cross-platform), light-weight library
* CSS like display properties
* *****************************************
* Library: Cross Platform C++ Classes (cpcc)
* Copyright: 2014 StarMessage software.
* License: Free for opensource projects.
* Commercial license for closed source projects.
* Web: http://www.StarMessageSoftware.com/cpcclibrary
* Download: https://github.com/starmessage/cpcc
* email: sales -at- starmessage.info
* *****************************************
*/
#pragma once
#include "cpccColor.h"
#include "cpccUnicodeSupport.h"
template <typename T> class cpccProperty
{
private:
bool m_isNull;
T m_value;
void set(const T &a) { m_value = a; m_isNull=false; }
public:
T get(void) const { return m_value; }
public:
cpccProperty(): m_isNull(true) { }
cpccProperty(const T& aDefault) : m_isNull(true), m_value(aDefault) { }
// convert to T
inline operator T(void) { return get(); }
void operator=(const T &a) { set(a); }
void clear(void) { m_isNull=true; }
bool isNull(void) const { return m_isNull; }
};
class cpccCSS
{
public: // enums
enum TcssTextAlignValue { taNone, taLeft, taRight, taCenter } ;
enum TcssTextStyle { tsNone=0, tsItalic=1, tsBold=2 } ;
public: // constructors
cpccCSS(void) : fontSize(10)
{
}
public: // data
cpccProperty<cpccColor> color, bgColor;
cpccProperty<cpcc_string> fontName;
cpccProperty<float> fontSize;
cpccProperty<TcssTextAlignValue> textAlign;
cpccProperty<int> fontStyle;
public: // functions
};