summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-11-10 21:58:08 +0300
committerAndrei Karas <akaras@inbox.ru>2015-11-10 21:58:08 +0300
commitf3af5f96c82044769ac2d1194cfa1ea0aca17bf5 (patch)
tree6722a88198292e82e0f00bf24a71bee3be6c120d
parentcb6f070779f94f3d69ba7576affb0588b61e7b7c (diff)
downloadmanaplus-f3af5f96c82044769ac2d1194cfa1ea0aca17bf5.tar.gz
manaplus-f3af5f96c82044769ac2d1194cfa1ea0aca17bf5.tar.bz2
manaplus-f3af5f96c82044769ac2d1194cfa1ea0aca17bf5.tar.xz
manaplus-f3af5f96c82044769ac2d1194cfa1ea0aca17bf5.zip
Add close button to all shortcuts windows.
-rw-r--r--src/gui/popups/popupmenu.cpp2
-rw-r--r--src/gui/widgets/window.cpp5
-rw-r--r--src/gui/widgets/window.h7
-rw-r--r--src/gui/windows/shortcutwindow.cpp2
4 files changed, 14 insertions, 2 deletions
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index d9d3999c1..d183dcdca 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -983,7 +983,7 @@ void PopupMenu::addWindowMenu(Window *const window)
if (!window)
return;
- if (window->getCloseButton())
+ if (window->getAlowClose())
{
// TRANSLATORS: popup menu item
// TRANSLATORS: close window
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
diff --git a/src/gui/windows/shortcutwindow.cpp b/src/gui/windows/shortcutwindow.cpp
index df9aced4c..f463b5526 100644
--- a/src/gui/windows/shortcutwindow.cpp
+++ b/src/gui/windows/shortcutwindow.cpp
@@ -64,6 +64,7 @@ ShortcutWindow::ShortcutWindow(const std::string &restrict title,
setResizable(true);
setDefaultVisible(false);
setSaveVisible(true);
+ setAllowClose(true);
mDragOffsetX = 0;
mDragOffsetY = 0;
@@ -123,6 +124,7 @@ ShortcutWindow::ShortcutWindow(const std::string &restrict title,
setResizable(true);
setDefaultVisible(false);
setSaveVisible(true);
+ setAllowClose(true);
mDragOffsetX = 0;
mDragOffsetY = 0;