void CGUIDialog::processLogic()
{
    // For the special effect not used in the galaxy engine
    if( g_pBehaviorEngine->getEngine() != ENGINE_GALAXY )
    {
        if( mFXhStep > 0 )
        {
            mFXhStep--;
            return;
        }
        else if( mFXvStep > 0 )
        {
            mFXvStep--;
            return;
        }
    }

    // Try to get a control that is waiting for input to be typed
    CGUIInputText *pInputCtrl = nullptr;
    for( auto &it : mControlList )
    {
        CGUIControl *ctrl = it.get();
        pInputCtrl = dynamic_cast<CGUIInputText*>(ctrl);
        if(pInputCtrl)
        {
            if(pInputCtrl->Typing())
               break;
            pInputCtrl = nullptr;
        }
    }

    if(pInputCtrl != nullptr)
    {
        pInputCtrl->processLogic();
    }
    else
    {
        // Process the subcontrols its logic
        int sel = 0;
        for( auto &it : mControlList )
        {
            CGUIControl *ctrl = it.get();

            ctrl->processLogic();

            if( dynamic_cast<CGUIButton*>(ctrl) || dynamic_cast<CGUIInputText*>(ctrl) )
            {
                if( ctrl->getHovered() )
                {
                    mpCurrentCtrl = ctrl;
                    mSelection = sel;
                }
            }
            sel++;
        }
    }

    if(!g_pInput->m_EventList.empty())
        g_pInput->m_EventList.clear();
}
void CGUIDialog::processLogic()
{
	// Render the stuff
	g_pVideoDriver->mDrawTasks.add( new DrawGUIRenderTask(this) );

	// Prepare the subcontrols for rendering
	int sel = 0;
	for( auto &it : mControlList )
	{
		CGUIControl *ctrl = it.get();

		ctrl->processLogic();

		if( dynamic_cast<CGUIButton*>(ctrl) || dynamic_cast<CGUIInputText*>(ctrl) )
		{
			if( ctrl->getHovered() )
			{
				mpCurrentCtrl = ctrl;
				mSelection = sel;
			}

		}
		sel++;
	}

	if(!g_pInput->m_EventList.empty())
		g_pInput->m_EventList.clear();

}