-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPluginInterface.h
More file actions
169 lines (147 loc) · 4.84 KB
/
PluginInterface.h
File metadata and controls
169 lines (147 loc) · 4.84 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/*********************************************************
* TrafficMonitor Plugin Interface
* Copyright (C) by Zhong Yang 2021
* zhongyang219@hotmail.com
**********************************************************/
#pragma once
class IPluginItem
{
public:
virtual const wchar_t* GetItemName() const = 0;
virtual const wchar_t* GetItemId() const = 0;
virtual const wchar_t* GetItemLableText() const = 0;
virtual const wchar_t* GetItemValueText() const = 0;
virtual const wchar_t* GetItemValueSampleText() const = 0;
virtual bool IsCustomDraw() const { return false; }
virtual int GetItemWidth() const { return 0; }
virtual void DrawItem(void* hDC, int x, int y, int w, int h, bool dark_mode) {}
virtual int GetItemWidthEx(void* hDC) const { return 0; }
enum MouseEventType
{
MT_LCLICKED,
MT_RCLICKED,
MT_DBCLICKED,
MT_WHEEL_UP,
MT_WHEEL_DOWN,
};
enum MouseEventFlag
{
MF_TASKBAR_WND = 1 << 0,
};
virtual int OnMouseEvent(MouseEventType type, int x, int y, void* hWnd, int flag) { return 0; }
enum KeyboardEventFlag
{
KF_TASKBAR_WND = 1 << 0,
};
virtual int OnKeboardEvent(int key, bool ctrl, bool shift, bool alt, void* hWnd, int flag) { return 0; }
enum ItemInfoType {};
virtual void* OnItemInfo(ItemInfoType, void* para1, void* para2) { return 0; }
virtual int IsDrawResourceUsageGraph() const { return 0; }
virtual float GetResourceUsageGraphValue() const { return 0.0f; }
};
class ITrafficMonitor;
class ITMPlugin
{
public:
virtual int GetAPIVersion() const { return 7; }
virtual IPluginItem* GetItem(int index) = 0;
virtual void DataRequired() = 0;
enum OptionReturn
{
OR_OPTION_CHANGED,
OR_OPTION_UNCHANGED,
OR_OPTION_NOT_PROVIDED
};
virtual OptionReturn ShowOptionsDialog(void* hParent) { return OR_OPTION_NOT_PROVIDED; }
enum PluginInfoIndex
{
TMI_NAME,
TMI_DESCRIPTION,
TMI_AUTHOR,
TMI_COPYRIGHT,
TMI_VERSION,
TMI_URL,
TMI_MAX
};
virtual const wchar_t* GetInfo(PluginInfoIndex index) = 0;
struct MonitorInfo
{
unsigned long long up_speed{};
unsigned long long down_speed{};
int cpu_usage{};
int memory_usage{};
int gpu_usage{};
int hdd_usage{};
int cpu_temperature{};
int gpu_temperature{};
int hdd_temperature{};
int main_board_temperature{};
int cpu_freq{};
};
virtual void OnMonitorInfo(const MonitorInfo& monitor_info) {}
virtual const wchar_t* GetTooltipInfo() { return L""; }
enum ExtendedInfoIndex
{
EI_LABEL_TEXT_COLOR,
EI_VALUE_TEXT_COLOR,
EI_DRAW_TASKBAR_WND,
EI_NAIN_WND_NET_SPEED_SHORT_MODE,
EI_MAIN_WND_SPERATE_WITH_SPACE,
EI_MAIN_WND_UNIT_BYTE,
EI_MAIN_WND_UNIT_SELECT,
EI_MAIN_WND_NOT_SHOW_UNIT,
EI_MAIN_WND_NOT_SHOW_PERCENT,
EI_TASKBAR_WND_NET_SPEED_SHORT_MODE,
EI_TASKBAR_WND_SPERATE_WITH_SPACE,
EI_TASKBAR_WND_VALUE_RIGHT_ALIGN,
EI_TASKBAR_WND_NET_SPEED_WIDTH,
EI_TASKBAR_WND_UNIT_BYTE,
EI_TASKBAR_WND_UNIT_SELECT,
EI_TASKBAR_WND_NOT_SHOW_UNIT,
EI_TASKBAR_WND_NOT_SHOW_PERCENT,
EI_CONFIG_DIR,
};
virtual void OnExtenedInfo(ExtendedInfoIndex index, const wchar_t* data) {}
virtual void* GetPluginIcon() { return nullptr; }
virtual int GetCommandCount() { return 0; }
virtual const wchar_t* GetCommandName(int command_index) { return nullptr; }
virtual void* GetCommandIcon(int command_index) { return nullptr; }
virtual void OnPluginCommand(int command_index, void* hWnd, void* para) {}
virtual int IsCommandChecked(int command_index) { return false; }
virtual void OnInitialize(ITrafficMonitor* pApp) {}
};
class ITrafficMonitor
{
public:
virtual int GetAPIVersion() = 0;
virtual const wchar_t* GetVersion() = 0;
enum MonitorItem
{
MI_UP,
MI_DOWN,
MI_CPU,
MI_MEMORY,
MI_GPU_USAGE,
MI_CPU_TEMP,
MI_GPU_TEMP,
MI_HDD_TEMP,
MI_MAIN_BOARD_TEMP,
MI_HDD_USAGE,
MI_CPU_FREQ,
MI_TODAY_UP_TRAFFIC,
MI_TODAY_DOWN_TRAFFIC
};
virtual double GetMonitorValue(MonitorItem item) = 0;
virtual const wchar_t* GetMonitorValueString(MonitorItem item, int is_main_window = false) = 0;
virtual void ShowNotifyMessage(const wchar_t* strMsg) = 0;
virtual unsigned short GetLanguageId() const = 0;
virtual const wchar_t* GetPluginConfigDir() const = 0;
enum DPIType
{
DPI_MAIN_WND,
DPI_TASKBAR
};
virtual int GetDPI(DPIType type) const = 0;
virtual unsigned int GetThemeColor() const = 0;
virtual const wchar_t* GetStringRes(const wchar_t* key, const wchar_t* section) = 0;
};