Просмотр исходного кода

MenuBar hooked up, for the most part

Marko Pintera 12 лет назад
Родитель
Сommit
3e18542dcb

+ 4 - 0
BansheeEngine/Source/BsEngineGUI.cpp

@@ -661,6 +661,10 @@ namespace BansheeEngine
 		menuBarBtnStyle.fixedWidth = false;
 		menuBarBtnStyle.height = 15;
 		menuBarBtnStyle.width = 4;
+		menuBarBtnStyle.margins.left = 2;
+		menuBarBtnStyle.margins.right = 2;
+		menuBarBtnStyle.margins.top = 2;
+		menuBarBtnStyle.margins.bottom = 2;
 		menuBarBtnStyle.font = font;
 		menuBarBtnStyle.fontSize = DefaultFontSize;
 		menuBarBtnStyle.textHorzAlign = THA_Left;

+ 1 - 1
BansheeEngine/Source/BsGUIManager.cpp

@@ -557,7 +557,7 @@ namespace BansheeEngine
 		GUIWidget& widget = parentButton->_getParentWidget();
 
 		mDropDownBox->initialize(widget.getTarget(), widget.getOwnerWindow(), 
-			GUIDropDownAreaPlacement::aroundBoundsVert(parentButton->getBounds()), dropDownData, widget.getSkin(), GUIDropDownType::MenuBar);
+			GUIDropDownAreaPlacement::aroundBoundsHorz(parentButton->getBounds()), dropDownData, widget.getSkin(), GUIDropDownType::MenuBar);
 
 		mDropDownBoxOpenScheduled = true;
 	}

+ 3 - 0
BansheeEngine/Source/BsGUIMenu.cpp

@@ -82,6 +82,9 @@ namespace BansheeEngine
 		GUIMenuItem* curSubMenu = &mRootElement;
 		for(UINT32 i = 0; i < (UINT32)pathElements.size(); i++)
 		{
+			if(pathElements[i] == L"")
+				continue;
+
 			const WString& pathElem = *(pathElements.begin() + i);
 			GUIMenuItem* existingItem = curSubMenu->findChild(pathElem);
 

+ 4 - 2
CamelotClient/Source/BsGUIMenuBar.cpp

@@ -25,6 +25,7 @@ namespace BansheeEditor
 
 		mLogoTexture = GUITexture::create(*parent, GUIImageScaleMode::StretchToFit, EngineGUI::instance().getSkin().getStyle("MenuBarBansheeLogo"));
 		mMainArea->getLayout().addElement(mLogoTexture);
+		mMainArea->getLayout().addSpace(5);
 		mMainArea->getLayout().addFlexibleSpace();
 	}
 
@@ -70,6 +71,7 @@ namespace BansheeEditor
 			newSubMenu.menu = cm_new<GUIMenu>();
 
 			GUIButton* newButton = GUIButton::create(*mParentWidget, rootName, EngineGUI::instance().getSkin().getStyle("MenuBarBtn"));
+			newButton->onClick.connect(boost::bind(&GUIMenuBar::openSubMenu, this, rootName));
 			mMainArea->getLayout().insertElement(mMainArea->getLayout().getNumChildren() - 1, newButton);
 
 			newSubMenu.button = newButton;
@@ -97,9 +99,9 @@ namespace BansheeEditor
 			newSubMenu.name = rootName;
 			newSubMenu.menu = cm_new<GUIMenu>();
 
-			GUIButton* newButton = GUIButton::create(*mParentWidget, rootName);
+			GUIButton* newButton = GUIButton::create(*mParentWidget, rootName, EngineGUI::instance().getSkin().getStyle("MenuBarBtn"));
 			newButton->onClick.connect(boost::bind(&GUIMenuBar::openSubMenu, this, rootName));
-			mMainArea->getLayout().addElement(newButton);
+			mMainArea->getLayout().insertElement(mMainArea->getLayout().getNumChildren() - 1, newButton);
 
 			newSubMenu.button = newButton;
 

+ 4 - 0
CamelotClient/Source/BsMainEditorWindow.cpp

@@ -25,6 +25,10 @@ namespace BansheeEditor
 		mMenuBar->addMenuItem(L"File/New project", nullptr);
 		mMenuBar->addMenuItem(L"File/Open project", nullptr);
 		mMenuBar->addSeparator(L"File");
+		mMenuBar->addMenuItem(L"File/Recent projects/Project A", nullptr);
+		mMenuBar->addMenuItem(L"File/Recent projects/Project B", nullptr);
+		mMenuBar->addMenuItem(L"File/Recent projects/Project C", nullptr);
+		mMenuBar->addSeparator(L"File");
 		mMenuBar->addMenuItem(L"File/Exit", nullptr);
 
 		// DEBUG ONLY

+ 3 - 10
DropDown.txt

@@ -2,19 +2,12 @@ GUI ignores image in GUIContent for most elements.
 
 Doesn't belong here but as an additional reminder: Remove Component::initialize and instead make multi paramter addComponent
 
+There seems to be a depth issue between menu items and GUIRenderTexture
+When I have a sub-menu open, mousing over any other entry button should close the sub-menu
+
 Add min/max/close buttons to GUIMenuBar
 Setup move areas in GUIMenuBar
 
 ListBox: Clicking on ListBox once the DropDownBox is open should close the drop down box (I assume it does, it just re-opens it immediately again?)
 
-GUIMenuBar
- - It has a specific position, width and height
- - It was a GUIArea and its root elements are represented as buttons
-   - CLicking on a button will open up the menu, similar to context menu
-   - GUIManager::openMenu(Vector<GUIDropDownData>, GUIElement* parent)
-
-Test separators
-Test expandable buttons
- - And hook up on mouse over
- - ALSO I need to close other menu at the same level upon mouse over on another element
 Test scrollUp/scrollDown