UIDrawObjectCanvas* Button::getDrawnDrawObject(void) const
{
    if(getEnabled())
    {
        //if(getFocused())
        //{
        //    return getFocusedDrawObject();
        //}
        if(getActive())
        {
            return getActiveDrawObject();
        }
        else if(_MouseInComponentLastMouse)
        {
            return getRolloverDrawObject();
        }
        else
        {
            return getDrawObject();
        }
    }
    else
    {
        return getDisabledDrawObject();
    }
}
void Button::changed(ConstFieldMaskArg whichField, 
                            UInt32            origin,
                            BitVector         details)
{
    Inherited::changed(whichField, origin, details);

    //Do not respond to changes that have a Sync origin
    if(origin & ChangedOrigin::Sync)
    {
        return;
    }

    if(whichField & DrawObjectFieldMask &&
        getDrawObject() != NULL)
    {
        getDrawObject()->setSize(getDrawObject()->getRequestedSize());
    }
    
    if(whichField & ActiveDrawObjectFieldMask &&
        getActiveDrawObject() != NULL)
    {
        getActiveDrawObject()->setSize(getActiveDrawObject()->getRequestedSize());
    }
    
    if(whichField & RolloverDrawObjectFieldMask &&
        getRolloverDrawObject() != NULL)
    {
        getRolloverDrawObject()->setSize(getRolloverDrawObject()->getRequestedSize());
    }
    
    if(whichField & DisabledDrawObjectFieldMask &&
        getDisabledDrawObject() != NULL)
    {
        getDisabledDrawObject()->setSize(getDisabledDrawObject()->getRequestedSize());
    }
    
    if(whichField & FocusedDrawObjectFieldMask &&
        getFocusedDrawObject() != NULL)
    {
        getFocusedDrawObject()->setSize(getFocusedDrawObject()->getRequestedSize());
    }
}
void Button::changed(ConstFieldMaskArg whichField, 
                            UInt32            origin,
                            BitVector         details)
{
    Inherited::changed(whichField, origin, details);

	if(whichField & DrawObjectFieldMask &&
		getDrawObject() != NULL)
	{
			getDrawObject()->setSize(getDrawObject()->getPreferredSize());
	}
	
	if(whichField & ActiveDrawObjectFieldMask &&
		getActiveDrawObject() != NULL)
	{
			getActiveDrawObject()->setSize(getActiveDrawObject()->getPreferredSize());
	}
	
	if(whichField & RolloverDrawObjectFieldMask &&
		getRolloverDrawObject() != NULL)
	{
			getRolloverDrawObject()->setSize(getRolloverDrawObject()->getPreferredSize());
	}
	
	if(whichField & DisabledDrawObjectFieldMask &&
		getDisabledDrawObject() != NULL)
	{
			getDisabledDrawObject()->setSize(getDisabledDrawObject()->getPreferredSize());
	}
	
	if(whichField & FocusedDrawObjectFieldMask &&
		getFocusedDrawObject() != NULL)
	{
			getFocusedDrawObject()->setSize(getFocusedDrawObject()->getPreferredSize());
	}
}