mirror of https://github.com/buggins/dlangui.git
fixes
This commit is contained in:
parent
321e657661
commit
f35b63ef95
|
@ -53,6 +53,13 @@ extern (C) int UIAppMain(string[] args) {
|
||||||
MenuItem fileItem = new MenuItem(new Action(1, "File"d));
|
MenuItem fileItem = new MenuItem(new Action(1, "File"d));
|
||||||
fileItem.add(new Action(10, "Open..."d));
|
fileItem.add(new Action(10, "Open..."d));
|
||||||
fileItem.add(new Action(11, "Save..."d));
|
fileItem.add(new Action(11, "Save..."d));
|
||||||
|
MenuItem openRecentItem = new MenuItem(new Action(13, "Open recent..."d));
|
||||||
|
openRecentItem.add(new Action(100, "File 1"d));
|
||||||
|
openRecentItem.add(new Action(101, "File 2"d));
|
||||||
|
openRecentItem.add(new Action(102, "File 3"d));
|
||||||
|
openRecentItem.add(new Action(103, "File 4"d));
|
||||||
|
openRecentItem.add(new Action(104, "File 5"d));
|
||||||
|
fileItem.add(openRecentItem);
|
||||||
fileItem.add(new Action(12, "Exit"d));
|
fileItem.add(new Action(12, "Exit"d));
|
||||||
MenuItem editItem = new MenuItem(new Action(2, "Edit"d));
|
MenuItem editItem = new MenuItem(new Action(2, "Edit"d));
|
||||||
editItem.add(new Action(20, "Copy"d));
|
editItem.add(new Action(20, "Copy"d));
|
||||||
|
|
|
@ -113,7 +113,7 @@ class MenuWidgetBase : ListWidget {
|
||||||
_openedPopup.close();
|
_openedPopup.close();
|
||||||
}
|
}
|
||||||
PopupMenu popupMenu = new PopupMenu(itemWidget.item, this);
|
PopupMenu popupMenu = new PopupMenu(itemWidget.item, this);
|
||||||
PopupWidget popup = window.showPopup(popupMenu, itemWidget, PopupAlign.Below);
|
PopupWidget popup = window.showPopup(popupMenu, itemWidget, orientation == Orientation.Horizontal ? PopupAlign.Below : PopupAlign.Right);
|
||||||
popup.onPopupCloseListener = &onPopupClosed;
|
popup.onPopupCloseListener = &onPopupClosed;
|
||||||
popup.flags = PopupFlags.CloseOnClickOutside;
|
popup.flags = PopupFlags.CloseOnClickOutside;
|
||||||
_openedPopup = popup;
|
_openedPopup = popup;
|
||||||
|
|
|
@ -10,6 +10,8 @@ enum PopupAlign : uint {
|
||||||
Center = 1,
|
Center = 1,
|
||||||
/// place popup below anchor widget close to lower bound
|
/// place popup below anchor widget close to lower bound
|
||||||
Below = 2,
|
Below = 2,
|
||||||
|
/// place popup below anchor widget close to right bound (when no space enough, align near left bound)
|
||||||
|
Right = 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PopupAnchor {
|
struct PopupAnchor {
|
||||||
|
@ -90,6 +92,9 @@ class PopupWidget : LinearLayout {
|
||||||
} else if (anchor.alignment & PopupAlign.Below) {
|
} else if (anchor.alignment & PopupAlign.Below) {
|
||||||
r.left = anchorrc.left;
|
r.left = anchorrc.left;
|
||||||
r.top = anchorrc.bottom;
|
r.top = anchorrc.bottom;
|
||||||
|
} else if (anchor.alignment & PopupAlign.Right) {
|
||||||
|
r.left = anchorrc.right;
|
||||||
|
r.top = anchorrc.top;
|
||||||
}
|
}
|
||||||
r.right = r.left + w;
|
r.right = r.left + w;
|
||||||
r.bottom = r.top + h;
|
r.bottom = r.top + h;
|
||||||
|
|
Loading…
Reference in New Issue