# HG changeset patch # User Diggory Hardy # Date 1246293958 -7200 # Node ID da8d3091fdaf71cefdc0e184911b370eb53f7e2b # Parent 620d4ea30228d2ef59957efae65b331fe4f0cc85 More work on the context menu: now roughly usable like an ordinary context menu. diff -r 620d4ea30228 -r da8d3091fdaf codeDoc/ideas.txt --- a/codeDoc/ideas.txt Sat Jun 27 11:57:26 2009 +0200 +++ b/codeDoc/ideas.txt Mon Jun 29 18:45:58 2009 +0200 @@ -82,6 +82,7 @@ > Context menus: > Context menu serves (editable?) content most directly under mouse cursor > plus content higher up widget tree? + > "Drag" option to drag from, instead of widget itself? > Non-static content manager > Separate managers for options, GUI symbols, data fields, passwords(?) > Optional saving/loading diff -r 620d4ea30228 -r da8d3091fdaf codeDoc/jobs.txt --- a/codeDoc/jobs.txt Sat Jun 27 11:57:26 2009 +0200 +++ b/codeDoc/jobs.txt Mon Jun 29 18:45:58 2009 +0200 @@ -3,11 +3,12 @@ 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): Also search for FIXME/NOTE/BUG/WARNING comment marks. +4 Should only have one instance of context menu widgets. Service menu callbacks don't get removed! 3 Dragging and dropping of editable data: should content immediately appear as being dragged? 3 Dragging from anything other than AStringContentWidget. 3 Single-line edit: pressing return should lose keyboard focus and change value diff -r 620d4ea30228 -r da8d3091fdaf data/conf/guiDemo.mtt --- a/data/conf/guiDemo.mtt Sat Jun 27 11:57:26 2009 +0200 +++ b/data/conf/guiDemo.mtt Mon Jun 29 18:45:58 2009 +0200 @@ -44,7 +44,9 @@ - - + + + + {Basic} diff -r 620d4ea30228 -r da8d3091fdaf mde/content/Content.d --- a/mde/content/Content.d Sat Jun 27 11:57:26 2009 +0200 +++ b/mde/content/Content.d Mon Jun 29 18:45:58 2009 +0200 @@ -1,6 +1,6 @@ /* LICENSE BLOCK Part of mde: a Modular D game-oriented Engine -Copyright © 2007-2008 Diggory Hardy +Copyright © 2007-2009 Diggory Hardy This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either diff -r 620d4ea30228 -r da8d3091fdaf mde/gui/WidgetManager.d --- a/mde/gui/WidgetManager.d Sat Jun 27 11:57:26 2009 +0200 +++ b/mde/gui/WidgetManager.d Mon Jun 29 18:45:58 2009 +0200 @@ -31,6 +31,7 @@ import mde.content.Content; import mde.content.ServiceContent; debug import mde.content.miscContent; // Debug menu +debug import mde.content.Debug; // Widgets to create: import mde.gui.widget.layout; @@ -157,7 +158,7 @@ override IChildWidget getPopupWidget (wdabs cx, wdabs cy, bool closePopup) { if (popupContext) { if (popupContext.onSelf (cx, cy)) - return popupContext; + return popupContext.getWidget (cx, cy); if (closePopup) { if (childIPPW is null) menuActive = MenuPosition.INACTIVE; @@ -334,6 +335,7 @@ popupContext = makeWidget (this, "context", contextContent); popupContext.setup (0, 3); positionPopup (underMouse, popupContext); + menuActive = MenuPosition.ACTIVE; requestRedraw; } else { // post other button presses to clickEvent int ret = underMouse.clickEvent (cast(wdabs)cx,cast(wdabs)cy,b,state); @@ -384,6 +386,8 @@ child.setWidth (w, -1); child.setHeight (h, -1); child.setPosition (0,0); + popupContext.setup (setupN, 2); + //NOTE: does popupContext need to be re-scaled? requestRedraw; } } @@ -399,6 +403,8 @@ debug assert (oUM && underMouse, "no widget under mouse: error"); oUM.underMouse (false); underMouse.underMouse (true); + debug if (Debug.logUnderMouse()) + logger.trace ("Widget under mouse: {}", underMouse); } } diff -r 620d4ea30228 -r da8d3091fdaf mde/gui/widget/ParentContent.d --- a/mde/gui/widget/ParentContent.d Sat Jun 27 11:57:26 2009 +0200 +++ b/mde/gui/widget/ParentContent.d Mon Jun 29 18:45:58 2009 +0200 @@ -423,7 +423,7 @@ debug assert (cx >= x && cx < x + w && cy >= y && cy < y + h, "getWidget: not on widget (code error)"); if (subWidgets[0].onSelf (cx, cy)) - return subWidgets[0]; + return subWidgets[0].getWidget (cx, cy); else return this; } diff -r 620d4ea30228 -r da8d3091fdaf mde/gui/widget/layout.d --- a/mde/gui/widget/layout.d Sat Jun 27 11:57:26 2009 +0200 +++ b/mde/gui/widget/layout.d Mon Jun 29 18:45:58 2009 +0200 @@ -156,8 +156,8 @@ * * Several flags are tested against ints[1]: * $(TABLE - * $(TR $(TD 1) $(TD Column alignment is shared against other instances of thes widget id)) - * $(TR $(TD 2) $(TD Row alignment is shared against other instances of thes widget id)) + * $(TR $(TD 1) $(TD Column alignment is shared against other instances of this widget id)) + * $(TR $(TD 2) $(TD Row alignment is shared against other instances of this widget id)) * $(TR $(TD 4) $(TD Spacing is inserted between elements; the renderer may draw this)) * $(TR $(TD 8) $(TD For ContentListWidget only, list is horizontal instead of vertical)) * )