mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:07:36 +00:00
WindowServer: Add modeless_ancestor() helper
This commit is contained in:
parent
ab517aa21d
commit
609391b46e
2 changed files with 12 additions and 0 deletions
|
@ -989,6 +989,17 @@ void Window::set_parent_window(Window& parent_window)
|
||||||
parent_window.add_child_window(*this);
|
parent_window.add_child_window(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Window* Window::modeless_ancestor()
|
||||||
|
{
|
||||||
|
if (!is_modal())
|
||||||
|
return this;
|
||||||
|
for (auto parent = m_parent_window; parent; parent = parent->parent_window()) {
|
||||||
|
if (!parent->is_modal())
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
bool Window::is_accessory() const
|
bool Window::is_accessory() const
|
||||||
{
|
{
|
||||||
if (!m_accessory)
|
if (!m_accessory)
|
||||||
|
|
|
@ -184,6 +184,7 @@ public:
|
||||||
|
|
||||||
bool is_modal() const;
|
bool is_modal() const;
|
||||||
bool is_modal_dont_unparent() const { return m_modal && m_parent_window; }
|
bool is_modal_dont_unparent() const { return m_modal && m_parent_window; }
|
||||||
|
Window* modeless_ancestor();
|
||||||
|
|
||||||
Gfx::IntRect rect() const { return m_rect; }
|
Gfx::IntRect rect() const { return m_rect; }
|
||||||
void set_rect(Gfx::IntRect const&);
|
void set_rect(Gfx::IntRect const&);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue