annotate mde/gui/widget/miscWidgets.d @ 116:5ee69b3ed9c9

Partial implementation of infinite widget recursion protection; some cleanup. Implemented recursion protection which only allowed unsafe widgets to be instantiated once; realised this was far too restrictive (multiple sibling instances are needed) and a check against parent widgets would be needed. Could be implemented by passing widgets a reference to parents. Removed ButtonWidget aka First interactible widget.
author Diggory Hardy <diggory.hardy@gmail.com>
date Sun, 21 Dec 2008 12:03:50 +0000
parents b16a534f5302
children 5b37d0400732
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
45
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
1 /* LICENSE BLOCK
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
2 Part of mde: a Modular D game-oriented Engine
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
3 Copyright © 2007-2008 Diggory Hardy
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
4
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
5 This program is free software: you can redistribute it and/or modify it under the terms
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
6 of the GNU General Public License as published by the Free Software Foundation, either
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
7 version 2 of the License, or (at your option) any later version.
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
8
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
10 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
11 See the GNU General Public License for more details.
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
12
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
13 You should have received a copy of the GNU General Public License
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
14 along with this program. If not, see <http://www.gnu.org/licenses/>. */
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
15
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
16 /** Some GUI Miscelaneas widgets. */
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
17 module mde.gui.widget.miscWidgets;
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
18
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
19 import mde.gui.widget.Widget;
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
20 import mde.gui.exception;
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
21 import mde.gui.renderer.IRenderer;
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
22
116
5ee69b3ed9c9 Partial implementation of infinite widget recursion protection; some cleanup.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 114
diff changeset
23 import tango.util.log.Log : Log, Logger;
5ee69b3ed9c9 Partial implementation of infinite widget recursion protection; some cleanup.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 114
diff changeset
24
5ee69b3ed9c9 Partial implementation of infinite widget recursion protection; some cleanup.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 114
diff changeset
25 private Logger logger;
5ee69b3ed9c9 Partial implementation of infinite widget recursion protection; some cleanup.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 114
diff changeset
26 static this () {
5ee69b3ed9c9 Partial implementation of infinite widget recursion protection; some cleanup.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 114
diff changeset
27 logger = Log.getLogger ("mde.gui.widget.miscWidgets");
5ee69b3ed9c9 Partial implementation of infinite widget recursion protection; some cleanup.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 114
diff changeset
28 }
45
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
29
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
30
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
31 /// A fixed-size blank widget.
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
32 class FixedBlankWidget : FixedWidget
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
33 {
91
4d5d53e4f881 Shared alignment for dynamic content lists - finally implemented! Lots of smaller changes too.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
34 this (IWidgetManager mgr, widgetID id, WidgetData data) {
77
3dfd934100f7 Continuing widget data changes started in last commit: all previous widgets work again now (but lacking saving).
Diggory Hardy <diggory.hardy@gmail.com>
parents: 76
diff changeset
35 WDCheck (data, 3);
91
4d5d53e4f881 Shared alignment for dynamic content lists - finally implemented! Lots of smaller changes too.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
36 super (mgr, id, data);
45
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
37 }
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
38
114
b16a534f5302 Changes for tango r4201. Added override keyword in a lot of places.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
39 override void draw () {
45
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
40 super.draw;
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
41
75
25cb7420dc91 A massive overhaul/rewrite for the gui's data management and setup code. Currently much that was working is broken.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 59
diff changeset
42 mgr.renderer.drawBlank (x,y, w,h);
45
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
43 }
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
44 }
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
45
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
46 /// A completely resizable blank widget (initial size zero).
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
47 class SizableBlankWidget : SizableWidget
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
48 {
91
4d5d53e4f881 Shared alignment for dynamic content lists - finally implemented! Lots of smaller changes too.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
49 this (IWidgetManager mgr, widgetID id, WidgetData data) {
77
3dfd934100f7 Continuing widget data changes started in last commit: all previous widgets work again now (but lacking saving).
Diggory Hardy <diggory.hardy@gmail.com>
parents: 76
diff changeset
50 WDCheck (data, 1);
91
4d5d53e4f881 Shared alignment for dynamic content lists - finally implemented! Lots of smaller changes too.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
51 super (mgr, id, data);
45
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
52 }
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
53
114
b16a534f5302 Changes for tango r4201. Added override keyword in a lot of places.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
54 override void draw () {
45
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
55 super.draw;
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
56
75
25cb7420dc91 A massive overhaul/rewrite for the gui's data management and setup code. Currently much that was working is broken.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 59
diff changeset
57 mgr.renderer.drawBlank (x,y, w,h);
45
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
58 }
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
59 }
0fd51d2c6c8a Several changes to resising windows and layout widgets. This commit still has some bugs.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
60
80
ea58f277f487 Gui reorganization and changes; partial implementation of floating widgets.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 77
diff changeset
61 /// A debug widget. Essentially as SizableBlankWidget but doesn't mind any amount of data and prints it.
ea58f277f487 Gui reorganization and changes; partial implementation of floating widgets.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 77
diff changeset
62 class DebugWidget : SizableWidget
ea58f277f487 Gui reorganization and changes; partial implementation of floating widgets.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 77
diff changeset
63 {
91
4d5d53e4f881 Shared alignment for dynamic content lists - finally implemented! Lots of smaller changes too.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
64 this (IWidgetManager mgr, widgetID id, WidgetData data) {
4d5d53e4f881 Shared alignment for dynamic content lists - finally implemented! Lots of smaller changes too.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
65 super (mgr, id, data);
116
5ee69b3ed9c9 Partial implementation of infinite widget recursion protection; some cleanup.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 114
diff changeset
66 logger.warn ("Debug widget - parameters: ints = {}, strings = {}", data.ints, data.strings);
80
ea58f277f487 Gui reorganization and changes; partial implementation of floating widgets.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 77
diff changeset
67 }
ea58f277f487 Gui reorganization and changes; partial implementation of floating widgets.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 77
diff changeset
68
114
b16a534f5302 Changes for tango r4201. Added override keyword in a lot of places.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
69 override void draw () {
80
ea58f277f487 Gui reorganization and changes; partial implementation of floating widgets.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 77
diff changeset
70 super.draw;
ea58f277f487 Gui reorganization and changes; partial implementation of floating widgets.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 77
diff changeset
71
ea58f277f487 Gui reorganization and changes; partial implementation of floating widgets.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 77
diff changeset
72 mgr.renderer.drawBlank (x,y, w,h);
ea58f277f487 Gui reorganization and changes; partial implementation of floating widgets.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 77
diff changeset
73 }
ea58f277f487 Gui reorganization and changes; partial implementation of floating widgets.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 77
diff changeset
74 }