Mercurial > projects > mde
annotate mde/gui/exception.d @ 133:9fd705793568
Fixed menu popup bug, improved recursion detection.
Menu popups can now determine whether or not they are sub-menus.
Recursion detection can now also check content (if not the same, there's not a risk of infinite recursion).
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Fri, 23 Jan 2009 16:05:05 +0000 |
parents | fe061009029d |
children |
rev | line source |
---|---|
27
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
1 /* LICENSE BLOCK |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
2 Part of mde: a Modular D game-oriented Engine |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
3 Copyright © 2007-2008 Diggory Hardy |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
4 |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
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 |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
6 of the GNU General Public License as published by the Free Software Foundation, either |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
7 version 2 of the License, or (at your option) any later version. |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
8 |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
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; |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
10 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
11 See the GNU General Public License for more details. |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
12 |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
13 You should have received a copy of the GNU General Public License |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
14 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
15 |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
16 /// All GUI Exception classes |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
17 module mde.gui.exception; |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
18 |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
19 import mde.exception; |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
20 |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
21 class GuiException : mdeException |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
22 { |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
23 char[] getSymbol () { |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
24 return super.getSymbol ~ ".gui"; |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
25 } |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
26 |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
27 this (char[] msg) { |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
28 super(msg); |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
29 } |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
30 } |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
31 |
39
5132301e9ed7
Implemented widget saving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
27
diff
changeset
|
32 /// Thrown when createWidget or a Widget class's this() is called with invalid data. |
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:
40
diff
changeset
|
33 class WidgetDataException : GuiException |
27
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
34 { |
103
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
91
diff
changeset
|
35 this () { // Other CTOR should be used by classes |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
91
diff
changeset
|
36 super ("Bad widget data"); |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
91
diff
changeset
|
37 } |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
91
diff
changeset
|
38 this (Object o) { // Default, by Widget class's this / WDCheck |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
91
diff
changeset
|
39 super ("Bad widget data for "~o.classinfo.name); |
27
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
40 } |
91
4d5d53e4f881
Shared alignment for dynamic content lists - finally implemented! Lots of smaller changes too.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
75
diff
changeset
|
41 } |
4d5d53e4f881
Shared alignment for dynamic content lists - finally implemented! Lots of smaller changes too.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
75
diff
changeset
|
42 |
133
9fd705793568
Fixed menu popup bug, improved recursion detection.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
112
diff
changeset
|
43 /// Thrown when a widget is (potentially) being recursed infinitely. |
9fd705793568
Fixed menu popup bug, improved recursion detection.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
112
diff
changeset
|
44 class WidgetRecursionException : GuiException |
9fd705793568
Fixed menu popup bug, improved recursion detection.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
112
diff
changeset
|
45 { |
9fd705793568
Fixed menu popup bug, improved recursion detection.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
112
diff
changeset
|
46 this (char[] id) { // Pass id of widget being recursed |
9fd705793568
Fixed menu popup bug, improved recursion detection.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
112
diff
changeset
|
47 super ("Infinite recursion of "~id); |
9fd705793568
Fixed menu popup bug, improved recursion detection.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
112
diff
changeset
|
48 } |
9fd705793568
Fixed menu popup bug, improved recursion detection.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
112
diff
changeset
|
49 } |
9fd705793568
Fixed menu popup bug, improved recursion detection.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
112
diff
changeset
|
50 |
91
4d5d53e4f881
Shared alignment for dynamic content lists - finally implemented! Lots of smaller changes too.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
75
diff
changeset
|
51 class ContentException : GuiException |
4d5d53e4f881
Shared alignment for dynamic content lists - finally implemented! Lots of smaller changes too.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
75
diff
changeset
|
52 { |
4d5d53e4f881
Shared alignment for dynamic content lists - finally implemented! Lots of smaller changes too.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
75
diff
changeset
|
53 char[] getSymbol () { |
4d5d53e4f881
Shared alignment for dynamic content lists - finally implemented! Lots of smaller changes too.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
75
diff
changeset
|
54 return super.getSymbol ~ ".content"; |
4d5d53e4f881
Shared alignment for dynamic content lists - finally implemented! Lots of smaller changes too.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
75
diff
changeset
|
55 } |
4d5d53e4f881
Shared alignment for dynamic content lists - finally implemented! Lots of smaller changes too.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
75
diff
changeset
|
56 this () { |
4d5d53e4f881
Shared alignment for dynamic content lists - finally implemented! Lots of smaller changes too.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
75
diff
changeset
|
57 super ("Unexpected content type"); |
4d5d53e4f881
Shared alignment for dynamic content lists - finally implemented! Lots of smaller changes too.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
75
diff
changeset
|
58 } |
112
fe061009029d
EnumContent; log level can be selected from a popup list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
103
diff
changeset
|
59 this (Object o) { // Default, by Widget class's this / WDCCheck |
fe061009029d
EnumContent; log level can be selected from a popup list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
103
diff
changeset
|
60 super ("Unexpected content type for "~o.classinfo.name); |
fe061009029d
EnumContent; log level can be selected from a popup list.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
103
diff
changeset
|
61 } |
91
4d5d53e4f881
Shared alignment for dynamic content lists - finally implemented! Lots of smaller changes too.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
75
diff
changeset
|
62 this (char[] msg) { |
27
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
63 super (msg); |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
64 } |
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
65 } |
103
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
91
diff
changeset
|
66 |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
91
diff
changeset
|
67 /// Thrown when getting a content item fails |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
91
diff
changeset
|
68 class ContentItemException : GuiException { |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
91
diff
changeset
|
69 this (char[] msg) { |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
91
diff
changeset
|
70 super ("Bad content item specifier: "~msg); |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
91
diff
changeset
|
71 } |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
91
diff
changeset
|
72 } |