Fixes issue 1928
Patch by: jlabanca
Review by: ecc
Description:
Add unique style names for vertical and horizontal menu vars and adjusts child menu layout.
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@1669 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/client/ui/MenuBar.java b/user/src/com/google/gwt/user/client/ui/MenuBar.java
index 24fe58c..440529d 100644
--- a/user/src/com/google/gwt/user/client/ui/MenuBar.java
+++ b/user/src/com/google/gwt/user/client/ui/MenuBar.java
@@ -36,6 +36,8 @@
* <h3>CSS Style Rules</h3>
* <ul class='css'>
* <li>.gwt-MenuBar { the menu bar itself }</li>
+ * <li>.gwt-MenuBar-Horizontal { applied to horizontal menu bars }</li>
+ * <li>.gwt-MenuBar-Vertical { applied to vertical menu bars }</li>
* <li>.gwt-MenuBar .gwt-MenuItem { menu items }</li>
* <li>.gwt-MenuBar .gwt-MenuItem-selected { selected menu items }</li>
* </ul>
@@ -87,6 +89,11 @@
sinkEvents(Event.ONCLICK | Event.ONMOUSEOVER | Event.ONMOUSEOUT);
setStyleName("gwt-MenuBar");
+ if (vertical) {
+ addStyleName("gwt-MenuBar-Vertical");
+ } else {
+ addStyleName("gwt-MenuBar-Horizontal");
+ }
}
/**
@@ -379,11 +386,11 @@
popup.addPopupListener(this);
if (vertical) {
- popup.setPopupPosition(item.getAbsoluteLeft() + item.getOffsetWidth(),
+ popup.setPopupPosition(this.getAbsoluteLeft() + this.getOffsetWidth() - 1,
item.getAbsoluteTop());
} else {
- popup.setPopupPosition(item.getAbsoluteLeft(), item.getAbsoluteTop()
- + item.getOffsetHeight());
+ popup.setPopupPosition(item.getAbsoluteLeft(), this.getAbsoluteTop()
+ + this.getOffsetHeight() - 1);
}
shownChildMenu = item.getSubMenu();