20 #include <vstgui4/vstgui/lib/cframe.h> 75 fOnKeyDownCallback = std::move(iOnKeyDownCallback);
76 return std::dynamic_pointer_cast<GlobalKeyboardHook>(shared_from_this());
88 fOnKeyUpCallback = std::move(iOnKeyUpCallback);
89 return std::dynamic_pointer_cast<GlobalKeyboardHook>(shared_from_this());
99 static std::shared_ptr<GlobalKeyboardHook>
create(CView *iView)
101 return SelfContainedViewListener::create<GlobalKeyboardHook>(iView);
109 std::shared_ptr<SelfContainedViewListener>
registerView(CView *iView)
override 112 maybeRegisterKeyboardHook();
122 DCHECK_F(iView == fView);
123 maybeRegisterKeyboardHook();
131 DCHECK_F(iView == fView);
132 maybeUnregisterKeyboardHook();
142 maybeUnregisterKeyboardHook();
156 fFrame = fView->getFrame();
159 fFrame->registerKeyboardHook(
this);
169 fFrame->unregisterKeyboardHook(
this);
177 int32_t
onKeyDown(
const VstKeyCode &iCode, CFrame *frame)
override 185 int32_t
onKeyUp(
const VstKeyCode &iCode, CFrame *frame)
override
void viewRemoved(CView *iView) override
Definition: GlobalKeyboardHook.h:129
virtual void unregister()
Definition: SelfContainedViewListener.h:109
std::shared_ptr< SelfContainedViewListener > registerView(CView *iView) override
Definition: GlobalKeyboardHook.h:109
int32_t onKeyDown(const VstKeyCode &iCode, CFrame *frame) override
Definition: GlobalKeyboardHook.h:177
void maybeUnregisterKeyboardHook()
Definition: GlobalKeyboardHook.h:165
std::shared_ptr< GlobalKeyboardHook > onKeyUp(KeyboardEventCallback iOnKeyUpCallback)
Definition: GlobalKeyboardHook.h:86
static std::shared_ptr< GlobalKeyboardHook > create(CView *iView)
Definition: GlobalKeyboardHook.h:99
std::function< CKeyboardEventResult(VstKeyCode const &)> KeyboardEventCallback
Definition: Types.h:68
int32_t onKeyUp(const VstKeyCode &iCode, CFrame *frame) override
Definition: GlobalKeyboardHook.h:185
void maybeRegisterKeyboardHook()
Definition: GlobalKeyboardHook.h:152
Definition: SelfContainedViewListener.h:83
Definition: GlobalKeyboardHook.h:63
std::shared_ptr< GlobalKeyboardHook > onKeyDown(KeyboardEventCallback iOnKeyDownCallback)
Definition: GlobalKeyboardHook.h:73
virtual std::shared_ptr< SelfContainedViewListener > registerView(CView *iView)
Definition: SelfContainedViewListener.h:129
std::shared_ptr< GlobalKeyboardHook > registerGlobalKeyboardHook(CView *iView)
Definition: GlobalKeyboardHook.h:203
void unregister() override
Definition: GlobalKeyboardHook.h:140
void viewAttached(CView *iView) override
Definition: GlobalKeyboardHook.h:120