mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-14 10:12:59 +02:00
notFocusedClick refactoring
This commit is contained in:
parent
e45be3c5e6
commit
ca037aae33
@ -765,9 +765,9 @@ void OptionsTab::SelectionWindow::sliderMove(int slidPos)
|
|||||||
redraw();
|
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)
|
void OptionsTab::SelectionWindow::clickReleased(const Point & cursorPosition)
|
||||||
@ -775,12 +775,6 @@ void OptionsTab::SelectionWindow::clickReleased(const Point & cursorPosition)
|
|||||||
if(slider && slider->pos.isInside(cursorPosition))
|
if(slider && slider->pos.isInside(cursorPosition))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!pos.isInside(cursorPosition))
|
|
||||||
{
|
|
||||||
close();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int elem = getElement(cursorPosition);
|
int elem = getElement(cursorPosition);
|
||||||
|
|
||||||
setElement(elem, true);
|
setElement(elem, true);
|
||||||
@ -898,14 +892,8 @@ OptionsTab::HandicapWindow::HandicapWindow()
|
|||||||
center();
|
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();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,8 +63,7 @@ public:
|
|||||||
std::map<PlayerColor, std::map<EGameResID, std::shared_ptr<CTextInput>>> textinputs;
|
std::map<PlayerColor, std::map<EGameResID, std::shared_ptr<CTextInput>>> textinputs;
|
||||||
std::vector<std::shared_ptr<CButton>> buttons;
|
std::vector<std::shared_ptr<CButton>> buttons;
|
||||||
|
|
||||||
bool receiveEvent(const Point & position, int eventType) const override;
|
void notFocusedClick() override;
|
||||||
void clickReleased(const Point & cursorPosition) override;
|
|
||||||
public:
|
public:
|
||||||
HandicapWindow();
|
HandicapWindow();
|
||||||
};
|
};
|
||||||
@ -167,7 +166,7 @@ private:
|
|||||||
|
|
||||||
void sliderMove(int slidPos);
|
void sliderMove(int slidPos);
|
||||||
|
|
||||||
bool receiveEvent(const Point & position, int eventType) const override;
|
void notFocusedClick() override;
|
||||||
void clickReleased(const Point & cursorPosition) override;
|
void clickReleased(const Point & cursorPosition) override;
|
||||||
void showPopupWindow(const Point & cursorPosition) override;
|
void showPopupWindow(const Point & cursorPosition) override;
|
||||||
|
|
||||||
|
@ -1703,7 +1703,7 @@ void VideoWindow::keyPressed(EShortcut key)
|
|||||||
exit(true);
|
exit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VideoWindow::receiveEvent(const Point & position, int eventType) const
|
void VideoWindow::notFocusedClick()
|
||||||
{
|
{
|
||||||
return true; // capture click also outside of window
|
exit(true);
|
||||||
}
|
}
|
||||||
|
@ -523,5 +523,5 @@ public:
|
|||||||
|
|
||||||
void clickPressed(const Point & cursorPosition) override;
|
void clickPressed(const Point & cursorPosition) override;
|
||||||
void keyPressed(EShortcut key) override;
|
void keyPressed(EShortcut key) override;
|
||||||
bool receiveEvent(const Point & position, int eventType) const override;
|
void notFocusedClick() override;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user