public virtual void Update(UpdateState state)
{
//Set our absolute depth value
this.Depth = state.Depth++;
//If our matrix is dirty, recalculate it
if (_MtxDirty)
{
CalculateMatrix();
}
//If our blend is dirty, recalculate it
if (_OpacityDirty)
{
CalculateOpacity();
}
if (WillDraw())
{
if (m_MouseRefs != null)
{
//Check to see if the mouse is over any of the regions
//we have been asked to keep an eye on using ListenForMouse.
foreach (var mouseRegion in m_MouseRefs)
{
if (HitTestArea(state, mouseRegion.Region, true))
{
state.MouseEvents.Add(mouseRegion);
}
}
}
//Update hooks are callbacks. This lets external code add extra work
//that executes during the update loop.
//This is important because things like drag & drop should be calculated in the update loop.
//See UIUtils.MakeDraggable
if (UpdateHooks != null)
{
lock (UpdateHooks)
{
foreach (var hook in UpdateHooks)
{
hook(state);
}
}
}
}
}