Resize events

This commit is contained in:
yaw-man 2022-08-18 15:55:57 -03:00
parent 4c8cd87421
commit e52b8ef401
2 changed files with 12 additions and 2 deletions

View File

@ -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;

View File

@ -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: