UIWinMenu and UIPopUpMenu fixes.

--HG--
branch : dev
This commit is contained in:
Martín Lucas Golini
2019-06-01 01:00:47 -03:00
parent 4d69b2bf7f
commit 6a79fdc314
6 changed files with 24 additions and 7 deletions
-2
View File
@@ -22,8 +22,6 @@ using namespace EE::Scene;
namespace EE { namespace UI {
class UITheme;
class UISkin;
class UISkinState;
class EE_API UINode : public Node {
public:
+2
View File
@@ -82,6 +82,8 @@ class EE_API UIWinMenu : public UIWidget {
void onMenuFocusLoss( const Event * Event );
void onHideByClick( const Event * Event );
void unselectButtons();
void destroyMenues();
+1
View File
@@ -1,5 +1,6 @@
#include <eepp/ui/uilistboxitem.hpp>
#include <eepp/ui/uilistbox.hpp>
#include <eepp/ui/uiskinstate.hpp>
namespace EE { namespace UI {
+2
View File
@@ -287,6 +287,8 @@ Uint32 UIMenu::onMessage( const NodeMessage * Msg ) {
Node * FocusCtrl = getEventDispatcher()->getFocusControl();
if ( this != FocusCtrl && !isParentOf( FocusCtrl ) && !isSubMenu( FocusCtrl ) ) {
mClickHide = true;
onWidgetFocusLoss();
}
+4 -2
View File
@@ -138,8 +138,9 @@ void UIMenuSubMenu::onSubMenuFocusLoss( const Event * ) {
}
if ( mSubMenu->mClickHide ) {
reinterpret_cast<UIMenu *>( getParent() )->hide();
UIMenu * parentMenu = reinterpret_cast<UIMenu *>( getParent() );
parentMenu->sendCommonEvent( Event::OnHideByClick );
parentMenu->hide();
mSubMenu->mClickHide = false;
}
}
@@ -148,6 +149,7 @@ void UIMenuSubMenu::onHideByClick( const Event * ) {
UIMenu * tMenu = reinterpret_cast<UIMenu *>( getParent() );
tMenu->mClickHide = true;
tMenu->sendCommonEvent( Event::OnHideByClick );
tMenu->hide();
}
+15 -3
View File
@@ -51,6 +51,7 @@ void UIWinMenu::addMenuButton( const String& ButtonText, UIPopUpMenu * Menu ) {
Menu->setEnabled( false );
Menu->setParent( getWindowContainer() );
Menu->addEventListener( Event::OnWidgetFocusLoss, cb::Make1( this, &UIWinMenu::onMenuFocusLoss ) );
Menu->addEventListener( Event::OnHideByClick, cb::Make1( this, &UIWinMenu::onHideByClick ) );
mButtons.push_back( std::make_pair( Button, Menu ) );
@@ -240,10 +241,17 @@ Uint32 UIWinMenu::onMessage( const NodeMessage * Msg ) {
}
} else {
if ( Msg->getFlags() & EE_BUTTON_LMASK ) {
mCurrentMenu = tpop;
if ( mCurrentMenu != tpop ) {
mCurrentMenu = tpop;
tbut->select();
tpop->show();
tbut->select();
tpop->show();
} else {
mCurrentMenu = NULL;
tbut->unselect();
tpop->hide();
}
}
}
@@ -321,6 +329,10 @@ void UIWinMenu::onMenuFocusLoss( const Event * ) {
}
}
void UIWinMenu::onHideByClick( const Event * ) {
onWidgetFocusLoss();
}
void UIWinMenu::onWidgetFocusLoss() {
UIWidget::onWidgetFocusLoss();