annotate mde/gui/renderer/IRenderer.d @ 58:d43523ed4b62

Included a wdim typedef for all variables to do with window position or size instead of just using int.
author Diggory Hardy <diggory.hardy@gmail.com>
date Sat, 14 Jun 2008 17:15:06 +0100
parents 1530d9c04d4d
children 25cb7420dc91
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
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
19 public import mde.gui.IGui; // wdim type is used by just about everything including this
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
20
32
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
21 /** Interface for renderers.
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
22 *
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
23 * 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
24 * 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
25 * 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
26 *
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
27 * 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
28 interface IRenderer
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
29 {
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
30 //BEGIN Get dimensions
38
8c4c96f04e7f Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents: 37
diff changeset
31 /// A container for the dimensions
8c4c96f04e7f Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents: 37
diff changeset
32 struct BorderDimensions {
8c4c96f04e7f Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents: 37
diff changeset
33 /// 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
34 wdim l, t, r, b;
38
8c4c96f04e7f Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents: 37
diff changeset
35
8c4c96f04e7f Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents: 37
diff changeset
36 void opAddAssign (BorderDimensions d) {
8c4c96f04e7f Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents: 37
diff changeset
37 l += d.l;
8c4c96f04e7f Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents: 37
diff changeset
38 t += d.t;
8c4c96f04e7f Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents: 37
diff changeset
39 r += d.r;
8c4c96f04e7f Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents: 37
diff changeset
40 b += d.b;
8c4c96f04e7f Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents: 37
diff changeset
41 }
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
41
b3a6ca4516b4 The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 38
diff changeset
44 /** 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
45 * them). */
b3a6ca4516b4 The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 38
diff changeset
46 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
47
b3a6ca4516b4 The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 38
diff changeset
48 /// 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
49 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
50 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
51 }
8c4c96f04e7f Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents: 37
diff changeset
52
41
b3a6ca4516b4 The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 38
diff changeset
53 /** 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
54 *
b3a6ca4516b4 The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 38
diff changeset
55 * 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
56 *
b3a6ca4516b4 The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 38
diff changeset
57 * Params:
b3a6ca4516b4 The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 38
diff changeset
58 * cx =
b3a6ca4516b4 The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 38
diff changeset
59 * 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
60 * w =
b3a6ca4516b4 The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 38
diff changeset
61 * 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
62 *
b3a6ca4516b4 The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 38
diff changeset
63 * Returns:
b3a6ca4516b4 The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 38
diff changeset
64 * 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
65 */
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
66 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
67
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
68 /** 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
69 wdim layoutSpacing ();
32
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
70 //END Get dimensions
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
71
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
72 //BEGIN draw routines
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
73 /** 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
74 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
75
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
76 /** 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
77 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
78
43
1530d9c04d4d Column/row resizing implemented for GridLayoutWidget (finally)!
Diggory Hardy <diggory.hardy@gmail.com>
parents: 41
diff changeset
79 /** 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
80 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
81
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
82 /** 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
83 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
84 //END draw routines
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
85 }