mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
add sound; possibility to click outside to close
This commit is contained in:
parent
8635c24166
commit
52ed824100
@ -14,6 +14,7 @@
|
||||
|
||||
#include "../CGameInfo.h"
|
||||
#include "../CServerHandler.h"
|
||||
#include "../CMusicHandler.h"
|
||||
#include "../gui/CGuiHandler.h"
|
||||
#include "../gui/Shortcut.h"
|
||||
#include "../gui/WindowHandler.h"
|
||||
@ -470,6 +471,7 @@ void OptionsTab::SelectionWindow::apply()
|
||||
if(GH.windows().isTopWindow(this))
|
||||
{
|
||||
GH.input().hapticFeedback();
|
||||
CCS->soundh->playSound(soundBase::button);
|
||||
|
||||
close();
|
||||
|
||||
@ -732,8 +734,19 @@ void OptionsTab::SelectionWindow::setElement(int elem, bool doApply)
|
||||
apply();
|
||||
}
|
||||
|
||||
bool OptionsTab::SelectionWindow::receiveEvent(const Point & position, int eventType) const
|
||||
{
|
||||
return true; // capture click also outside of window
|
||||
}
|
||||
|
||||
void OptionsTab::SelectionWindow::clickReleased(const Point & cursorPosition)
|
||||
{
|
||||
if(!pos.isInside(cursorPosition))
|
||||
{
|
||||
close();
|
||||
return;
|
||||
}
|
||||
|
||||
int elem = getElement(cursorPosition);
|
||||
|
||||
setElement(elem, true);
|
||||
@ -741,6 +754,9 @@ void OptionsTab::SelectionWindow::clickReleased(const Point & cursorPosition)
|
||||
|
||||
void OptionsTab::SelectionWindow::showPopupWindow(const Point & cursorPosition)
|
||||
{
|
||||
if(!pos.isInside(cursorPosition))
|
||||
return;
|
||||
|
||||
int elem = getElement(cursorPosition);
|
||||
|
||||
setElement(elem, false);
|
||||
@ -939,4 +955,4 @@ void OptionsTab::PlayerOptionsEntry::hideUnavailableButtons()
|
||||
buttonBonusLeft->enable();
|
||||
buttonBonusRight->enable();
|
||||
}
|
||||
}
|
||||
}
|
@ -140,6 +140,7 @@ public:
|
||||
int getElement(const Point & cursorPosition);
|
||||
void setElement(int element, bool doApply);
|
||||
|
||||
bool receiveEvent(const Point & position, int eventType) const override;
|
||||
void clickReleased(const Point & cursorPosition) override;
|
||||
void showPopupWindow(const Point & cursorPosition) override;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user