From f3af5f96c82044769ac2d1194cfa1ea0aca17bf5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 10 Nov 2015 21:58:08 +0300 Subject: Add close button to all shortcuts windows. --- src/gui/widgets/window.cpp | 5 ++++- src/gui/widgets/window.h | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src/gui/widgets') diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index cd8da96bf..471b273be 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -157,7 +157,8 @@ Window::Window(const std::string &caption, mStickyButtonLock(false), mPlayVisibleSound(false), mInit(false), - mTextChanged(true) + mTextChanged(true), + mAllowClose(false) { logger->log("Window::Window(\"%s\")", caption.c_str()); @@ -722,6 +723,8 @@ void Window::widgetHidden(const Event &event A_UNUSED) void Window::setCloseButton(const bool flag) { mCloseWindowButton = flag; + if (flag) + mAllowClose = true; } bool Window::isResizable() const diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index 07ff9bf94..ec0ce8b43 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -181,6 +181,12 @@ class Window notfinal : public BasicContainer2, bool getCloseButton() const A_WARN_UNUSED { return mCloseWindowButton; } + void setAllowClose(const bool b) + { mAllowClose = b; } + + bool getAlowClose() const A_WARN_UNUSED + { return mCloseWindowButton || mAllowClose; } + /** * Returns whether the window can be resized. */ @@ -711,6 +717,7 @@ class Window notfinal : public BasicContainer2, bool mPlayVisibleSound; bool mInit; bool mTextChanged; + bool mAllowClose; }; #endif // GUI_WIDGETS_WINDOW_H -- cgit v1.2.3-70-g09d2