1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-12 10:03:53 +02:00

notFocusedClick refactoring

This commit is contained in:
Laserlicht 2024-11-03 01:13:14 +01:00
parent e45be3c5e6
commit ca037aae33
4 changed files with 9 additions and 22 deletions

View File

@ -765,9 +765,9 @@ void OptionsTab::SelectionWindow::sliderMove(int slidPos)
redraw();
}
bool OptionsTab::SelectionWindow::receiveEvent(const Point & position, int eventType) const
void OptionsTab::SelectionWindow::notFocusedClick()
{
return true; // capture click also outside of window
close();
}
void OptionsTab::SelectionWindow::clickReleased(const Point & cursorPosition)
@ -775,12 +775,6 @@ void OptionsTab::SelectionWindow::clickReleased(const Point & cursorPosition)
if(slider && slider->pos.isInside(cursorPosition))
return;
if(!pos.isInside(cursorPosition))
{
close();
return;
}
int elem = getElement(cursorPosition);
setElement(elem, true);
@ -898,14 +892,8 @@ OptionsTab::HandicapWindow::HandicapWindow()
center();
}
bool OptionsTab::HandicapWindow::receiveEvent(const Point & position, int eventType) const
void OptionsTab::HandicapWindow::notFocusedClick()
{
return true; // capture click also outside of window
}
void OptionsTab::HandicapWindow::clickReleased(const Point & cursorPosition)
{
if(!pos.isInside(cursorPosition)) // make it possible to close window by touching/clicking outside of window
close();
}

View File

@ -63,8 +63,7 @@ public:
std::map<PlayerColor, std::map<EGameResID, std::shared_ptr<CTextInput>>> textinputs;
std::vector<std::shared_ptr<CButton>> buttons;
bool receiveEvent(const Point & position, int eventType) const override;
void clickReleased(const Point & cursorPosition) override;
void notFocusedClick() override;
public:
HandicapWindow();
};
@ -167,7 +166,7 @@ private:
void sliderMove(int slidPos);
bool receiveEvent(const Point & position, int eventType) const override;
void notFocusedClick() override;
void clickReleased(const Point & cursorPosition) override;
void showPopupWindow(const Point & cursorPosition) override;

View File

@ -1703,7 +1703,7 @@ void VideoWindow::keyPressed(EShortcut key)
exit(true);
}
bool VideoWindow::receiveEvent(const Point & position, int eventType) const
void VideoWindow::notFocusedClick()
{
return true; // capture click also outside of window
exit(true);
}

View File

@ -523,5 +523,5 @@ public:
void clickPressed(const Point & cursorPosition) override;
void keyPressed(EShortcut key) override;
bool receiveEvent(const Point & position, int eventType) const override;
void notFocusedClick() override;
};