Mercurial > projects > mde
diff mde/gui/widget/Ifaces.d @ 113:9824bee909fd
Popup menu; works for simple menus except that clicking an item doesn't close it.
Revised popup support a bit; EnumContentWidget is broken and due to be replaced.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Fri, 19 Dec 2008 10:32:28 +0000 |
parents | fe061009029d |
children | 1b1e2297e2fc |
line wrap: on
line diff
--- a/mde/gui/widget/Ifaces.d Sat Dec 13 12:54:43 2008 +0000 +++ b/mde/gui/widget/Ifaces.d Fri Dec 19 10:32:28 2008 +0000 @@ -89,9 +89,12 @@ * provides the possibility of per-window renderers (if desired). */ IRenderer renderer (); - /** Add/remove a pop-up [menu] to be drawn. */ - void addPopup (wdabs x, wdabs y, IChildWidget popup); - void removePopup (IChildWidget popup); /// ditto + /** Add/remove a pop-up widget to be drawn. + * + * Place popup as close to x,y as possible, or + * place popup next to parent (usually below). */ + void addPopup (IChildWidget parent, IChildWidget popup); + //void removePopup (IChildWidget popup); Possibly useful later. // User input: /** Add a mouse click callback. @@ -100,10 +103,7 @@ * simply all click events on the widget (as clickEvent recieves). * * The delegate should return true if it accepts the event and no further processing is - * required (i.e. the event should not be handled by anything else), false otherwise. - * - * Note that this is not a mechanism to prevent unwanted event handling, and in the future - * may be removed (so event handling cannot be cut short). */ + * required (i.e. the event should not be handled by anything else), false otherwise. */ void addClickCallback (bool delegate (wdabs cx, wdabs cy, ubyte b, bool state) dg); /** Add a mouse motion callback: delegate will be called for all motion events recieved by the @@ -205,6 +205,10 @@ wdim width (); wdim height(); /// ditto + /** (Smallest) coordinates of widget. */ + wdabs xPos (); + wdabs yPos (); /// ditto + /** Used to adjust the size. * * Params: @@ -236,7 +240,7 @@ * (x,y). * * Note: use global coordinates (x,y) not coordinates relative to the widget. */ - IChildWidget getWidget (wdim x, wdim y); + IChildWidget getWidget (wdabs x, wdabs y); /** Receive a mouse click event at cx,cy from button b (1-5 correspond to L,M,B, wheel up,down) * which is a down-click if state is true. @@ -255,6 +259,14 @@ /** Called when keyboard input focus is lost. */ void keyFocusLost (); + + /** Called when the mouse moves over the button and when it leaves. No need to call + * requestRedraw. */ + void highlight (bool state); + + /** After adding a pop-up widget with mgr.addPopup(this,popupWidget), when that pop-up closes + * the manager calls requestRedraw, clickEvent if applicable, and then this function. */ + void popupRemoved (); //END Events /** Draw, using the stored values of x and y.