Renamed UIWinMenu to UIMenuBar.
@@ -35,11 +35,11 @@ ProgressBar {
|
||||
padding: 2dp;
|
||||
}
|
||||
|
||||
WinMenu {
|
||||
MenuBar {
|
||||
padding-left: 1dp;
|
||||
}
|
||||
|
||||
WinMenu::button {
|
||||
MenuBar::button {
|
||||
padding-left: -3dp;
|
||||
padding-right: -3dp;
|
||||
}
|
||||
|
||||
@@ -533,7 +533,7 @@ SpinBox::btnup:hover {
|
||||
foreground-image: poly(line, var(--primary), "1dp 7dp, 5dp 4dp"), poly(line, var(--primary), "5dp 4dp, 9dp 7dp");
|
||||
}
|
||||
|
||||
WinMenu {
|
||||
MenuBar {
|
||||
height: 24dp;
|
||||
}
|
||||
|
||||
@@ -547,13 +547,13 @@ PopUpMenu {
|
||||
border-color: var(--menu-border);
|
||||
}
|
||||
|
||||
WinMenu::Button {
|
||||
MenuBar::Button {
|
||||
padding-left: 4dp;
|
||||
padding-right: 4dp;
|
||||
min-height: 24dp;
|
||||
}
|
||||
|
||||
WinMenu::Button:hover {
|
||||
MenuBar::Button:hover {
|
||||
background-color: var(--primary);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,11 +23,11 @@ ProgressBar {
|
||||
padding: 2dp;
|
||||
}
|
||||
|
||||
WinMenu {
|
||||
MenuBar {
|
||||
padding-left: 1dp;
|
||||
}
|
||||
|
||||
WinMenu::button {
|
||||
MenuBar::button {
|
||||
padding-left: -3dp;
|
||||
padding-right: -3dp;
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 81 B After Width: | Height: | Size: 81 B |
|
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 218 B |
|
Before Width: | Height: | Size: 116 B After Width: | Height: | Size: 116 B |
|
Before Width: | Height: | Size: 604 B After Width: | Height: | Size: 604 B |
|
Before Width: | Height: | Size: 179 B After Width: | Height: | Size: 179 B |
|
Before Width: | Height: | Size: 958 B After Width: | Height: | Size: 958 B |
@@ -17,7 +17,7 @@
|
||||
#include <eepp/ui/uitextureregion.hpp>
|
||||
#include <eepp/ui/uithememanager.hpp>
|
||||
#include <eepp/ui/uiwindow.hpp>
|
||||
#include <eepp/ui/uiwinmenu.hpp>
|
||||
#include <eepp/ui/uimenubar.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
class UIMessageBox;
|
||||
@@ -121,7 +121,7 @@ class EE_API MapEditor {
|
||||
|
||||
void createME();
|
||||
|
||||
void createWinMenu();
|
||||
void createMenuBar();
|
||||
|
||||
void createETGMenu();
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
#include <eepp/ui/uiviewpager.hpp>
|
||||
#include <eepp/ui/uiwidget.hpp>
|
||||
#include <eepp/ui/uiwindow.hpp>
|
||||
#include <eepp/ui/uiwinmenu.hpp>
|
||||
#include <eepp/ui/uimenubar.hpp>
|
||||
|
||||
#include <eepp/ui/uiwidgetcreator.hpp>
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <eepp/ui/uilistbox.hpp>
|
||||
#include <eepp/ui/uispinbox.hpp>
|
||||
#include <eepp/ui/uiwindow.hpp>
|
||||
#include <eepp/ui/uiwinmenu.hpp>
|
||||
#include <eepp/ui/uimenubar.hpp>
|
||||
|
||||
namespace EE { namespace UI { namespace Tools {
|
||||
|
||||
@@ -49,7 +49,7 @@ class EE_API TextureAtlasEditor {
|
||||
UISpinBox* mSpinDestH;
|
||||
UIListBox* mTextureRegionList;
|
||||
UIGridLayout* mTextureRegionGrid;
|
||||
UIWinMenu* mWinMenu;
|
||||
UIMenuBar* mMenuBar;
|
||||
UIDropDownList* mTextureFilterList;
|
||||
TextureAtlasTextureRegionEditor* mTextureRegionEditor;
|
||||
bool mEdited;
|
||||
|
||||
@@ -69,7 +69,7 @@ enum UINodeType {
|
||||
UI_TYPE_TOOLTIP,
|
||||
UI_TYPE_TABLE,
|
||||
UI_TYPE_WINDOW,
|
||||
UI_TYPE_WINMENU,
|
||||
UI_TYPE_MENUBAR,
|
||||
UI_TYPE_SELECTBUTTON,
|
||||
UI_TYPE_POPUPMENU,
|
||||
UI_TYPE_COMMONDIALOG,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef EE_UICUIWINMENU_HPP
|
||||
#define EE_UICUIWINMENU_HPP
|
||||
#ifndef EE_UI_UIMENUBAR_HPP
|
||||
#define EE_UI_UIMENUBAR_HPP
|
||||
|
||||
#include <eepp/ui/base.hpp>
|
||||
#include <eepp/ui/uipopupmenu.hpp>
|
||||
@@ -8,13 +8,13 @@
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
class EE_API UIWinMenu : public UIWidget {
|
||||
class EE_API UIMenuBar : public UIWidget {
|
||||
public:
|
||||
static UIWinMenu* New();
|
||||
static UIMenuBar* New();
|
||||
|
||||
UIWinMenu();
|
||||
UIMenuBar();
|
||||
|
||||
virtual ~UIWinMenu();
|
||||
virtual ~UIMenuBar();
|
||||
|
||||
virtual Uint32 getType() const;
|
||||
|
||||
@@ -39,11 +39,11 @@ class EE_API UIWinMenu : public UIWidget {
|
||||
virtual void loadFromXmlNode( const pugi::xml_node& node );
|
||||
|
||||
protected:
|
||||
typedef std::list<std::pair<UISelectButton*, UIPopUpMenu*>> WinMenuList;
|
||||
typedef std::list<std::pair<UISelectButton*, UIPopUpMenu*>> MenuBarList;
|
||||
|
||||
Uint32 mMenuHeight;
|
||||
UIPopUpMenu* mCurrentMenu;
|
||||
WinMenuList mButtons;
|
||||
MenuBarList mButtons;
|
||||
|
||||
void refreshButtons();
|
||||
|
||||
@@ -349,6 +349,7 @@
|
||||
../../include/eepp/ui/uilistboxitem.hpp
|
||||
../../include/eepp/ui/uiloader.hpp
|
||||
../../include/eepp/ui/uimanager.hpp
|
||||
../../include/eepp/ui/uimenubar.hpp
|
||||
../../include/eepp/ui/uimenucheckbox.hpp
|
||||
../../include/eepp/ui/uimenu.hpp
|
||||
../../include/eepp/ui/uimenuitem.hpp
|
||||
@@ -390,7 +391,6 @@
|
||||
../../include/eepp/ui/uiwidgetcreator.hpp
|
||||
../../include/eepp/ui/uiwidget.hpp
|
||||
../../include/eepp/ui/uiwindow.hpp
|
||||
../../include/eepp/ui/uiwinmenu.hpp
|
||||
../../include/eepp/version.hpp
|
||||
../../include/eepp/window/base.hpp
|
||||
../../include/eepp/window/clipboard.hpp
|
||||
@@ -797,6 +797,7 @@
|
||||
../../src/eepp/ui/uilistboxitem.cpp
|
||||
../../src/eepp/ui/uiloader.cpp
|
||||
../../src/eepp/ui/uimanager.cpp
|
||||
../../src/eepp/ui/uimenubar.cpp
|
||||
../../src/eepp/ui/uimenucheckbox.cpp
|
||||
../../src/eepp/ui/uimenu.cpp
|
||||
../../src/eepp/ui/uimenuitem.cpp
|
||||
@@ -838,7 +839,6 @@
|
||||
../../src/eepp/ui/uiwidget.cpp
|
||||
../../src/eepp/ui/uiwidgetcreator.cpp
|
||||
../../src/eepp/ui/uiwindow.cpp
|
||||
../../src/eepp/ui/uiwinmenu.cpp
|
||||
../../src/eepp/window/backend/allegro5/cbackendal.hpp
|
||||
../../src/eepp/window/backend/allegro5/cclipboardal.cpp
|
||||
../../src/eepp/window/backend/allegro5/cclipboardal.hpp
|
||||
|
||||
@@ -86,7 +86,7 @@ MapEditor::MapEditor( UIWindow* AttatchTo, const MapEditorCloseCb& callback ) :
|
||||
MapEditor::~MapEditor() {}
|
||||
|
||||
void MapEditor::createME() {
|
||||
createWinMenu();
|
||||
createMenuBar();
|
||||
|
||||
createETGMenu();
|
||||
|
||||
@@ -101,16 +101,16 @@ bool MapEditor::addShortcut( const Keycode& KeyCode, const Uint32& Mod, UIWidget
|
||||
}
|
||||
}
|
||||
|
||||
void MapEditor::createWinMenu() {
|
||||
UIWinMenu* WinMenu = UIWinMenu::New();
|
||||
WinMenu->setParent( mUIContainer );
|
||||
WinMenu->getUISceneNode()->updateDirtyStyleStates();
|
||||
void MapEditor::createMenuBar() {
|
||||
UIMenuBar* MenuBar = UIMenuBar::New();
|
||||
MenuBar->setParent( mUIContainer );
|
||||
MenuBar->getUISceneNode()->updateDirtyStyleStates();
|
||||
|
||||
mTileBox =
|
||||
createTextBox( "", mUIContainer, Sizef(), Vector2f(),
|
||||
UI_HALIGN_RIGHT | UI_VALIGN_CENTER | UI_ANCHOR_TOP | UI_ANCHOR_RIGHT );
|
||||
mTileBox->setLayoutSizePolicy( SizePolicy::Fixed, SizePolicy::Fixed );
|
||||
mTileBox->setSize( 100, WinMenu->getSize().getHeight() );
|
||||
mTileBox->setSize( 100, MenuBar->getSize().getHeight() );
|
||||
mTileBox->setPosition(
|
||||
Vector2f( mUIContainer->getSize().getWidth() - mTileBox->getSize().getWidth(), 0 ) );
|
||||
mTileBox->setVisible( true );
|
||||
@@ -129,7 +129,7 @@ void MapEditor::createWinMenu() {
|
||||
PU1->add( "Quit", mTheme->getIconByName( "quit" ) );
|
||||
|
||||
PU1->addEventListener( Event::OnItemClicked, cb::Make1( this, &MapEditor::fileMenuClick ) );
|
||||
WinMenu->addMenuButton( "File", PU1 );
|
||||
MenuBar->addMenuButton( "File", PU1 );
|
||||
|
||||
UIPopUpMenu* PU3 = UIPopUpMenu::New();
|
||||
PU3->setParent( mUIContainer );
|
||||
@@ -156,7 +156,7 @@ void MapEditor::createWinMenu() {
|
||||
PU3->addSeparator();
|
||||
|
||||
PU3->addEventListener( Event::OnItemClicked, cb::Make1( this, &MapEditor::viewMenuClick ) );
|
||||
WinMenu->addMenuButton( "View", PU3 );
|
||||
MenuBar->addMenuButton( "View", PU3 );
|
||||
|
||||
UIPopUpMenu* PU4 = UIPopUpMenu::New();
|
||||
PU4->setParent( mUIContainer );
|
||||
@@ -164,7 +164,7 @@ void MapEditor::createWinMenu() {
|
||||
PU4->add( "Resize..." );
|
||||
|
||||
PU4->addEventListener( Event::OnItemClicked, cb::Make1( this, &MapEditor::mapMenuClick ) );
|
||||
WinMenu->addMenuButton( "Map", PU4 );
|
||||
MenuBar->addMenuButton( "Map", PU4 );
|
||||
|
||||
UIPopUpMenu* PU5 = UIPopUpMenu::New();
|
||||
PU5->setParent( mUIContainer );
|
||||
@@ -188,21 +188,21 @@ void MapEditor::createWinMenu() {
|
||||
mLayerChkVisible = PU5->getItem( LayerChkBoxIndex )->asType<UIMenuCheckBox>();
|
||||
|
||||
PU5->addEventListener( Event::OnItemClicked, cb::Make1( this, &MapEditor::layerMenuClick ) );
|
||||
WinMenu->addMenuButton( "Layer", PU5 );
|
||||
MenuBar->addMenuButton( "Layer", PU5 );
|
||||
|
||||
UIPopUpMenu* PU6 = UIPopUpMenu::New();
|
||||
PU6->setParent( mUIContainer );
|
||||
PU6->add( "New Texture Atlas..." );
|
||||
PU6->add( "Add External Texture Atlas..." );
|
||||
WinMenu->addMenuButton( "Atlases", PU6 );
|
||||
MenuBar->addMenuButton( "Atlases", PU6 );
|
||||
PU6->addEventListener( Event::OnItemClicked, cb::Make1( this, &MapEditor::mapMenuClick ) );
|
||||
|
||||
mWinContainer = UIWidget::New();
|
||||
mWinContainer->enableReportSizeChangeToChilds();
|
||||
mWinContainer->setParent( mUIContainer );
|
||||
mWinContainer->setPosition( 0, WinMenu->getSize().getHeight() );
|
||||
mWinContainer->setPosition( 0, MenuBar->getSize().getHeight() );
|
||||
mWinContainer->setSize( mUIContainer->getSize().getWidth(),
|
||||
mUIContainer->getSize().getHeight() - WinMenu->getSize().getHeight() );
|
||||
mUIContainer->getSize().getHeight() - MenuBar->getSize().getHeight() );
|
||||
mWinContainer->setAnchors( UI_ANCHOR_TOP | UI_ANCHOR_BOTTOM | UI_ANCHOR_LEFT |
|
||||
UI_ANCHOR_RIGHT );
|
||||
mWinContainer->setThemeSkin( mTheme, "winback" );
|
||||
|
||||
@@ -53,7 +53,7 @@ TextureAtlasEditor::TextureAtlasEditor( UIWindow* attachTo, const TGEditorCloseC
|
||||
|
||||
std::string layout = R"xml(
|
||||
<LinearLayout id="texture_atlas_editor_root" orientation="vertical" layout_width="match_parent" layout_height="match_parent">
|
||||
<WinMenu layout_width="match_parent" layout_height="wrap_content">
|
||||
<MenuBar layout_width="match_parent" layout_height="wrap_content">
|
||||
<Menu id="fileMenu" text="File">
|
||||
<item text="New..." icon="document-new" />
|
||||
<item text="Open..." icon="document-open" />
|
||||
@@ -64,7 +64,7 @@ TextureAtlasEditor::TextureAtlasEditor( UIWindow* attachTo, const TGEditorCloseC
|
||||
<separator />
|
||||
<item text="Quit" icon="quit" />
|
||||
</Menu>
|
||||
</WinMenu>
|
||||
</MenuBar>
|
||||
<LinearLayout layout_width="match_parent" layout_height="0dp" layout_weight="1" orientation="horizontal">
|
||||
<TextureAtlasTextureRegionEditor layout_width="match_parent" layout_height="match_parent" layout_weight="1"
|
||||
flags="clip" background-color="#00000032" border-width="1" border-color="#000000FF" />
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
#include <eepp/ui/css/propertydefinition.hpp>
|
||||
#include <eepp/ui/uiscenenode.hpp>
|
||||
#include <eepp/ui/uithememanager.hpp>
|
||||
#include <eepp/ui/uiwinmenu.hpp>
|
||||
#include <eepp/ui/uimenubar.hpp>
|
||||
#include <pugixml/pugixml.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
UIWinMenu* UIWinMenu::New() {
|
||||
return eeNew( UIWinMenu, () );
|
||||
UIMenuBar* UIMenuBar::New() {
|
||||
return eeNew( UIMenuBar, () );
|
||||
}
|
||||
|
||||
UIWinMenu::UIWinMenu() : UIWidget( "winmenu" ), mMenuHeight( 0 ), mCurrentMenu( NULL ) {
|
||||
UIMenuBar::UIMenuBar() : UIWidget( "menubar" ), mMenuHeight( 0 ), mCurrentMenu( NULL ) {
|
||||
if ( !( mFlags & UI_ANCHOR_RIGHT ) )
|
||||
mFlags |= UI_ANCHOR_RIGHT;
|
||||
|
||||
@@ -21,15 +21,15 @@ UIWinMenu::UIWinMenu() : UIWidget( "winmenu" ), mMenuHeight( 0 ), mCurrentMenu(
|
||||
applyDefaultTheme();
|
||||
}
|
||||
|
||||
UIWinMenu::~UIWinMenu() {
|
||||
UIMenuBar::~UIMenuBar() {
|
||||
destroyMenues();
|
||||
}
|
||||
|
||||
void UIWinMenu::destroyMenues() {
|
||||
void UIMenuBar::destroyMenues() {
|
||||
if ( !SceneManager::instance()->isShootingDown() ) {
|
||||
for ( WinMenuList::iterator it = mButtons.begin(); it != mButtons.end(); ++it ) {
|
||||
for ( MenuBarList::iterator it = mButtons.begin(); it != mButtons.end(); ++it ) {
|
||||
if ( it->second->getParent() != this ) {
|
||||
// Changing the parent ensures that the menu will be destroyed when the win menu is
|
||||
// Changing the parent ensures that the menu will be destroyed when the menubar is
|
||||
// destroyed
|
||||
it->second->setParent( this );
|
||||
}
|
||||
@@ -37,18 +37,18 @@ void UIWinMenu::destroyMenues() {
|
||||
}
|
||||
}
|
||||
|
||||
Uint32 UIWinMenu::getType() const {
|
||||
return UI_TYPE_WINMENU;
|
||||
Uint32 UIMenuBar::getType() const {
|
||||
return UI_TYPE_MENUBAR;
|
||||
}
|
||||
|
||||
bool UIWinMenu::isType( const Uint32& type ) const {
|
||||
return UIWinMenu::getType() == type ? true : UIWidget::isType( type );
|
||||
bool UIMenuBar::isType( const Uint32& type ) const {
|
||||
return UIMenuBar::getType() == type ? true : UIWidget::isType( type );
|
||||
}
|
||||
|
||||
void UIWinMenu::addMenuButton( const String& ButtonText, UIPopUpMenu* Menu ) {
|
||||
void UIMenuBar::addMenuButton( const String& ButtonText, UIPopUpMenu* Menu ) {
|
||||
eeASSERT( NULL != Menu );
|
||||
|
||||
UISelectButton* Button = UISelectButton::NewWithTag( "winmenu::button" );
|
||||
UISelectButton* Button = UISelectButton::NewWithTag( "menubar::button" );
|
||||
Button->setParent( this );
|
||||
Button->setText( ButtonText );
|
||||
Button->setVisible( true );
|
||||
@@ -60,32 +60,32 @@ void UIWinMenu::addMenuButton( const String& ButtonText, UIPopUpMenu* Menu ) {
|
||||
// This will force to change the parent when shown, and force the CSS style reload.
|
||||
Menu->setParent( this );
|
||||
Menu->addEventListener( Event::OnWidgetFocusLoss,
|
||||
cb::Make1( this, &UIWinMenu::onMenuFocusLoss ) );
|
||||
Menu->addEventListener( Event::OnHideByClick, cb::Make1( this, &UIWinMenu::onHideByClick ) );
|
||||
cb::Make1( this, &UIMenuBar::onMenuFocusLoss ) );
|
||||
Menu->addEventListener( Event::OnHideByClick, cb::Make1( this, &UIMenuBar::onHideByClick ) );
|
||||
|
||||
mButtons.push_back( std::make_pair( Button, Menu ) );
|
||||
|
||||
if ( NULL != mTheme )
|
||||
Button->setThemeSkin( mTheme, "winmenubutton" );
|
||||
Button->setThemeSkin( mTheme, "menubarbutton" );
|
||||
|
||||
refreshButtons();
|
||||
}
|
||||
|
||||
void UIWinMenu::setTheme( UITheme* Theme ) {
|
||||
void UIMenuBar::setTheme( UITheme* Theme ) {
|
||||
UIWidget::setTheme( Theme );
|
||||
|
||||
setThemeSkin( Theme, "winmenu" );
|
||||
setThemeSkin( Theme, "menubar" );
|
||||
|
||||
for ( WinMenuList::iterator it = mButtons.begin(); it != mButtons.end(); ++it ) {
|
||||
it->first->setThemeSkin( Theme, "winmenubutton" );
|
||||
for ( MenuBarList::iterator it = mButtons.begin(); it != mButtons.end(); ++it ) {
|
||||
it->first->setThemeSkin( Theme, "menubarbutton" );
|
||||
}
|
||||
|
||||
autoHeight();
|
||||
onThemeLoaded();
|
||||
}
|
||||
|
||||
void UIWinMenu::removeMenuButton( const String& ButtonText ) {
|
||||
for ( WinMenuList::iterator it = mButtons.begin(); it != mButtons.end(); ++it ) {
|
||||
void UIMenuBar::removeMenuButton( const String& ButtonText ) {
|
||||
for ( MenuBarList::iterator it = mButtons.begin(); it != mButtons.end(); ++it ) {
|
||||
if ( it->first->getText() == ButtonText ) {
|
||||
it->first->close();
|
||||
it->second->close();
|
||||
@@ -99,8 +99,8 @@ void UIWinMenu::removeMenuButton( const String& ButtonText ) {
|
||||
}
|
||||
}
|
||||
|
||||
UISelectButton* UIWinMenu::getButton( const String& ButtonText ) {
|
||||
for ( WinMenuList::iterator it = mButtons.begin(); it != mButtons.end(); ++it ) {
|
||||
UISelectButton* UIMenuBar::getButton( const String& ButtonText ) {
|
||||
for ( MenuBarList::iterator it = mButtons.begin(); it != mButtons.end(); ++it ) {
|
||||
if ( it->first->getText() == ButtonText ) {
|
||||
return it->first;
|
||||
}
|
||||
@@ -109,8 +109,8 @@ UISelectButton* UIWinMenu::getButton( const String& ButtonText ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
UIPopUpMenu* UIWinMenu::getPopUpMenu( const String& ButtonText ) {
|
||||
for ( WinMenuList::iterator it = mButtons.begin(); it != mButtons.end(); ++it ) {
|
||||
UIPopUpMenu* UIMenuBar::getPopUpMenu( const String& ButtonText ) {
|
||||
for ( MenuBarList::iterator it = mButtons.begin(); it != mButtons.end(); ++it ) {
|
||||
if ( it->first->getText() == ButtonText ) {
|
||||
return it->second;
|
||||
}
|
||||
@@ -119,11 +119,11 @@ UIPopUpMenu* UIWinMenu::getPopUpMenu( const String& ButtonText ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Uint32 UIWinMenu::getMenuHeight() const {
|
||||
Uint32 UIMenuBar::getMenuHeight() const {
|
||||
return mMenuHeight;
|
||||
}
|
||||
|
||||
void UIWinMenu::setMenuHeight( const Uint32& menuHeight ) {
|
||||
void UIMenuBar::setMenuHeight( const Uint32& menuHeight ) {
|
||||
mMenuHeight = menuHeight;
|
||||
|
||||
if ( 0 != mMenuHeight ) {
|
||||
@@ -135,7 +135,7 @@ void UIWinMenu::setMenuHeight( const Uint32& menuHeight ) {
|
||||
refreshButtons();
|
||||
}
|
||||
|
||||
void UIWinMenu::refreshButtons() {
|
||||
void UIMenuBar::refreshButtons() {
|
||||
Int32 ycenter = 0;
|
||||
|
||||
if ( !mButtons.empty() ) {
|
||||
@@ -157,14 +157,14 @@ void UIWinMenu::refreshButtons() {
|
||||
|
||||
Uint32 xpos = getPadding().Left;
|
||||
|
||||
for ( WinMenuList::iterator it = mButtons.begin(); it != mButtons.end(); ++it ) {
|
||||
for ( MenuBarList::iterator it = mButtons.begin(); it != mButtons.end(); ++it ) {
|
||||
UISelectButton* pbut = it->first;
|
||||
pbut->setPosition( xpos, ycenter );
|
||||
xpos += pbut->getSize().getWidth() + pbut->getLayoutMargin().Left;
|
||||
}
|
||||
}
|
||||
|
||||
bool UIWinMenu::applyProperty( const StyleSheetProperty& attribute ) {
|
||||
bool UIMenuBar::applyProperty( const StyleSheetProperty& attribute ) {
|
||||
if ( !checkPropertyDefinition( attribute ) )
|
||||
return false;
|
||||
|
||||
@@ -179,7 +179,7 @@ bool UIWinMenu::applyProperty( const StyleSheetProperty& attribute ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Uint32 UIWinMenu::onMessage( const NodeMessage* Msg ) {
|
||||
Uint32 UIMenuBar::onMessage( const NodeMessage* Msg ) {
|
||||
switch ( Msg->getMsg() ) {
|
||||
case NodeMessage::MouseUp:
|
||||
case NodeMessage::MouseOver: {
|
||||
@@ -222,7 +222,7 @@ Uint32 UIWinMenu::onMessage( const NodeMessage* Msg ) {
|
||||
break;
|
||||
}
|
||||
case NodeMessage::Selected: {
|
||||
for ( WinMenuList::iterator it = mButtons.begin(); it != mButtons.end(); ++it ) {
|
||||
for ( MenuBarList::iterator it = mButtons.begin(); it != mButtons.end(); ++it ) {
|
||||
if ( it->first != Msg->getSender() ) {
|
||||
it->first->unselect();
|
||||
}
|
||||
@@ -246,7 +246,7 @@ Uint32 UIWinMenu::onMessage( const NodeMessage* Msg ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void UIWinMenu::onParentChange() {
|
||||
void UIMenuBar::onParentChange() {
|
||||
setSize( getParent()->getSize().getWidth(), mMenuHeight );
|
||||
|
||||
updateAnchorsDistances();
|
||||
@@ -254,18 +254,18 @@ void UIWinMenu::onParentChange() {
|
||||
UIWidget::onParentChange();
|
||||
}
|
||||
|
||||
void UIWinMenu::onPaddingChange() {
|
||||
void UIMenuBar::onPaddingChange() {
|
||||
refreshButtons();
|
||||
}
|
||||
|
||||
void UIWinMenu::unselectButtons() {
|
||||
for ( WinMenuList::iterator it = mButtons.begin(); it != mButtons.end(); ++it ) {
|
||||
void UIMenuBar::unselectButtons() {
|
||||
for ( MenuBarList::iterator it = mButtons.begin(); it != mButtons.end(); ++it ) {
|
||||
it->first->unselect();
|
||||
}
|
||||
}
|
||||
|
||||
UIPopUpMenu* UIWinMenu::getMenuFromButton( UISelectButton* Button ) {
|
||||
for ( WinMenuList::iterator it = mButtons.begin(); it != mButtons.end(); ++it ) {
|
||||
UIPopUpMenu* UIMenuBar::getMenuFromButton( UISelectButton* Button ) {
|
||||
for ( MenuBarList::iterator it = mButtons.begin(); it != mButtons.end(); ++it ) {
|
||||
if ( it->first == Button ) {
|
||||
return it->second;
|
||||
}
|
||||
@@ -274,8 +274,8 @@ UIPopUpMenu* UIWinMenu::getMenuFromButton( UISelectButton* Button ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool UIWinMenu::isPopUpMenuChild( Node* Ctrl ) {
|
||||
for ( WinMenuList::iterator it = mButtons.begin(); it != mButtons.end(); ++it ) {
|
||||
bool UIMenuBar::isPopUpMenuChild( Node* Ctrl ) {
|
||||
for ( MenuBarList::iterator it = mButtons.begin(); it != mButtons.end(); ++it ) {
|
||||
if ( it->second == Ctrl || it->second->isParentOf( Ctrl ) ) {
|
||||
return true;
|
||||
}
|
||||
@@ -284,7 +284,7 @@ bool UIWinMenu::isPopUpMenuChild( Node* Ctrl ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void UIWinMenu::onMenuFocusLoss( const Event* ) {
|
||||
void UIMenuBar::onMenuFocusLoss( const Event* ) {
|
||||
Node* FocusCtrl = getEventDispatcher()->getFocusNode();
|
||||
|
||||
if ( !isParentOf( FocusCtrl ) && !isPopUpMenuChild( FocusCtrl ) ) {
|
||||
@@ -292,11 +292,11 @@ void UIWinMenu::onMenuFocusLoss( const Event* ) {
|
||||
}
|
||||
}
|
||||
|
||||
void UIWinMenu::onHideByClick( const Event* ) {
|
||||
void UIMenuBar::onHideByClick( const Event* ) {
|
||||
onWidgetFocusLoss();
|
||||
}
|
||||
|
||||
void UIWinMenu::onWidgetFocusLoss() {
|
||||
void UIMenuBar::onWidgetFocusLoss() {
|
||||
UIWidget::onWidgetFocusLoss();
|
||||
|
||||
if ( NULL != mCurrentMenu ) {
|
||||
@@ -308,7 +308,7 @@ void UIWinMenu::onWidgetFocusLoss() {
|
||||
unselectButtons();
|
||||
}
|
||||
|
||||
void UIWinMenu::autoHeight() {
|
||||
void UIMenuBar::autoHeight() {
|
||||
if ( 0 == mMenuHeight && NULL != getSkin() ) {
|
||||
mMenuHeight = getSkinSize().getHeight();
|
||||
|
||||
@@ -318,7 +318,7 @@ void UIWinMenu::autoHeight() {
|
||||
}
|
||||
}
|
||||
|
||||
void UIWinMenu::loadFromXmlNode( const pugi::xml_node& node ) {
|
||||
void UIMenuBar::loadFromXmlNode( const pugi::xml_node& node ) {
|
||||
beginAttributesTransaction();
|
||||
|
||||
UIWidget::loadFromXmlNode( node );
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <eepp/ui/uiselectbutton.hpp>
|
||||
#include <eepp/ui/uistyle.hpp>
|
||||
#include <eepp/ui/uiwinmenu.hpp>
|
||||
#include <eepp/ui/uimenubar.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <eepp/ui/uiviewpager.hpp>
|
||||
#include <eepp/ui/uiwidgetcreator.hpp>
|
||||
#include <eepp/ui/uiwindow.hpp>
|
||||
#include <eepp/ui/uiwinmenu.hpp>
|
||||
#include <eepp/ui/uimenubar.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
@@ -55,7 +55,7 @@ void UIWidgetCreator::createBaseWidgetList() {
|
||||
registeredWidget["dropdownlist"] = UIDropDownList::New;
|
||||
registeredWidget["image"] = UIImage::New;
|
||||
registeredWidget["listbox"] = UIListBox::New;
|
||||
registeredWidget["winmenu"] = UIWinMenu::New;
|
||||
registeredWidget["menubar"] = UIMenuBar::New;
|
||||
registeredWidget["progressbar"] = UIProgressBar::New;
|
||||
registeredWidget["scrollbar"] = UIScrollBar::New;
|
||||
registeredWidget["slider"] = UISlider::New;
|
||||
|
||||
@@ -815,8 +815,8 @@ void EETest::createNewUI() {
|
||||
UIWindow* MenuCont = UIWindow::New();
|
||||
MenuCont->setPosition( 350, 390 )->setSize( 200, 115 );
|
||||
|
||||
UIWinMenu* WinMenu = UIWinMenu::New();
|
||||
WinMenu->setParent( MenuCont->getContainer() );
|
||||
UIMenuBar* MenuBar = UIMenuBar::New();
|
||||
MenuBar->setParent( MenuCont->getContainer() );
|
||||
|
||||
UIPopUpMenu* PopMenu = UIPopUpMenu::New();
|
||||
PopMenu->add( "File" );
|
||||
@@ -830,8 +830,8 @@ void EETest::createNewUI() {
|
||||
PopMenu2->add( "Bla 3" );
|
||||
PopMenu2->add( "Bla 4" );
|
||||
|
||||
WinMenu->addMenuButton( "File", PopMenu );
|
||||
WinMenu->addMenuButton( "Edit", PopMenu2 );
|
||||
MenuBar->addMenuButton( "File", PopMenu );
|
||||
MenuBar->addMenuButton( "Edit", PopMenu2 );
|
||||
|
||||
UIWindow* win = UIWindow::New();
|
||||
win->setSize( 500, 500 );
|
||||
@@ -1079,8 +1079,8 @@ void EETest::createDecoratedWindow() {
|
||||
lay->setLayoutSizePolicy( SizePolicy::MatchParent, SizePolicy::MatchParent );
|
||||
lay->setParent( mUIWindow->getContainer() );
|
||||
|
||||
UIWinMenu* WinMenu = UIWinMenu::New();
|
||||
WinMenu->setLayoutSizePolicy( SizePolicy::MatchParent, SizePolicy::WrapContent )
|
||||
UIMenuBar* MenuBar = UIMenuBar::New();
|
||||
MenuBar->setLayoutSizePolicy( SizePolicy::MatchParent, SizePolicy::WrapContent )
|
||||
->setParent( lay );
|
||||
|
||||
UIPopUpMenu* PopMenu = UIPopUpMenu::New();
|
||||
@@ -1124,8 +1124,8 @@ void EETest::createDecoratedWindow() {
|
||||
PopMenu2->add( "Bla 3" );
|
||||
PopMenu2->add( "Bla 4" );
|
||||
|
||||
WinMenu->addMenuButton( "File", PopMenu );
|
||||
WinMenu->addMenuButton( "Edit", PopMenu2 );
|
||||
MenuBar->addMenuButton( "File", PopMenu );
|
||||
MenuBar->addMenuButton( "Edit", PopMenu2 );
|
||||
|
||||
UIPushButton* Button = UIPushButton::New();
|
||||
Button->setLayoutMargin( Rect( 5, 5, 5, 5 ) );
|
||||
|
||||
@@ -45,7 +45,7 @@ UIMessageBox* MsgBox = NULL;
|
||||
efsw::FileWatcher* fileWatcher = NULL;
|
||||
UITheme* theme = NULL;
|
||||
UIWindow* uiContainer = NULL;
|
||||
UIWinMenu* uiWinMenu = NULL;
|
||||
UIMenuBar* uiMenuBar = NULL;
|
||||
UISceneNode* uiSceneNode = NULL;
|
||||
UISceneNode* appUiSceneNode = NULL;
|
||||
std::string currentLayout;
|
||||
@@ -321,10 +321,10 @@ void onRecentFilesClick( const Event* event ) {
|
||||
void updateRecentFiles() {
|
||||
SceneManager::instance()->setCurrentUISceneNode( appUiSceneNode );
|
||||
|
||||
if ( NULL == uiWinMenu )
|
||||
if ( NULL == uiMenuBar )
|
||||
return;
|
||||
|
||||
UIPopUpMenu* fileMenu = uiWinMenu->getPopUpMenu( "File" );
|
||||
UIPopUpMenu* fileMenu = uiMenuBar->getPopUpMenu( "File" );
|
||||
|
||||
UINode* node = NULL;
|
||||
|
||||
@@ -352,10 +352,10 @@ void updateRecentFiles() {
|
||||
void updateRecentProjects() {
|
||||
SceneManager::instance()->setCurrentUISceneNode( appUiSceneNode );
|
||||
|
||||
if ( NULL == uiWinMenu )
|
||||
if ( NULL == uiMenuBar )
|
||||
return;
|
||||
|
||||
UIPopUpMenu* fileMenu = uiWinMenu->getPopUpMenu( "File" );
|
||||
UIPopUpMenu* fileMenu = uiMenuBar->getPopUpMenu( "File" );
|
||||
|
||||
UINode* node = NULL;
|
||||
|
||||
@@ -456,7 +456,7 @@ void onLayoutSelected( const Event* event ) {
|
||||
|
||||
UIPopUpMenu* uiLayoutsMenu;
|
||||
|
||||
if ( ( uiLayoutsMenu = uiWinMenu->getPopUpMenu( "Layouts" ) ) &&
|
||||
if ( ( uiLayoutsMenu = uiMenuBar->getPopUpMenu( "Layouts" ) ) &&
|
||||
uiLayoutsMenu->getCount() > 0 ) {
|
||||
for ( size_t i = 0; i < uiLayoutsMenu->getCount(); i++ ) {
|
||||
UIMenuCheckBox* menuItem = static_cast<UIMenuCheckBox*>( uiLayoutsMenu->getItem( i ) );
|
||||
@@ -475,7 +475,7 @@ void onLayoutSelected( const Event* event ) {
|
||||
}
|
||||
|
||||
void refreshLayoutList() {
|
||||
if ( NULL == uiWinMenu )
|
||||
if ( NULL == uiMenuBar )
|
||||
return;
|
||||
|
||||
SceneManager::instance()->setCurrentUISceneNode( appUiSceneNode );
|
||||
@@ -483,14 +483,14 @@ void refreshLayoutList() {
|
||||
if ( layouts.size() > 0 ) {
|
||||
UIPopUpMenu* uiLayoutsMenu = NULL;
|
||||
|
||||
if ( uiWinMenu->getButton( "Layouts" ) == NULL ) {
|
||||
if ( uiMenuBar->getButton( "Layouts" ) == NULL ) {
|
||||
uiLayoutsMenu = UIPopUpMenu::New();
|
||||
|
||||
uiWinMenu->addMenuButton( "Layouts", uiLayoutsMenu );
|
||||
uiMenuBar->addMenuButton( "Layouts", uiLayoutsMenu );
|
||||
|
||||
uiLayoutsMenu->addEventListener( Event::OnItemClicked, cb::Make1( &onLayoutSelected ) );
|
||||
} else {
|
||||
uiLayoutsMenu = uiWinMenu->getPopUpMenu( "Layouts" );
|
||||
uiLayoutsMenu = uiMenuBar->getPopUpMenu( "Layouts" );
|
||||
}
|
||||
|
||||
uiLayoutsMenu->removeAll();
|
||||
@@ -501,8 +501,8 @@ void refreshLayoutList() {
|
||||
|
||||
chk->setActive( currentLayout == it->second );
|
||||
}
|
||||
} else if ( uiWinMenu->getButton( "Layouts" ) != NULL ) {
|
||||
uiWinMenu->removeMenuButton( "Layouts" );
|
||||
} else if ( uiMenuBar->getButton( "Layouts" ) != NULL ) {
|
||||
uiMenuBar->removeMenuButton( "Layouts" );
|
||||
}
|
||||
|
||||
SceneManager::instance()->setCurrentUISceneNode( uiSceneNode );
|
||||
@@ -778,13 +778,13 @@ void mainLoop() {
|
||||
mousePos = window->getInput()->getMousePos();
|
||||
mouseClock.restart();
|
||||
|
||||
if ( uiWinMenu->getAlpha() != 255 && uiWinMenu->getActionManager()->isEmpty() ) {
|
||||
uiWinMenu->runAction(
|
||||
Actions::Fade::New( uiWinMenu->getAlpha(), 255, Milliseconds( 250 ) ) );
|
||||
if ( uiMenuBar->getAlpha() != 255 && uiMenuBar->getActionManager()->isEmpty() ) {
|
||||
uiMenuBar->runAction(
|
||||
Actions::Fade::New( uiMenuBar->getAlpha(), 255, Milliseconds( 250 ) ) );
|
||||
}
|
||||
} else if ( mouseClock.getElapsedTime() > Seconds( 1 ) ) {
|
||||
if ( uiWinMenu->getAlpha() == 255 && uiWinMenu->getActionManager()->isEmpty() ) {
|
||||
uiWinMenu->runAction( Actions::Fade::New( 255, 0, Milliseconds( 250 ) ) );
|
||||
if ( uiMenuBar->getAlpha() == 255 && uiMenuBar->getActionManager()->isEmpty() ) {
|
||||
uiMenuBar->runAction( Actions::Fade::New( 255, 0, Milliseconds( 250 ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -894,7 +894,7 @@ void fileMenuClick( const Event* event ) {
|
||||
void createAppMenu() {
|
||||
SceneManager::instance()->setCurrentUISceneNode( appUiSceneNode );
|
||||
|
||||
uiWinMenu = UIWinMenu::New();
|
||||
uiMenuBar = UIMenuBar::New();
|
||||
|
||||
UIPopUpMenu* uiPopMenu = UIPopUpMenu::New();
|
||||
uiPopMenu->add( "Open project...", theme->getIconByName( "document-open" ) );
|
||||
@@ -907,7 +907,7 @@ void createAppMenu() {
|
||||
uiPopMenu->add( "Close", theme->getIconByName( "document-close" ) );
|
||||
uiPopMenu->addSeparator();
|
||||
uiPopMenu->add( "Quit", theme->getIconByName( "quit" ) );
|
||||
uiWinMenu->addMenuButton( "File", uiPopMenu );
|
||||
uiMenuBar->addMenuButton( "File", uiPopMenu );
|
||||
uiPopMenu->addEventListener( Event::OnItemClicked, cb::Make1( fileMenuClick ) );
|
||||
|
||||
UIPopUpMenu* uiResourceMenu = UIPopUpMenu::New();
|
||||
@@ -916,7 +916,7 @@ void createAppMenu() {
|
||||
uiResourceMenu->add( "Load fonts from path...", theme->getIconByName( "document-open" ) );
|
||||
uiResourceMenu->addSeparator();
|
||||
uiResourceMenu->add( "Load style sheet from path...", theme->getIconByName( "document-open" ) );
|
||||
uiWinMenu->addMenuButton( "Resources", uiResourceMenu );
|
||||
uiMenuBar->addMenuButton( "Resources", uiResourceMenu );
|
||||
uiResourceMenu->addEventListener( Event::OnItemClicked, cb::Make1( fileMenuClick ) );
|
||||
|
||||
SceneManager::instance()->setCurrentUISceneNode( uiSceneNode );
|
||||
|
||||