Mercurial > projects > mde
annotate mde/gui/renderer/IRenderer.d @ 75:25cb7420dc91
A massive overhaul/rewrite for the gui's data management and setup code. Currently much that was working is broken.
imde's classes are created in a static this instead of mde's main.
gl setup code moved from gl/basic.d to gl/draw.d
mergetag.DefaultData: now HIGH_LOW priority instead of LOW_HIGH. Reduced type list to only used types; small fix for indent function.
setup.paths: new NoFileException thrown instead of MTFileIOException
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Mon, 28 Jul 2008 18:17:48 +0100 |
parents | d43523ed4b62 |
children | ea58f277f487 |
rev | line source |
---|---|
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
1 /* LICENSE BLOCK |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
2 Part of mde: a Modular D game-oriented Engine |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
3 Copyright © 2007-2008 Diggory Hardy |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
4 |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
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 |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
6 of the GNU General Public License as published by the Free Software Foundation, either |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
7 version 2 of the License, or (at your option) any later version. |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
8 |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
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; |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
10 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
11 See the GNU General Public License for more details. |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
12 |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
13 You should have received a copy of the GNU General Public License |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
14 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
15 |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
16 /** Interface for the renderer. This is planned to replace decoration.d */ |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
17 module mde.gui.renderer.IRenderer; |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
18 |
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:
58
diff
changeset
|
19 // Put here to avoid circular import. |
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:
58
diff
changeset
|
20 typedef int wdim; |
58
d43523ed4b62
Included a wdim typedef for all variables to do with window position or size instead of just using int.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
21 |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
22 /** Interface for renderers. |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
23 * |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
24 * Renderers provide unified drawing methods for widget, e.g. to draw a window background, a frame, |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
25 * or a button. The renderer will effectively be synonymous with the theme, except that a scripted |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
26 * renderer may also be available. |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
27 * |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
28 * The renderer is intended to be per-GUI. */ |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
29 interface IRenderer |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
30 { |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
31 //BEGIN Get dimensions |
38
8c4c96f04e7f
Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents:
37
diff
changeset
|
32 /// A container for the dimensions |
8c4c96f04e7f
Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents:
37
diff
changeset
|
33 struct BorderDimensions { |
8c4c96f04e7f
Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents:
37
diff
changeset
|
34 /// The dimensions: left, top, right, bottom |
58
d43523ed4b62
Included a wdim typedef for all variables to do with window position or size instead of just using int.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
35 wdim l, t, r, b; |
38
8c4c96f04e7f
Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents:
37
diff
changeset
|
36 |
8c4c96f04e7f
Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents:
37
diff
changeset
|
37 void opAddAssign (BorderDimensions d) { |
8c4c96f04e7f
Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents:
37
diff
changeset
|
38 l += d.l; |
8c4c96f04e7f
Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents:
37
diff
changeset
|
39 t += d.t; |
8c4c96f04e7f
Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents:
37
diff
changeset
|
40 r += d.r; |
8c4c96f04e7f
Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents:
37
diff
changeset
|
41 b += d.b; |
8c4c96f04e7f
Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents:
37
diff
changeset
|
42 } |
8c4c96f04e7f
Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents:
37
diff
changeset
|
43 } |
8c4c96f04e7f
Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents:
37
diff
changeset
|
44 |
41
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
38
diff
changeset
|
45 /** Use to set and reset these parameters, and to get the border size (which may depend on |
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
38
diff
changeset
|
46 * them). */ |
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
38
diff
changeset
|
47 BorderDimensions setSizable (bool wSizable, bool hSizable); |
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
38
diff
changeset
|
48 |
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
38
diff
changeset
|
49 /// Which edges of a window are being resized |
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
38
diff
changeset
|
50 enum RESIZE_TYPE : ubyte { |
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
38
diff
changeset
|
51 NONE = 0x0, L = 0x1, R = 0x2, T = 0x4, B = 0x8 |
38
8c4c96f04e7f
Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents:
37
diff
changeset
|
52 } |
8c4c96f04e7f
Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents:
37
diff
changeset
|
53 |
41
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
38
diff
changeset
|
54 /** Used to tell if a click on a window's border is for resizing or moving. |
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
38
diff
changeset
|
55 * |
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
38
diff
changeset
|
56 * Depends on setSizable's parameters. |
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
38
diff
changeset
|
57 * |
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
38
diff
changeset
|
58 * Params: |
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
38
diff
changeset
|
59 * cx = |
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
38
diff
changeset
|
60 * cy = click coordinates relative to window border |
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
38
diff
changeset
|
61 * w = |
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
38
diff
changeset
|
62 * h = window size |
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
38
diff
changeset
|
63 * |
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
38
diff
changeset
|
64 * Returns: |
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
38
diff
changeset
|
65 * RESIZE_TYPE = NONE for a move, an or'd combination of L/R/T/B for resizing. |
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
38
diff
changeset
|
66 */ |
58
d43523ed4b62
Included a wdim typedef for all variables to do with window position or size instead of just using int.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
67 RESIZE_TYPE getResizeType (wdim cx, wdim cy, wdim w, wdim h); |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
68 |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
69 /** Return the renderer's between-widget spacing (for layout widgets). */ |
58
d43523ed4b62
Included a wdim typedef for all variables to do with window position or size instead of just using int.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
70 wdim layoutSpacing (); |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
71 //END Get dimensions |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
72 |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
73 //BEGIN draw routines |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
74 /** Draw a window border plus background. */ |
58
d43523ed4b62
Included a wdim typedef for all variables to do with window position or size instead of just using int.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
75 void drawWindow (wdim x, wdim y, wdim w, wdim h); |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
76 |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
77 /** Draws a widget background. Usually doesn't do anything since backgrounds are transparent. */ |
58
d43523ed4b62
Included a wdim typedef for all variables to do with window position or size instead of just using int.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
78 void drawWidgetBack (wdim x, wdim y, wdim w, wdim h); |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
79 |
43
1530d9c04d4d
Column/row resizing implemented for GridLayoutWidget (finally)!
Diggory Hardy <diggory.hardy@gmail.com>
parents:
41
diff
changeset
|
80 /** Draws a blank widget (temporary) */ |
58
d43523ed4b62
Included a wdim typedef for all variables to do with window position or size instead of just using int.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
81 void drawBlank (wdim x, wdim y, wdim w, wdim h); |
43
1530d9c04d4d
Column/row resizing implemented for GridLayoutWidget (finally)!
Diggory Hardy <diggory.hardy@gmail.com>
parents:
41
diff
changeset
|
82 |
37
052df9b2fe07
Allowed widget resizing, changed widget IDs and made Input catch any callback exceptions.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
32
diff
changeset
|
83 /** Draws a button frame, in if pushed == true. */ |
58
d43523ed4b62
Included a wdim typedef for all variables to do with window position or size instead of just using int.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
43
diff
changeset
|
84 void drawButton (wdim x, wdim y, wdim w, wdim h, bool pushed); |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
85 //END draw routines |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
86 } |