forked from rainmeter/rainmeter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMeasurePlugin.h
78 lines (59 loc) · 2.03 KB
/
MeasurePlugin.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
/* 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 __MEASUREPLUGIN_H__
#define __MEASUREPLUGIN_H__
#include "Measure.h"
#include "Export.h"
typedef UINT (*INITIALIZE)(HMODULE, LPCTSTR, LPCTSTR, UINT);
typedef VOID (*FINALIZE)(HMODULE, UINT);
typedef UINT (*UPDATE)(UINT);
typedef double (*UPDATE2)(UINT);
typedef LPCTSTR (*GETSTRING)(UINT, UINT);
typedef void (*EXECUTEBANG)(LPCWSTR, UINT);
typedef void (*NEWINITIALIZE)(void*, void*);
typedef void (*NEWRELOAD)(void*, void*, double*);
typedef void (*NEWFINALIZE)(void*);
typedef double (*NEWUPDATE)(void*);
typedef LPCWSTR (*NEWGETSTRING)(void*);
typedef void (*NEWEXECUTEBANG)(void*, LPCWSTR);
typedef LPCWSTR(*CUSTOMFUNCTION)(void*, const int, const WCHAR* argv[]);
class MeasurePlugin : public Measure
{
public:
MeasurePlugin(Skin* skin, const WCHAR* name);
virtual ~MeasurePlugin();
MeasurePlugin(const MeasurePlugin& other) = delete;
MeasurePlugin& operator=(MeasurePlugin other) = delete;
virtual UINT GetTypeID() { return TypeID<MeasurePlugin>(); }
virtual const WCHAR* GetStringValue();
virtual void Command(const std::wstring& command);
bool CommandWithReturn(const std::wstring& command, std::wstring& strValue, void* delayedLogEntry = nullptr);
protected:
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
virtual void UpdateValue();
private:
bool IsNewApi() { return m_ReloadFunc != nullptr; }
HMODULE m_Plugin;
void* m_ReloadFunc;
union
{
struct
{
UINT m_ID;
bool m_Update2;
};
struct
{
void* m_PluginData;
};
};
void* m_UpdateFunc;
void* m_GetStringFunc;
void* m_ExecuteBangFunc;
static std::unordered_map<std::wstring, UINT> s_PluginReferences;
};
#endif