diff options
-rw-r--r-- | src/gui/widgets/button.cpp | 19 | ||||
-rw-r--r-- | src/gui/widgets/button.h | 4 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 446f4756f..e6f5b501d 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -367,6 +367,9 @@ void Button::init() Button::~Button() { + if (mWindow) + mWindow->removeWidgetListener(this); + if (gui) gui->removeDragged(this); @@ -679,6 +682,15 @@ void Button::widgetMoved(const Event &event A_UNUSED) mRedraw = true; } +void Button::widgetHidden(const Event &event A_UNUSED) +{ + if (isBatchDrawRenders(openGLMode)) + mVertexes2->clear(); + mTextChunk.deleteImage(); + mRedraw = true; + mTextChanged = true; +} + void Button::adjustSize() { const Font *const font = getFont(); @@ -774,3 +786,10 @@ void Button::mouseDragged(MouseEvent& event) { event.consume(); } + +void Button::setParent(Widget *widget) +{ + if (mWindow) + mWindow->addWidgetListener(this); + Widget::setParent(widget); +} diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h index 153195454..d8c5e66b8 100644 --- a/src/gui/widgets/button.h +++ b/src/gui/widgets/button.h @@ -185,6 +185,8 @@ class Button final : public Widget, void widgetMoved(const Event &event) override final; + void widgetHidden(const Event &event) override final; + void loadImage(const std::string &imageName); void loadImageSet(const std::string &imageName); @@ -245,6 +247,8 @@ class Button final : public Widget, void mouseDragged(MouseEvent& event) override final; + void setParent(Widget *widget) override final; + enum { BUTTON_STANDARD = 0, // 0 |