MACGUI: Add methods to find top window at at a given point

This commit is contained in:
DivyamAhuja 2021-07-07 13:38:55 +05:30 committed by Eugene Sandulenko
parent d754ed0e27
commit bf46669cf8
2 changed files with 38 additions and 0 deletions

View File

@ -691,6 +691,32 @@ void MacWindowManager::setActiveWindow(int id) {
_fullRefresh = true;
}
MacWindow* MacWindowManager::findWindowAtPoint(int16 x, int16 y) {
Common::List<Graphics::BaseMacWindow *>::iterator it;
Graphics::MacWindow* win = nullptr;
for (it = _windowStack.begin(); it != _windowStack.end(); it++) {
if ((*it)->getDimensions().contains(x, y)) {
win = reinterpret_cast<Graphics::MacWindow *> (*it);
}
}
return win;
}
MacWindow* MacWindowManager::findWindowAtPoint(Common::Point point) {
Common::List<Graphics::BaseMacWindow *>::iterator it;
Graphics::MacWindow* win = nullptr;
for (it = _windowStack.begin(); it != _windowStack.end(); it++) {
if ((*it)->getDimensions().contains(point)) {
win = reinterpret_cast<Graphics::MacWindow *> (*it);
}
}
return win;
}
void MacWindowManager::removeWindow(MacWindow *target) {
_windowsToRemove.push_back(target);
_needsRemoval = true;

View File

@ -223,6 +223,18 @@ public:
*/
void setActiveWindow(int id);
/**
* Return Top Window containing a point
* @param x x coordinate of point
* @param y y coordiante of point
*/
MacWindow* findWindowAtPoint(int16 x, int16 y);
/**
* Return Top Window containing a point
* @param point Point
*/
MacWindow* findWindowAtPoint(Common::Point point);
/**
* Mark a window for removal.
* Note that the window data will be destroyed.