1
0
forked from 0ad/0ad

Added IsRootParent function to check if the absolute property should be ignored or not.

This was SVN commit r2502.
This commit is contained in:
Gee 2005-07-20 23:49:39 +00:00
parent 4e64200131
commit 8ebbb0bf35
2 changed files with 11 additions and 1 deletions

View File

@ -321,7 +321,7 @@ void IGUIObject::UpdateCachedSize()
// If absolute="false" and the object has got a parent,
// use its cached size instead of the screen. Notice
// it must have just been cached for it to work.
if (absolute == false && m_pParent)
if (absolute == false && m_pParent && !IsRootObject())
m_CachedActualSize = ca.GetClientArea(m_pParent->m_CachedActualSize);
else
m_CachedActualSize = ca.GetClientArea(CRect(0.f, 0.f, (float)g_xres, (float)g_yres));
@ -515,3 +515,8 @@ bool IGUIObject::IsFocused() const
{
return GetGUI()->m_FocusedObject == this;
}
bool IGUIObject::IsRootObject() const
{
return (GetGUI() != 0 && m_pParent == GetGUI()->m_BaseObject);
}

View File

@ -477,6 +477,11 @@ private:
*/
void UpdateMouseOver(IGUIObject * const &pMouseOver);
// Is the object a Root object, in philosophy, this means it
// has got no parent, and technically, it's got the m_BaseObject
// as parent.
bool IsRootObject() const;
// Variables
protected: