void WgPopupLayer::_stealKeyboardFocus()
{
	// Get event handler, verify that we have a root

	if( !Hook() )
		return;

	WgEventHandlerPtr pHandler = Hook()->EventHandler();
	if( !pHandler )
		return;

	// Save old keyboard focus, which we assume belonged to previous menu in hierarchy.

	if( m_popupHooks.Size() < 2 )
		m_pKeyFocus = pHandler->KeyboardFocus().RawPtr();
	else
		m_popupHooks.Last()->Prev()->m_pKeyFocus = pHandler->KeyboardFocus().RawPtr();

	// Steal keyboard focus to top menu

	WgWidget * pWidget = m_popupHooks.Last()->_widget();

	if( pWidget->IsInstanceOf( WgPanel::CLASSNAME ) && static_cast<WgPanel*>(pWidget)->IsFocusGroup() )
		pHandler->SetFocusGroup(static_cast<WgPanel*>(pWidget));
	else
		pHandler->SetKeyboardFocus(pWidget);
}
void WgScrollbarTarget::_updateScrollbar( float pos, float size )
{
		WgWidget * pWidget = m_pScrollbar.RawPtr();

		if( pWidget )
		{
			if( pWidget->IsInstanceOf(WgScrollbar::CLASSNAME) )
					static_cast<WgScrollbar*>(pWidget)->_setHandle(pos,size);
		}

}