mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-24 20:51:35 +00:00
[ui] Add a function to get root view from any view
This proved useful with canvas references.
This commit is contained in:
parent
6b2bd02b14
commit
fc9c2fa544
1 changed files with 14 additions and 0 deletions
|
@ -157,6 +157,7 @@ void view_flow_up_left (view_t view, view_pos_t len);
|
|||
VIEWINLINE hierref_t *View_GetRef (view_t view);
|
||||
VIEWINLINE int View_Valid (view_t view);
|
||||
|
||||
VIEWINLINE view_t View_GetRoot (view_t view);
|
||||
VIEWINLINE view_t View_GetParent (view_t view);
|
||||
VIEWINLINE uint32_t View_ChildCount (view_t view);
|
||||
VIEWINLINE view_t View_GetChild (view_t view, uint32_t index);
|
||||
|
@ -219,6 +220,19 @@ View_Delete (view_t view)
|
|||
}
|
||||
}
|
||||
|
||||
VIEWINLINE
|
||||
view_t
|
||||
View_GetRoot (view_t view)
|
||||
{
|
||||
__auto_type ref = View_GetRef (view);
|
||||
hierarchy_t *h = ref->hierarchy;
|
||||
return (view_t) {
|
||||
.reg = view.reg,
|
||||
.id = h->ent[0],
|
||||
.comp = view.comp,
|
||||
};
|
||||
}
|
||||
|
||||
VIEWINLINE
|
||||
view_t
|
||||
View_GetParent (view_t view)
|
||||
|
|
Loading…
Reference in a new issue