supercell-wx/scwx-qt/source/scwx/qt/manager/hotkey_manager.hpp
2024-04-12 22:59:49 -05:00

43 lines
714 B
C++

#pragma once
#include <scwx/qt/types/hotkey_types.hpp>
#include <memory>
#include <QObject>
class QKeyEvent;
namespace scwx
{
namespace qt
{
namespace manager
{
class HotkeyManager : public QObject
{
Q_OBJECT
Q_DISABLE_COPY_MOVE(HotkeyManager)
public:
explicit HotkeyManager();
~HotkeyManager();
bool HandleKeyPress(QKeyEvent* event);
bool HandleKeyRelease(QKeyEvent* event);
static std::shared_ptr<HotkeyManager> Instance();
signals:
void HotkeyPressed(scwx::qt::types::Hotkey hotkey, bool isAutoRepeat);
void HotkeyReleased(scwx::qt::types::Hotkey hotkey);
private:
class Impl;
std::unique_ptr<Impl> p;
};
} // namespace manager
} // namespace qt
} // namespace scwx