GUI2/Widget: add const overload of get_parent_grid
This commit is contained in:
parent
2931816979
commit
ad736266c1
2 changed files with 11 additions and 0 deletions
|
@ -152,6 +152,16 @@ grid* widget::get_parent_grid()
|
|||
return result ? dynamic_cast<grid*>(result) : nullptr;
|
||||
}
|
||||
|
||||
const grid* widget::get_parent_grid() const
|
||||
{
|
||||
const widget* result = parent_;
|
||||
while(result && dynamic_cast<const grid*>(result) == nullptr) {
|
||||
result = result->parent_;
|
||||
}
|
||||
|
||||
return result ? dynamic_cast<const grid*>(result) : nullptr;
|
||||
}
|
||||
|
||||
void widget::set_parent(widget* parent)
|
||||
{
|
||||
parent_ = parent;
|
||||
|
|
|
@ -198,6 +198,7 @@ public:
|
|||
* @retval nullptr No parent grid found.
|
||||
*/
|
||||
grid* get_parent_grid();
|
||||
const grid* get_parent_grid() const;
|
||||
|
||||
/*** *** *** *** *** *** Setters and getters. *** *** *** *** *** ***/
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue