From e52b8ef401c2af2e81435a3a24eb0324aed42b74 Mon Sep 17 00:00:00 2001 From: yaw-man Date: Thu, 18 Aug 2022 15:55:57 -0300 Subject: [PATCH] Resize events --- src/yaw-tab/ui.cpp | 13 +++++++++++-- src/yaw-tab/ui.h | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/yaw-tab/ui.cpp b/src/yaw-tab/ui.cpp index 33d03ea..aaf280e 100644 --- a/src/yaw-tab/ui.cpp +++ b/src/yaw-tab/ui.cpp @@ -50,8 +50,8 @@ static constexpr uint kInitialHeight = 600; TabUI::TabUI() : UI(kInitialWidth, kInitialHeight), tab(getWindow().getNativeWindowHandle()), - AButtonWidget(this, 75.f, 700.f, 500.f, kParameterButtonA, this), - BButtonWidget(this, 75.f, 700.f, 400.f, kParameterButtonB, this) + AButtonWidget(this, 75.f, kInitialWidth - 100, kInitialHeight - 100, kParameterButtonA, this), + BButtonWidget(this, 75.f, kInitialWidth - 100, kInitialHeight - 200, kParameterButtonB, this) { #ifdef DGL_NO_SHARED_RESOURCES @@ -141,6 +141,15 @@ bool TabUI::onMouse(const MouseEvent &ev) return false; // Allow event to propagate. } +void TabUI::onResize(const ResizeEvent &ev) +{ + float x = ev.size.getWidth(); + float y = ev.size.getHeight(); + AButtonWidget.setAbsolutePos(x - 100, y - 100); + BButtonWidget.setAbsolutePos(x - 100, y - 200); + return UI::onResize(ev); +} + bool TabUI::onScroll(const ScrollEvent &ev) { double add; diff --git a/src/yaw-tab/ui.h b/src/yaw-tab/ui.h index cd57634..f532fb1 100644 --- a/src/yaw-tab/ui.h +++ b/src/yaw-tab/ui.h @@ -46,6 +46,7 @@ public: void uiIdle() override; bool onMouse(const MouseEvent &ev) override; bool onScroll(const ScrollEvent &ev) override; + void onResize(const ResizeEvent &ev) override; void onNanoDisplay() override; private: