forked from m417z/Textify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainDlg.h
75 lines (67 loc) · 2.49 KB
/
MainDlg.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
#pragma once
#include "MouseGlobalHook.h"
#include "UserConfig.h"
class CMainDlg : public CDialogImpl<CMainDlg>
{
public:
enum { IDD = IDD_MAINDLG };
enum
{
UWM_MOUSEHOOKCLICKED = WM_APP,
UWM_NOTIFYICON,
UWM_BRING_TO_FRONT,
UWM_EXIT,
};
enum
{
RCMENU_SHOW = 101,
RCMENU_EXIT,
};
BEGIN_MSG_MAP_EX(CMainDlg)
MSG_WM_INITDIALOG(OnInitDialog)
MSG_WM_DESTROY(OnDestroy)
MSG_WM_WINDOWPOSCHANGING(OnWindowPosChanging)
MSG_WM_NOTIFY(OnNotify)
MSG_WM_HOTKEY(OnHotKey)
COMMAND_ID_HANDLER_EX(IDOK, OnOK)
COMMAND_ID_HANDLER_EX(IDCANCEL, OnCancel)
COMMAND_ID_HANDLER_EX(IDC_SHOW_INI, OnShowIni)
COMMAND_HANDLER_EX(IDC_CHECK_CTRL, BN_CLICKED, OnConfigChanged)
COMMAND_HANDLER_EX(IDC_CHECK_ALT, BN_CLICKED, OnConfigChanged)
COMMAND_HANDLER_EX(IDC_CHECK_SHIFT, BN_CLICKED, OnConfigChanged)
COMMAND_HANDLER_EX(IDC_COMBO_KEYS, CBN_SELCHANGE, OnConfigChanged)
MESSAGE_HANDLER_EX(UWM_MOUSEHOOKCLICKED, OnMouseHookClicked)
MESSAGE_HANDLER_EX(m_uTaskbarCreatedMsg, OnTaskbarCreated)
MESSAGE_HANDLER_EX(m_uTextfiyMsg, OnCustomTextifyMsg)
MESSAGE_HANDLER_EX(UWM_NOTIFYICON, OnNotifyIcon)
MESSAGE_HANDLER_EX(UWM_BRING_TO_FRONT, OnBringToFront)
MESSAGE_HANDLER_EX(UWM_EXIT, OnExit)
END_MSG_MAP()
BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam);
void OnDestroy();
void OnWindowPosChanging(LPWINDOWPOS lpWndPos);
LRESULT OnNotify(int idCtrl, LPNMHDR pnmh);
void OnHotKey(int nHotKeyID, UINT uModifiers, UINT uVirtKey);
void OnOK(UINT uNotifyCode, int nID, CWindow wndCtl);
void OnCancel(UINT uNotifyCode, int nID, CWindow wndCtl);
void OnShowIni(UINT uNotifyCode, int nID, CWindow wndCtl);
void OnConfigChanged(UINT uNotifyCode, int nID, CWindow wndCtl);
LRESULT OnMouseHookClicked(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnTaskbarCreated(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnCustomTextifyMsg(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnNotifyIcon(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnBringToFront(UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnExit(UINT uMsg, WPARAM wParam, LPARAM lParam);
private:
bool RegisterConfiguredHotKey(const HotKey& keybdHotKey);
void InitConfigGui();
void InitNotifyIconData();
void NotifyIconRightClickMenu();
std::unique_ptr<MouseGlobalHook> m_mouseGlobalHook;
UINT m_uTaskbarCreatedMsg = RegisterWindowMessage(L"TaskbarCreated");
UINT m_uTextfiyMsg = RegisterWindowMessage(L"Textify");
NOTIFYICONDATA m_notifyIconData = {};
bool m_hideDialog;
UserConfig m_config;
bool m_registeredHotKey;
};