diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-03 23:46:10 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-03 23:46:10 +0300 |
commit | ba8c196534f110e14e13915b299f9f658b875357 (patch) | |
tree | e855f7f3e6e66a971b29551fdb870f273930e439 /src/gui/widgets | |
parent | be5390833be676363630fcf69e81c838ba52bac2 (diff) | |
download | mv-ba8c196534f110e14e13915b299f9f658b875357.tar.gz mv-ba8c196534f110e14e13915b299f9f658b875357.tar.bz2 mv-ba8c196534f110e14e13915b299f9f658b875357.tar.xz mv-ba8c196534f110e14e13915b299f9f658b875357.zip |
Add sound effects for open/close windows.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/window.cpp | 9 | ||||
-rw-r--r-- | src/gui/widgets/window.h | 4 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 7680600ff..a975f2db1 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -26,6 +26,7 @@ #include "configuration.h" #include "graphicsvertexes.h" #include "logger.h" +#include "sound.h" #include "gui/gui.h" #include "gui/palette.h" @@ -79,6 +80,7 @@ Window::Window(const std::string &caption, const bool modal, mGripPadding(2), mResizeHandles(-1), mRedraw(true), + mPlayVisibleSound(false), mCaptionFont(getFont()) { logger->log("Window::Window(\"%s\")", caption.c_str()); @@ -504,6 +506,8 @@ void Window::setVisible(bool visible, bool forceSticky) gcn::Window::setVisible((!forceSticky && isSticky()) || visible); if (visible) { + if (mPlayVisibleSound) + sound.playGuiSound(SOUND_SHOW_WINDOW); if (gui) { gcn::MouseEvent *event = reinterpret_cast<gcn::MouseEvent*>( @@ -521,6 +525,11 @@ void Window::setVisible(bool visible, bool forceSticky) } } } + else + { + if (mPlayVisibleSound) + sound.playGuiSound(SOUND_HIDE_WINDOW); + } } void Window::scheduleDelete() diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index c8b8fb080..6739b5186 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -405,6 +405,9 @@ class Window : public gcn::Window, private gcn::WidgetListener void setCaptionFont(gcn::Font *font) { mCaptionFont = font; } + void enableVisibleSound(bool b) + { mPlayVisibleSound = b; } + protected: bool canMove() const; @@ -488,6 +491,7 @@ class Window : public gcn::Window, private gcn::WidgetListener int mGripPadding; int mResizeHandles; bool mRedraw; + bool mPlayVisibleSound; gcn::Font *mCaptionFont; }; |