forked from rainmeter/rainmeter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMeterString.h
102 lines (84 loc) · 2.18 KB
/
MeterString.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/* Copyright (C) 2001 Rainmeter Project Developers
*
* This Source Code Form is subject to the terms of the GNU General Public
* License; either version 2 of the License, or (at your option) any later
* version. If a copy of the GPL was not distributed with this file, You can
* obtain one at <https://www.gnu.org/licenses/gpl-2.0.html>. */
#ifndef __METERSTRING_H__
#define __METERSTRING_H__
#include "Meter.h"
#include "Measure.h"
class MeterString : public Meter
{
public:
MeterString(Skin* skin, const WCHAR* name);
virtual ~MeterString();
MeterString(const MeterString& other) = delete;
MeterString& operator=(MeterString other) = delete;
virtual UINT GetTypeID() { return TypeID<MeterString>(); }
virtual int GetX(bool abs = false);
virtual int GetY(bool abs = false);
virtual void Initialize();
virtual bool Update();
void SetText(const WCHAR* text) { m_Text = text; }
virtual bool Draw(Gfx::Canvas& canvas);
static void InitializeStatic();
static void FinalizeStatic();
protected:
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
virtual void BindMeasures(ConfigParser& parser, const WCHAR* section);
virtual bool IsFixedSize(bool overwrite = false) { return overwrite; }
private:
enum TEXTSTYLE
{
NORMAL,
BOLD,
ITALIC,
BOLDITALIC
};
enum TEXTEFFECT
{
EFFECT_NONE,
EFFECT_SHADOW,
EFFECT_BORDER
};
enum TEXTCASE
{
TEXTCASE_NONE,
TEXTCASE_UPPER,
TEXTCASE_LOWER,
TEXTCASE_PROPER
};
enum CLIPTYPE
{
CLIP_OFF,
CLIP_ON,
CLIP_AUTO
};
bool DrawString(Gfx::Canvas& canvas, D2D1_RECT_F* rect);
D2D1_COLOR_F m_Color;
D2D1_COLOR_F m_EffectColor;
std::wstring m_Postfix;
std::wstring m_Prefix;
std::wstring m_Text;
std::wstring m_FontFace;
AUTOSCALE m_AutoScale;
TEXTSTYLE m_Style;
TEXTEFFECT m_Effect;
TEXTCASE m_Case;
FLOAT m_FontSize;
double m_Scale;
bool m_NoDecimals;
bool m_Percentual;
CLIPTYPE m_ClipType;
bool m_NeedsClipping;
int m_ClipStringW;
int m_ClipStringH;
Gfx::TextFormat* m_TextFormat;
int m_NumOfDecimals;
FLOAT m_Angle;
int m_FontWeight;
bool m_TrailingSpaces;
std::wstring m_String;
};
#endif