Mercurial > projects > mde
comparison mde/gui/widget/Popup.d @ 108:c9fc2d303178
Added capability for border-less pop-up widgets. Simple pop-up menu.
Removed grid-layout spacing (may allow any widget to provide spacing later).
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Wed, 03 Dec 2008 19:37:32 +0000 |
parents | |
children | 1655693702fc |
comparison
equal
deleted
inserted
replaced
107:20f7d813bb0f | 108:c9fc2d303178 |
---|---|
1 /* LICENSE BLOCK | |
2 Part of mde: a Modular D game-oriented Engine | |
3 Copyright © 2007-2008 Diggory Hardy | |
4 | |
5 This program is free software: you can redistribute it and/or modify it under the terms | |
6 of the GNU General Public License as published by the Free Software Foundation, either | |
7 version 2 of the License, or (at your option) any later version. | |
8 | |
9 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | |
10 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
11 See the GNU General Public License for more details. | |
12 | |
13 You should have received a copy of the GNU General Public License | |
14 along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
15 | |
16 /// Pop-up widgets. | |
17 module mde.gui.widget.Popup; | |
18 | |
19 import mde.gui.widget.Widget; | |
20 import mde.content.Content; | |
21 | |
22 /** Shows a "pop-up" widget tree when clicked. */ | |
23 class PopupButtonWidget : AButtonWidget | |
24 { | |
25 this (IWidgetManager mgr, widgetID id, WidgetData data, IContent content) { | |
26 WDCheck (data, 1,2); | |
27 subWidget = mgr.makeWidget (data.strings[0], content); | |
28 | |
29 adapter = mgr.renderer.getAdapter (data.strings[1]); | |
30 adapter.getDimensions (mw, mh); | |
31 w = mw; | |
32 h = mh; | |
33 super (mgr, id, data); | |
34 } | |
35 | |
36 void activated () { | |
37 mgr.addPopup (x,y, subWidget); | |
38 } | |
39 | |
40 void draw () { | |
41 super.draw (); | |
42 adapter.draw (x,y); | |
43 } | |
44 | |
45 protected: | |
46 IChildWidget subWidget; | |
47 | |
48 IRenderer.TextAdapter adapter; | |
49 } |