|
|
@ -2039,6 +2039,12 @@ namespace NLGUI
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( draggedElement != NULL )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CInterfaceElement *e = draggedElement;
|
|
|
|
|
|
|
|
static_cast< CViewBase* >( e )->draw();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( (nPriority == WIN_PRIORITY_WORLD_SPACE) && !camera.empty())
|
|
|
|
if ( (nPriority == WIN_PRIORITY_WORLD_SPACE) && !camera.empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
driver->setMatrixMode2D11();
|
|
|
|
driver->setMatrixMode2D11();
|
|
|
@ -2096,7 +2102,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,22 +2148,23 @@ 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
|
|
|
|
disableContextHelp();
|
|
|
|
disableContextHelp();
|
|
|
|
|
|
|
|
|
|
|
|
// Hide menu if the key is pushed
|
|
|
|
// Hide menu if the key is pushed
|
|
|
|
// if ((eventDesc.getKeyEventType() == CEventDescriptorKey::keydown) && !_ModalStack.empty() && !eventDesc.getKeyAlt() && !eventDesc.getKeyCtrl() && !eventDesc.getKeyShift())
|
|
|
|
// if ((eventDesc.getKeyEventType() == CEventDescriptorKey::keydown) && !_ModalStack.empty() && !eventDesc.getKeyAlt() && !eventDesc.getKeyCtrl() && !eventDesc.getKeyShift())
|
|
|
|
// Hide menu (or popup menu) is ESCAPE pressed
|
|
|
|
// Hide menu (or popup menu) is ESCAPE pressed
|
|
|
|
if( eventDesc.getKeyEventType() == CEventDescriptorKey::keychar && eventDesc.getChar() == NLMISC::KeyESCAPE )
|
|
|
|
if( eventDesc.getKeyEventType() == CEventDescriptorKey::keychar && eventDesc.getChar() == NLMISC::KeyESCAPE )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -2246,12 +2276,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 )
|
|
|
@ -2411,10 +2443,10 @@ namespace NLGUI
|
|
|
|
// consider clicking on a control implies handling of the event.
|
|
|
|
// consider clicking on a control implies handling of the event.
|
|
|
|
handled= true;
|
|
|
|
handled= true;
|
|
|
|
|
|
|
|
|
|
|
|
// handle the capture
|
|
|
|
|
|
|
|
if( getCapturePointerLeft() != NULL )
|
|
|
|
if( getCapturePointerLeft() != NULL )
|
|
|
|
getCapturePointerLeft()->handleEvent(evnt);
|
|
|
|
_CapturedView = getCapturePointerLeft();
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
|
|
// handle the capture
|
|
|
|
_CapturedView->handleEvent( evnt );
|
|
|
|
_CapturedView->handleEvent( evnt );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2508,6 +2540,11 @@ namespace NLGUI
|
|
|
|
setCapturePointerLeft(NULL);
|
|
|
|
setCapturePointerLeft(NULL);
|
|
|
|
handled = true;
|
|
|
|
handled = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_CapturedView = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( CInterfaceElement::getEditorMode() )
|
|
|
|
|
|
|
|
stopDragging();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -2538,14 +2575,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 )
|
|
|
@ -2580,9 +2613,53 @@ namespace NLGUI
|
|
|
|
ve.setY( getPointer()->getY() );
|
|
|
|
ve.setY( getPointer()->getY() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( CInterfaceElement::getEditorMode() )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if( ( _CapturedView != NULL ) && ( draggedElement == NULL ) )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
startDragging();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
if( draggedElement != NULL )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
draggedElement->setXReal( newX );
|
|
|
|
|
|
|
|
draggedElement->setYReal( newY );
|
|
|
|
|
|
|
|
draggedElement->invalidateCoords();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
bool CWidgetManager::startDragging()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CInterfaceElement *e = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CInterfaceGroup *g = _CapturedView->getParent();
|
|
|
|
|
|
|
|
if( g != NULL )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
e = g->takeElement( _CapturedView );
|
|
|
|
|
|
|
|
if( e == NULL )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
nlinfo( "Something went horribly wrong :(" );
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
e = _CapturedView;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
e->setParent( NULL );
|
|
|
|
|
|
|
|
draggedElement = e;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CWidgetManager::stopDragging()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
draggedElement = NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void CWidgetManager::movePointer (sint32 dx, sint32 dy)
|
|
|
|
void CWidgetManager::movePointer (sint32 dx, sint32 dy)
|
|
|
|
{
|
|
|
|
{
|
|
|
|