mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-05 14:59:01 +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
1bdb92f565
commit
25599a4a82
7 changed files with 41 additions and 14 deletions
|
@ -480,6 +480,8 @@ namespace NLGUI
|
|||
const CEventDescriptorKey& getLastKeyEvent() const{ return lastKeyEvent; }
|
||||
|
||||
IParser* getParser() const{ return parser; }
|
||||
|
||||
void setCurrentEditorSelection( const std::string &name );
|
||||
|
||||
private:
|
||||
CWidgetManager();
|
||||
|
@ -557,6 +559,8 @@ namespace NLGUI
|
|||
|
||||
std::vector< INewScreenSizeHandler* > newScreenSizeHandlers;
|
||||
std::vector< IOnWidgetsDrawnHandler* > onWidgetsDrawnHandlers;
|
||||
|
||||
std::string currentEditorSelection;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -252,6 +252,12 @@ namespace NLGUI
|
|||
if (CWidgetManager::getInstance()->getCapturePointerLeft() != this)
|
||||
return false;
|
||||
|
||||
if( editorMode )
|
||||
{
|
||||
CWidgetManager::getInstance()->setCurrentEditorSelection( getId() );
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_LeftDblClickHandled) // no effect on mouse up after double click has been handled
|
||||
{
|
||||
_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);
|
||||
|
||||
// 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+txw, y, _BmpRightW, txh, 0, false, pTxId[2], color );
|
||||
|
||||
CCtrlBase *capturePointerLeft = CWidgetManager::getInstance()->getCapturePointerLeft();
|
||||
|
||||
// *** 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);
|
||||
|
||||
// the pointer is over the button.
|
||||
|
@ -390,7 +394,7 @@ namespace NLGUI
|
|||
}
|
||||
}
|
||||
// Setup ViewText color
|
||||
if ( pTxId==_TextureIdNormal )
|
||||
if ( pTxId==_TextureIdNormal || editorMode )
|
||||
{
|
||||
if(_TextHeaderColor) viewTextColor.A= _TextColorNormal.A;
|
||||
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()
|
||||
{
|
||||
|
@ -3127,6 +3143,8 @@ namespace NLGUI
|
|||
inGame = false;
|
||||
|
||||
setScreenWH( 0, 0 );
|
||||
|
||||
currentEditorSelection = "";
|
||||
}
|
||||
|
||||
CWidgetManager::~CWidgetManager()
|
||||
|
|
|
@ -127,17 +127,9 @@ namespace GUIEditor
|
|||
|
||||
void WidgetHierarchy::onItemDblClicked( QTreeWidgetItem *item )
|
||||
{
|
||||
CWidgetManager *mg = CWidgetManager::getInstance();
|
||||
|
||||
if( item->parent() == NULL )
|
||||
return;
|
||||
|
||||
std::string name = item->text( 0 ).toStdString();
|
||||
CInterfaceElement *e = mg->getElementFromId( makeFullName( item, name ) );
|
||||
if( e != NULL )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CWidgetManager::getInstance()->setCurrentEditorSelection( makeFullName( item, item->text( 0 ).toStdString() ) );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,9 @@ namespace GUIEditor
|
|||
|
||||
private Q_SLOTS:
|
||||
void onItemDblClicked( QTreeWidgetItem *item );
|
||||
|
||||
private:
|
||||
std::string currentSelection;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue