forked from rainmeter/rainmeter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommandHandler.h
162 lines (151 loc) · 4.24 KB
/
CommandHandler.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
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
/* Copyright (C) 2013 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 RM_LIBRARY_COMMANDHANDLER_H_
#define RM_LIBRARY_COMMANDHANDLER_H_
#include <Windows.h>
#include <string>
#include <vector>
class ConfigParser;
class Skin;
enum class Bang
{
Refresh,
RefreshApp,
Redraw,
Update,
Hide,
Show,
Toggle,
HideFade,
ShowFade,
ToggleFade,
HideMeter,
ShowMeter,
ToggleMeter,
MoveMeter,
UpdateMeter,
DisableMouseAction,
ClearMouseAction,
EnableMouseAction,
ToggleMouseAction,
DisableMeasure,
EnableMeasure,
ToggleMeasure,
PauseMeasure,
UnpauseMeasure,
TogglePauseMeasure,
UpdateMeasure,
CommandMeasure,
PluginBang,
ShowBlur,
HideBlur,
ToggleBlur,
AddBlur,
RemoveBlur,
ActivateConfig,
DeactivateConfig,
ToggleConfig,
Move,
SetWindowPosition,
SetAnchor,
ZPos,
ChangeZPos,
ClickThrough,
Draggable,
SnapEdges,
FadeDuration,
KeepOnScreen,
AutoSelectScreen,
SetTransparency,
SetVariable,
SetOption,
RefreshGroup,
UpdateGroup,
RedrawGroup,
HideGroup,
ShowGroup,
ToggleGroup,
HideFadeGroup,
ShowFadeGroup,
ToggleFadeGroup,
HideMeterGroup,
ShowMeterGroup,
ToggleMeterGroup,
UpdateMeterGroup,
DisableMouseActionGroup,
ClearMouseActionGroup,
EnableMouseActionGroup,
ToggleMouseActionGroup,
DisableMouseActionSkinGroup,
ClearMouseActionSkinGroup,
EnableMouseActionSkinGroup,
ToggleMouseActionSkinGroup,
DisableMeasureGroup,
EnableMeasureGroup,
ToggleMeasureGroup,
PauseMeasureGroup,
UnpauseMeasureGroup,
TogglePauseMeasureGroup,
UpdateMeasureGroup,
DeactivateConfigGroup,
ZPosGroup,
ClickThroughGroup,
DraggableGroup,
SnapEdgesGroup,
SetFadeDurationGroup,
KeepOnScreenGroup,
AutoSelectScreenGroup,
SetTransparencyGroup,
SetVariableGroup,
SetOptionGroup,
WriteKeyValue,
LoadLayout,
SetClip,
SetWallpaper,
About,
Manage,
SkinMenu,
SkinCustomMenu,
TrayMenu,
ResetStats,
Log,
Quit,
EditSkin,
LsBoxHook
};
// Parses and executes commands and bangs.
class CommandHandler
{
public:
void ExecuteCommand(const WCHAR* command, Skin* skin, bool multi = true);
void ExecuteBang(const WCHAR* name, std::vector<std::wstring>& args, Skin* skin);
static void RunCommand(std::wstring command);
static void RunFile(const WCHAR* file, const WCHAR* args = nullptr);
static std::vector<std::wstring> ParseString(const WCHAR* str, ConfigParser* parser = nullptr);
static void DoActivateSkinBang(std::vector<std::wstring>& args, Skin* skin);
static void DoDeactivateSkinBang(std::vector<std::wstring>& args, Skin* skin);
static void DoToggleSkinBang(std::vector<std::wstring>& args, Skin* skin);
static void DoDeactivateSkinGroupBang(std::vector<std::wstring>& args, Skin* skin);
static void DoLoadLayoutBang(std::vector<std::wstring>& args, Skin* skin);
static void DoSetClipBang(std::vector<std::wstring>& args, Skin* skin);
static void DoSetWallpaperBang(std::vector<std::wstring>& args, Skin* skin);
static void DoAboutBang(std::vector<std::wstring>& args, Skin* skin);
static void DoManageBang(std::vector<std::wstring>& args, Skin* skin);
static void DoSkinMenuBang(std::vector<std::wstring>& args, Skin* skin);
static void DoTrayMenuBang(std::vector<std::wstring>& args, Skin* skin);
static void DoResetStatsBang(std::vector<std::wstring>& args, Skin* skin);
static void DoWriteKeyValueBang(std::vector<std::wstring>& args, Skin* skin);
static void DoLogBang(std::vector<std::wstring>& args, Skin* skin);
static void DoRefreshApp(std::vector<std::wstring>& args, Skin* skin);
static void DoQuitBang(std::vector<std::wstring>& args, Skin* skin);
static void DoEditSkinBang(std::vector<std::wstring>& args, Skin* skin);
static void DoSetWindowPositionBang(std::vector<std::wstring>& args, Skin* skin);
static void DoLsBoxHookBang(std::vector<std::wstring>& args, Skin* skin);
private:
static void Internal_DoActivateBang(std::vector<std::wstring>& args, Skin* skin, LPCWSTR bangName);
};
#endif