mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-14 11:19:03 +00:00
CHANGED: #1471 Buttons can now be selected in the NelGUI widget or the widget hierarchy widget, and they will become highlighted.
This commit is contained in:
parent
06ed0489f4
commit
effdf45a70
7 changed files with 41 additions and 14 deletions
|
@ -481,6 +481,8 @@ namespace NLGUI
|
||||||
|
|
||||||
IParser* getParser() const{ return parser; }
|
IParser* getParser() const{ return parser; }
|
||||||
|
|
||||||
|
void setCurrentEditorSelection( const std::string &name );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CWidgetManager();
|
CWidgetManager();
|
||||||
~CWidgetManager();
|
~CWidgetManager();
|
||||||
|
@ -557,6 +559,8 @@ namespace NLGUI
|
||||||
|
|
||||||
std::vector< INewScreenSizeHandler* > newScreenSizeHandlers;
|
std::vector< INewScreenSizeHandler* > newScreenSizeHandlers;
|
||||||
std::vector< IOnWidgetsDrawnHandler* > onWidgetsDrawnHandlers;
|
std::vector< IOnWidgetsDrawnHandler* > onWidgetsDrawnHandlers;
|
||||||
|
|
||||||
|
std::string currentEditorSelection;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -252,6 +252,12 @@ namespace NLGUI
|
||||||
if (CWidgetManager::getInstance()->getCapturePointerLeft() != this)
|
if (CWidgetManager::getInstance()->getCapturePointerLeft() != this)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if( editorMode )
|
||||||
|
{
|
||||||
|
CWidgetManager::getInstance()->setCurrentEditorSelection( getId() );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (_LeftDblClickHandled) // no effect on mouse up after double click has been handled
|
if (_LeftDblClickHandled) // no effect on mouse up after double click has been handled
|
||||||
{
|
{
|
||||||
_LeftDblClickHandled = false;
|
_LeftDblClickHandled = false;
|
||||||
|
|
|
@ -218,10 +218,10 @@ namespace NLGUI
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ( _Over && !editorMode )
|
if ( ( _Over && !editorMode ) || editorSelected )
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((lastOver == false) && (_AHOnOver != NULL))
|
if( !editorMode && (lastOver == false) && (_AHOnOver != NULL))
|
||||||
CAHManager::getInstance()->runActionHandler (_AHOnOver, this, _AHOverParams);
|
CAHManager::getInstance()->runActionHandler (_AHOnOver, this, _AHOverParams);
|
||||||
|
|
||||||
// the pointer is over the button
|
// the pointer is over the button
|
||||||
|
|
|
@ -354,10 +354,14 @@ namespace NLGUI
|
||||||
rVR.drawRotFlipBitmap ( _RenderLayer, x+_BmpLeftW, y, txw, txh, 0, false, pTxId[1], color );
|
rVR.drawRotFlipBitmap ( _RenderLayer, x+_BmpLeftW, y, txw, txh, 0, false, pTxId[1], color );
|
||||||
rVR.drawRotFlipBitmap ( _RenderLayer, x+_BmpLeftW+txw, y, _BmpRightW, txh, 0, false, pTxId[2], color );
|
rVR.drawRotFlipBitmap ( _RenderLayer, x+_BmpLeftW+txw, y, _BmpRightW, txh, 0, false, pTxId[2], color );
|
||||||
|
|
||||||
|
CCtrlBase *capturePointerLeft = CWidgetManager::getInstance()->getCapturePointerLeft();
|
||||||
|
|
||||||
// *** Draw Over
|
// *** Draw Over
|
||||||
if ( !editorMode && _Over && (_OverWhenPushed || !(_Pushed || CWidgetManager::getInstance()->getCapturePointerLeft() == this)))
|
if( editorSelected ||
|
||||||
|
( !editorMode && _Over && (_OverWhenPushed || !(_Pushed || capturePointerLeft == this ) ) )
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if ((lastOver == false) && (_AHOnOver != NULL))
|
if( !editorMode && (lastOver == false) && (_AHOnOver != NULL) )
|
||||||
CAHManager::getInstance()->runActionHandler (_AHOnOver, this, _AHOverParams);
|
CAHManager::getInstance()->runActionHandler (_AHOnOver, this, _AHOverParams);
|
||||||
|
|
||||||
// the pointer is over the button.
|
// the pointer is over the button.
|
||||||
|
@ -390,7 +394,7 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Setup ViewText color
|
// Setup ViewText color
|
||||||
if ( pTxId==_TextureIdNormal )
|
if ( pTxId==_TextureIdNormal || editorMode )
|
||||||
{
|
{
|
||||||
if(_TextHeaderColor) viewTextColor.A= _TextColorNormal.A;
|
if(_TextHeaderColor) viewTextColor.A= _TextColorNormal.A;
|
||||||
else viewTextColor= _TextColorNormal;
|
else viewTextColor= _TextColorNormal;
|
||||||
|
|
|
@ -3093,6 +3093,22 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CWidgetManager::setCurrentEditorSelection( const std::string &name )
|
||||||
|
{
|
||||||
|
CInterfaceElement *e = getElementFromId( name );
|
||||||
|
if( e != NULL )
|
||||||
|
{
|
||||||
|
if( !currentEditorSelection.empty() )
|
||||||
|
{
|
||||||
|
CInterfaceElement *prev = getElementFromId( currentEditorSelection );
|
||||||
|
if( prev != NULL )
|
||||||
|
prev->setEditorSelected( false );
|
||||||
|
}
|
||||||
|
e->setEditorSelected( true );
|
||||||
|
currentEditorSelection = name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CWidgetManager::CWidgetManager()
|
CWidgetManager::CWidgetManager()
|
||||||
{
|
{
|
||||||
|
@ -3127,6 +3143,8 @@ namespace NLGUI
|
||||||
inGame = false;
|
inGame = false;
|
||||||
|
|
||||||
setScreenWH( 0, 0 );
|
setScreenWH( 0, 0 );
|
||||||
|
|
||||||
|
currentEditorSelection = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
CWidgetManager::~CWidgetManager()
|
CWidgetManager::~CWidgetManager()
|
||||||
|
|
|
@ -127,17 +127,9 @@ namespace GUIEditor
|
||||||
|
|
||||||
void WidgetHierarchy::onItemDblClicked( QTreeWidgetItem *item )
|
void WidgetHierarchy::onItemDblClicked( QTreeWidgetItem *item )
|
||||||
{
|
{
|
||||||
CWidgetManager *mg = CWidgetManager::getInstance();
|
|
||||||
|
|
||||||
if( item->parent() == NULL )
|
if( item->parent() == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::string name = item->text( 0 ).toStdString();
|
CWidgetManager::getInstance()->setCurrentEditorSelection( makeFullName( item, item->text( 0 ).toStdString() ) );
|
||||||
CInterfaceElement *e = mg->getElementFromId( makeFullName( item, name ) );
|
|
||||||
if( e != NULL )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,9 @@ namespace GUIEditor
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void onItemDblClicked( QTreeWidgetItem *item );
|
void onItemDblClicked( QTreeWidgetItem *item );
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string currentSelection;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue