Mercurial > projects > mde
changeset 169:bc1cf73dc835
Context menu refinements: right button click-drag-release use and closing via buttons.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Mon, 29 Jun 2009 18:55:50 +0200 |
parents | da8d3091fdaf |
children | e45226d3deae |
files | codeDoc/jobs.txt mde/gui/WidgetManager.d mde/gui/widget/AChildWidget.d |
diffstat | 3 files changed, 12 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/codeDoc/jobs.txt Mon Jun 29 18:45:58 2009 +0200 +++ b/codeDoc/jobs.txt Mon Jun 29 18:55:50 2009 +0200 @@ -3,7 +3,7 @@ In progress: -Adding context menu. Why doesn't clicking button close? + To do (importance 0-5: 0 pointless, 1 no obvious impact now, 2 todo sometime, 3 useful, 4 important, 5 urgent):
--- a/mde/gui/WidgetManager.d Mon Jun 29 18:45:58 2009 +0200 +++ b/mde/gui/WidgetManager.d Mon Jun 29 18:55:50 2009 +0200 @@ -152,8 +152,13 @@ return MenuPosition.INACTIVE; } - // Don't do anything. E.g. can get called by non-popup buttons. - override void menuDone () {} + override void menuDone () { + // close context menu, but not childIPPW + if (childIPPW is null) + menuActive = MenuPosition.INACTIVE; + popupContext = null; + requestRedraw; + } override IChildWidget getPopupWidget (wdabs cx, wdabs cy, bool closePopup) { if (popupContext) { @@ -327,7 +332,8 @@ } // Finally, post the actual event: - if (b == 3 && !state) { // right click - open context menu + if (b == 3 && state) { // right click - open context menu + if (popupContext !is null) return; Content contextContent = cast(Content)underMouse.content; if (contextContent is null) return; // NOTE: Creates new widgets every time; not optimal
--- a/mde/gui/widget/AChildWidget.d Mon Jun 29 18:45:58 2009 +0200 +++ b/mde/gui/widget/AChildWidget.d Mon Jun 29 18:55:50 2009 +0200 @@ -267,11 +267,10 @@ /// Handles the down-click override int clickEvent (wdabs, wdabs, ubyte b, bool state) { - if (b != 1) return 0; - if (parentIPPW.menuActive) { + if (parentIPPW.menuActive && b == 1 || b == 3) { parentIPPW.menuDone; activated; - } else if (state) { + } else if (state && b == 1) { pushed = true; mgr.requestRedraw; return 2;