Refactored input event handling a bit.

--HG--
branch : gui-editor
hg/feature/streamed-package
dfighter1985 11 years ago
parent b4a64d4c04
commit e12d189d51

@ -333,6 +333,12 @@ namespace NLGUI
bool handleEvent( const CEventDescriptor &evnt ); bool handleEvent( const CEventDescriptor &evnt );
bool handleSystemEvent( const CEventDescriptor &evnt );
bool handleKeyboardEvent( const CEventDescriptor &evnt );
bool handleMouseEvent( const CEventDescriptor &evnt );
bool handleMouseMoveEvent( const CEventDescriptor &eventDesc ); bool handleMouseMoveEvent( const CEventDescriptor &eventDesc );
// Relative move of pointer // Relative move of pointer

@ -2096,7 +2096,30 @@ namespace NLGUI
if( activeAnims[i]->isDisableButtons() ) if( activeAnims[i]->isDisableButtons() )
return false; return false;
bool handled = false;
CViewPointer *_Pointer = static_cast< CViewPointer* >( getPointer() );
if( evnt.getType() == CEventDescriptor::system ) if( evnt.getType() == CEventDescriptor::system )
{
handleSystemEvent( evnt );
}
else
if (evnt.getType() == CEventDescriptor::key)
{
handled = handleKeyboardEvent( evnt );
}
else if (evnt.getType() == CEventDescriptor::mouse )
{
handled = handleMouseEvent( evnt );
}
CDBManager::getInstance()->flushObserverCalls();
return handled;
}
bool CWidgetManager::handleSystemEvent( const CEventDescriptor &evnt )
{ {
const CEventDescriptorSystem &systemEvent = reinterpret_cast< const CEventDescriptorSystem& >( evnt ); const CEventDescriptorSystem &systemEvent = reinterpret_cast< const CEventDescriptorSystem& >( evnt );
if( systemEvent.getEventTypeExtended() == CEventDescriptorSystem::setfocus ) if( systemEvent.getEventTypeExtended() == CEventDescriptorSystem::setfocus )
@ -2119,15 +2142,16 @@ namespace NLGUI
_CapturedView = NULL; _CapturedView = NULL;
} }
} }
return true;
} }
bool CWidgetManager::handleKeyboardEvent( const CEventDescriptor &evnt )
{
bool handled = false; bool handled = false;
CViewPointer *_Pointer = static_cast< CViewPointer* >( getPointer() );
if (evnt.getType() == CEventDescriptor::key)
{
CEventDescriptorKey &eventDesc = (CEventDescriptorKey&)evnt; CEventDescriptorKey &eventDesc = (CEventDescriptorKey&)evnt;
//_LastEventKeyDesc = eventDesc; //_LastEventKeyDesc = eventDesc;
// Any Key event disable the ContextHelp // Any Key event disable the ContextHelp
@ -2246,12 +2270,14 @@ namespace NLGUI
} }
lastKeyEvent = eventDesc; lastKeyEvent = eventDesc;
}
//////////////////////////////////////////////// Keyboard handling ends here //////////////////////////////////// return handled;
}
else if (evnt.getType() == CEventDescriptor::mouse ) bool CWidgetManager::handleMouseEvent( const CEventDescriptor &evnt )
{ {
bool handled = false;
CEventDescriptorMouse &eventDesc = (CEventDescriptorMouse&)evnt; CEventDescriptorMouse &eventDesc = (CEventDescriptorMouse&)evnt;
if( eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftdown ) if( eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftdown )
@ -2538,14 +2564,10 @@ namespace NLGUI
// If the mouse is over a window, always consider the event is taken (avoid click behind) // If the mouse is over a window, always consider the event is taken (avoid click behind)
handled|= isMouseOverWindow(); handled|= isMouseOverWindow();
} }
}
CDBManager::getInstance()->flushObserverCalls();
return handled; return handled;
} }
bool CWidgetManager::handleMouseMoveEvent( const CEventDescriptor &eventDesc ) bool CWidgetManager::handleMouseMoveEvent( const CEventDescriptor &eventDesc )
{ {
if( getPointer() == NULL ) if( getPointer() == NULL )

Loading…
Cancel
Save