From 2a4363ec9c80eafae21835c6c6fe92d7c10678ce Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 6 Apr 2014 12:21:38 +0300 Subject: Add to widgets resize event handler. In this handler set redraw flag. --- src/gui/gui.cpp | 2 ++ src/gui/widgets/widget.cpp | 11 +++++++++++ src/gui/widgets/widget.h | 4 ++++ 3 files changed, 17 insertions(+) (limited to 'src/gui') diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 039fbebfb..4ad1138eb 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -535,6 +535,8 @@ void Gui::videoResized() const top->setSize(mainGraphics->mWidth, mainGraphics->mHeight); top->adjustAfterResize(oldWidth, oldHeight); } + + Widget::distributeWindowResizeEvent(); } void Gui::setUseCustomCursor(const bool customCursor) diff --git a/src/gui/widgets/widget.cpp b/src/gui/widgets/widget.cpp index 5a51a2012..43c8df92f 100644 --- a/src/gui/widgets/widget.cpp +++ b/src/gui/widgets/widget.cpp @@ -351,6 +351,12 @@ void Widget::setFont(Font *const font) fontChanged(); } +void Widget::distributeWindowResizeEvent() +{ + FOR_EACH (std::list::const_iterator, iter, mWidgets) + (*iter)->windowResized(); +} + bool Widget::widgetExists(const Widget* widget) { return mWidgetsSet.find(const_cast(widget)) @@ -506,3 +512,8 @@ void Widget::showPart(const Rect &rectangle) if (mParent) mParent->showWidgetPart(this, rectangle); } + +void Widget::windowResized() +{ + mRedraw = true; +} diff --git a/src/gui/widgets/widget.h b/src/gui/widgets/widget.h index 46245ea2b..f3e2fdb66 100644 --- a/src/gui/widgets/widget.h +++ b/src/gui/widgets/widget.h @@ -1021,6 +1021,10 @@ class Widget : public Widget2 void setRedraw(const bool b) { mRedraw = b; } + static void distributeWindowResizeEvent(); + + void windowResized(); + protected: /** * Distributes an action event to all action listeners -- cgit v1.2.3-70-g09d2