mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-10-25 15:53:11 +03:00
UIWinMenu and UIPopUpMenu fixes.
--HG-- branch : dev
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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,5 +1,6 @@
|
||||
#include <eepp/ui/uilistboxitem.hpp>
|
||||
#include <eepp/ui/uilistbox.hpp>
|
||||
#include <eepp/ui/uiskinstate.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
|
||||
@@ -287,6 +287,8 @@ Uint32 UIMenu::onMessage( const NodeMessage * Msg ) {
|
||||
Node * FocusCtrl = getEventDispatcher()->getFocusControl();
|
||||
|
||||
if ( this != FocusCtrl && !isParentOf( FocusCtrl ) && !isSubMenu( FocusCtrl ) ) {
|
||||
mClickHide = true;
|
||||
|
||||
onWidgetFocusLoss();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user