2019-09-05 00:26:26 +08:00
|
|
|
#pragma once
|
|
|
|
#include <interface/powertoy_module_interface.h>
|
|
|
|
#include "overlay_window.h"
|
|
|
|
|
2019-12-17 16:21:46 +08:00
|
|
|
#include "resource.h"
|
|
|
|
|
2020-07-31 19:06:13 +08:00
|
|
|
#include <common/LowlevelKeyboardEvent.h>
|
|
|
|
|
2019-09-05 00:26:26 +08:00
|
|
|
// We support only one instance of the overlay
|
|
|
|
extern class OverlayWindow* instance;
|
|
|
|
|
|
|
|
class TargetState;
|
|
|
|
|
2019-12-06 19:07:54 +08:00
|
|
|
class OverlayWindow : public PowertoyModuleIface
|
|
|
|
{
|
2019-09-05 00:26:26 +08:00
|
|
|
public:
|
2019-12-06 19:07:54 +08:00
|
|
|
OverlayWindow();
|
2020-07-01 17:37:50 +08:00
|
|
|
|
2019-12-06 19:07:54 +08:00
|
|
|
virtual const wchar_t* get_name() override;
|
|
|
|
virtual bool get_config(wchar_t* buffer, int* buffer_size) override;
|
2019-09-05 00:26:26 +08:00
|
|
|
|
2019-12-06 19:07:54 +08:00
|
|
|
virtual void set_config(const wchar_t* config) override;
|
|
|
|
virtual void enable() override;
|
|
|
|
virtual void disable() override;
|
|
|
|
virtual bool is_enabled() override;
|
2020-04-30 17:05:18 +08:00
|
|
|
|
2019-12-06 19:07:54 +08:00
|
|
|
void on_held();
|
|
|
|
void on_held_press(DWORD vkCode);
|
|
|
|
void quick_hide();
|
|
|
|
void was_hidden();
|
2019-09-05 00:26:26 +08:00
|
|
|
|
2020-04-30 17:05:18 +08:00
|
|
|
intptr_t signal_event(LowlevelKeyboardEvent* event);
|
|
|
|
|
2019-12-06 19:07:54 +08:00
|
|
|
virtual void destroy() override;
|
2019-10-22 14:11:23 +08:00
|
|
|
|
2020-07-01 17:37:50 +08:00
|
|
|
bool overlay_visible() const;
|
|
|
|
|
2019-09-05 00:26:26 +08:00
|
|
|
private:
|
2020-01-23 01:43:49 +08:00
|
|
|
std::wstring app_name;
|
2019-12-06 19:07:54 +08:00
|
|
|
std::unique_ptr<TargetState> target_state;
|
|
|
|
std::unique_ptr<D2DOverlayWindow> winkey_popup;
|
|
|
|
bool _enabled = false;
|
2020-04-30 17:05:18 +08:00
|
|
|
HHOOK hook_handle;
|
2019-09-05 00:26:26 +08:00
|
|
|
|
2019-12-06 19:07:54 +08:00
|
|
|
void init_settings();
|
|
|
|
void disable(bool trace_event);
|
2019-09-05 00:26:26 +08:00
|
|
|
|
2019-12-06 19:07:54 +08:00
|
|
|
struct PressTime
|
|
|
|
{
|
|
|
|
PCWSTR name = L"press_time";
|
|
|
|
int value = 900; // ms
|
|
|
|
int resourceId = IDS_SETTING_DESCRIPTION_PRESS_TIME;
|
|
|
|
} pressTime;
|
2019-09-05 00:26:26 +08:00
|
|
|
|
2019-12-06 19:07:54 +08:00
|
|
|
struct OverlayOpacity
|
|
|
|
{
|
|
|
|
PCWSTR name = L"overlay_opacity";
|
|
|
|
int value = 90; // percent
|
|
|
|
int resourceId = IDS_SETTING_DESCRIPTION_OVERLAY_OPACITY;
|
|
|
|
} overlayOpacity;
|
2019-10-02 23:07:12 +08:00
|
|
|
|
2019-12-06 19:07:54 +08:00
|
|
|
struct Theme
|
|
|
|
{
|
|
|
|
PCWSTR name = L"theme";
|
|
|
|
std::wstring value = L"system";
|
|
|
|
int resourceId = IDS_SETTING_DESCRIPTION_THEME;
|
|
|
|
std::vector<std::pair<std::wstring, UINT>> keys_and_texts = {
|
|
|
|
{ L"system", IDS_SETTING_DESCRIPTION_THEME_SYSTEM },
|
|
|
|
{ L"light", IDS_SETTING_DESCRIPTION_THEME_LIGHT },
|
|
|
|
{ L"dark", IDS_SETTING_DESCRIPTION_THEME_DARK }
|
|
|
|
};
|
|
|
|
} theme;
|
2019-09-05 00:26:26 +08:00
|
|
|
};
|