Better VSTGUI compat, new and old versions
This commit is contained in:
parent
8d2c0fa2fb
commit
9bdecbc275
3 changed files with 23 additions and 14 deletions
|
|
@ -223,6 +223,18 @@ CMouseEventResult SAboutDialog::onMouseDown(CPoint& where, const CButtonState& b
|
|||
return result;
|
||||
}
|
||||
|
||||
#if VSTGUI_MORE_THAN_4_10
|
||||
void SAboutDialog::onKeyboardEvent (KeyboardEvent& event, CFrame* frame)
|
||||
{
|
||||
auto vstKeyCode = toVstKeyCode (event);
|
||||
if (event.type == EventType::KeyDown && vstKeyCode.virt == VKEY_ESCAPE)
|
||||
{
|
||||
setVisible(false);
|
||||
frame->unregisterKeyboardHook(this);
|
||||
event.consumed = true;
|
||||
}
|
||||
}
|
||||
#else
|
||||
int32_t SAboutDialog::onKeyDown (const VstKeyCode& keyCode, CFrame* frame)
|
||||
{
|
||||
if (keyCode.virt == VKEY_ESCAPE) {
|
||||
|
|
@ -240,6 +252,7 @@ int32_t SAboutDialog::onKeyUp (const VstKeyCode& keyCode, CFrame* frame)
|
|||
(void)frame;
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
void SAboutDialog::valueChanged(CControl *ctl)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,18 +14,9 @@
|
|||
#define VSTGUI_MORE_THAN_4_10 ((VSTGUI_VERSION_MAJOR > 4) \
|
||||
|| (VSTGUI_VERSION_MAJOR == 4 && VSTGUI_VERSION_MINOR > 10))
|
||||
|
||||
#if VSTGUI_MORE_THAN_4_10
|
||||
#define OVERRIDE override
|
||||
// FIXME: Use KeyboardEvent instead
|
||||
#define IKEYBOARDHOOK OldKeyboardHookAdapter
|
||||
#else
|
||||
#define OVERRIDE
|
||||
#define IKEYBOARDHOOK IKeyboardHook
|
||||
#endif
|
||||
|
||||
using namespace VSTGUI;
|
||||
|
||||
class SAboutDialog : public CViewContainer, public IControlListener, public IKEYBOARDHOOK {
|
||||
class SAboutDialog : public CViewContainer, public IControlListener, public IKeyboardHook {
|
||||
|
||||
enum {
|
||||
kTagButtonSfztools,
|
||||
|
|
@ -40,8 +31,13 @@ public:
|
|||
|
||||
void setPluginFormat(const std::string& pluginFormat);
|
||||
void setPluginHost(const std::string& pluginHost);
|
||||
int32_t onKeyDown(const VstKeyCode& code, CFrame* frame) OVERRIDE;
|
||||
int32_t onKeyUp(const VstKeyCode& code, CFrame* frame) OVERRIDE;
|
||||
|
||||
#if VSTGUI_MORE_THAN_4_10
|
||||
void onKeyboardEvent (KeyboardEvent& event, CFrame* frame) override;
|
||||
#else
|
||||
int32_t onKeyDown(const VstKeyCode& code, CFrame* frame) override;
|
||||
int32_t onKeyUp(const VstKeyCode& code, CFrame* frame) override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
CMouseEventResult onMouseDown(CPoint& where, const CButtonState& buttons) override;
|
||||
|
|
|
|||
|
|
@ -64,13 +64,13 @@ void SFrameDisabler::disable()
|
|||
}
|
||||
|
||||
#if VSTGUI_MORE_THAN_4_10
|
||||
void SFrameDisabler::KeyAndMouseHook::onKeyboardEvent(KeyboardEvent& event, CFrame* frame)
|
||||
void SFrameDisabler::KeyAndMouseHook::onKeyboardEvent(KeyboardEvent& event, CFrame*)
|
||||
{
|
||||
if (!enabled_)
|
||||
event.consumed = true;
|
||||
}
|
||||
|
||||
void SFrameDisabler::KeyAndMouseHook::onMouseEvent(MouseEvent& event, CFrame* frame)
|
||||
void SFrameDisabler::KeyAndMouseHook::onMouseEvent(MouseEvent& event, CFrame*)
|
||||
{
|
||||
if (!enabled_)
|
||||
event.consumed = true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue