Mercurial > projects > mde
comparison mde/gui/widget/ParentContent.d @ 152:c67d074a7111
Menu placement now takes into account left/right placement of parent menus.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Fri, 10 Apr 2009 15:19:46 +0200 |
parents | 075705ad664a |
children | 4e8819b65882 |
comparison
equal
deleted
inserted
replaced
151:e785e98d3b78 | 152:c67d074a7111 |
---|---|
74 | 74 |
75 override int clickEvent (wdabs, wdabs, ubyte b, bool state) { | 75 override int clickEvent (wdabs, wdabs, ubyte b, bool state) { |
76 if (b == 1 && state == true) { | 76 if (b == 1 && state == true) { |
77 if (!pushed) { | 77 if (!pushed) { |
78 parentIPPW.addChildIPPW (this); | 78 parentIPPW.addChildIPPW (this); |
79 parentIPPW.menuActive = true; | 79 parentIPPW.menuActive = mgr.positionPopup (this, popup); |
80 if (popup.width != w && popup.minWidth <= w) | |
81 popup.setWidth (w, -1); // neatness | |
82 mgr.positionPopup (this, popup); | |
83 pushed = true; | 80 pushed = true; |
84 } else if (!parentIPPW.parentMenuActive) { // if not a submenu | 81 } else if (!parentIPPW.parentMenuActive) { // if not a submenu |
85 parentIPPW.removeChildIPPW (this); | 82 parentIPPW.removeChildIPPW (this); |
86 } | 83 } |
87 } | 84 } |
94 } | 91 } |
95 | 92 |
96 override void underMouse (bool state) { | 93 override void underMouse (bool state) { |
97 if (state && !pushed && parentIPPW.menuActive) { | 94 if (state && !pushed && parentIPPW.menuActive) { |
98 parentIPPW.addChildIPPW (this); | 95 parentIPPW.addChildIPPW (this); |
99 menuActive = true; | 96 menuActive = mgr.positionPopup (this, popup, parentIPPW.parentMenuActive); |
100 if (parentIPPW.parentMenuActive) | |
101 mgr.positionPopup (this, popup, 1); | |
102 else { | |
103 if (popup.width != w && popup.minWidth <= w) | |
104 popup.setWidth (w, -1); // neatness | |
105 mgr.positionPopup (this, popup); | |
106 } | |
107 pushed = true; | 97 pushed = true; |
108 } | 98 } |
109 } | 99 } |
110 | 100 |
111 override void draw () { | 101 override void draw () { |