annotate mde/gui/renderer/IRenderer.d @ 100:0ea4a3e651ae

There is now a position marker for text editing. Changed the way fonts are configured. Actually, not much of the new way exists yet.
author Diggory Hardy <diggory.hardy@gmail.com>
date Sat, 15 Nov 2008 17:39:14 +0000
parents 5de5810e3516
children 42e241e7be3e
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
80
ea58f277f487 Gui reorganization and changes; partial implementation of floating widgets.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 75
diff changeset
19 public import mde.gui.types;
93
08a4ae11454b Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
20 import mde.font.font;
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 {
97
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
31 //BEGIN Types
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
32 /** For floating widget borders. Like TextAdapter above, could be more flexible. */
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
33 struct Border {
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
34 /** Border type.
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
35 *
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
36 * No border, small non-functional border, movement only border, resize only border, or
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
37 * full border. */
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
38 enum BTYPE : int {
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
39 NONE = 0, SMALL = 1, LARGE = 2, MOVE = 4, RESIZE = 8, BOTH = MOVE | RESIZE
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
40 }
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
41 /** Which edges of a window are being resized.
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
42 *
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
43 * E.g. X1 == left, X2 | Y1 == right and top. */
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
44 enum RESIZE : int {
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
45 NONE = 0x0, X1 = 0x1, X2 = 0x2, Y1 = 0x4, Y2 = 0x8
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
46 }
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
47
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
48 wdim x1,x2; /// First and second (lef & right) horizontal borders
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
49 wdim y1,y2; /// First and second vertical borders
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
50 RESIZE capability; /// Which resizes are possible.
38
8c4c96f04e7f Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents: 37
diff changeset
51
97
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
52 void opAddAssign (Border d) {
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
53 x1 += d.x1;
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
54 x2 += d.x2;
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
55 y1 += d.y1;
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
56 y2 += d.y2;
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
57 }
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
58
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
59 /** Used to tell if a click on a window's border is for resizing or moving.
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
60 *
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
61 * Depends on setSizable's parameters.
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
62 *
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
63 * Params:
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
64 * cx =
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
65 * cy = click coordinates relative to window border
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
66 * w =
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
67 * h = window size
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
68 *
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
69 * Returns:
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
70 * RESIZE = Describes whether the click resizes or moves the widget. */
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
71 RESIZE getResize (wdim cx, wdim cy, wdim w, wdim h) {
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
72 RESIZE r = RESIZE.NONE;
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
73 if (cx + cy < x1 + y1)
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
74 r = RESIZE.X1 | RESIZE.Y1;
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
75 else if (cx + h - cy < x1 + y2)
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
76 r = RESIZE.X1 | RESIZE.Y2;
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
77 else if (w - cx + cy < x2 + y1)
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
78 r = RESIZE.X2 | RESIZE.Y1;
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
79 else if (w - cx + h - cy < x2 + y2)
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
80 r = RESIZE.X2 | RESIZE.Y2;
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
81 return r & capability;
38
8c4c96f04e7f Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents: 37
diff changeset
82 }
8c4c96f04e7f Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents: 37
diff changeset
83 }
8c4c96f04e7f Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents: 37
diff changeset
84
93
08a4ae11454b Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
85 /** For drawing text - one instance per string.
08a4ae11454b Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
86 *
08a4ae11454b Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
87 * NOTE: currently inflexible. Could use (function) pointers, class interfaces or struct
08a4ae11454b Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
88 * interfaces when available to allow flexibility. */
08a4ae11454b Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
89 struct TextAdapter {
99
5de5810e3516 Implemented an editable TextContent widget; it's now possible to edit text options using the GUI.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 97
diff changeset
90 void setText (char[] c) {
93
08a4ae11454b Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
91 content = c;
99
5de5810e3516 Implemented an editable TextContent widget; it's now possible to edit text options using the GUI.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 97
diff changeset
92 textCache.cacheVer = -1; // force update
93
08a4ae11454b Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
93 }
99
5de5810e3516 Implemented an editable TextContent widget; it's now possible to edit text options using the GUI.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 97
diff changeset
94
5de5810e3516 Implemented an editable TextContent widget; it's now possible to edit text options using the GUI.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 97
diff changeset
95 void setColour (int col = 0xFFFFFF) {
5de5810e3516 Implemented an editable TextContent widget; it's now possible to edit text options using the GUI.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 97
diff changeset
96 colour = Colour (col);
5de5810e3516 Implemented an editable TextContent widget; it's now possible to edit text options using the GUI.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 97
diff changeset
97 }
100
0ea4a3e651ae There is now a position marker for text editing.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 99
diff changeset
98
0ea4a3e651ae There is now a position marker for text editing.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 99
diff changeset
99 void setIndex (size_t index = size_t.max) {
0ea4a3e651ae There is now a position marker for text editing.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 99
diff changeset
100 this.index = index;
0ea4a3e651ae There is now a position marker for text editing.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 99
diff changeset
101 }
93
08a4ae11454b Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
102
08a4ae11454b Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
103 void getDimensions (out wdsize w, out wdsize h) {
08a4ae11454b Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
104 font.updateBlock (content, textCache);
08a4ae11454b Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
105 w = cast(wdim) textCache.w;
08a4ae11454b Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
106 h = cast(wdim) textCache.h;
08a4ae11454b Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
107 }
08a4ae11454b Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
108
08a4ae11454b Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
109 void draw (wdabs x, wdabs y) {
100
0ea4a3e651ae There is now a position marker for text editing.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 99
diff changeset
110 font.textBlock (x,y, content, textCache, colour, index);
93
08a4ae11454b Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
111 }
08a4ae11454b Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
112
08a4ae11454b Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
113 char[] content;
08a4ae11454b Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
114 TextBlock textCache;
100
0ea4a3e651ae There is now a position marker for text editing.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 99
diff changeset
115 size_t index;
93
08a4ae11454b Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
116 Colour colour;
08a4ae11454b Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
117 FontStyle font;
08a4ae11454b Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 80
diff changeset
118 }
97
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
119 //END Types
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
120
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
121 //BEGIN Methods
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
122 /** Returns a Border containing dimensions.
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
123 *
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
124 * The dimensions may depend on whether the widget is resizable (horizontally and vertically).
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
125 */
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
126 Border getBorder (Border.BTYPE type, bool wSizable, bool hSizable);
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
127
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
128 /** Return the renderer's between-widget spacing (for layout widgets). */
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
129 wdim layoutSpacing ();
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
130
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
131 /** Restrict following draw operations to given box.
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
132 *
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
133 * Restrict "pushes" a restriction onto a stack; relax must be called afterwards to "pop" the
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
134 * restriction. */
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
135 void restrict (wdim x, wdim y, wdim w, wdim h);
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
136 void relax (); /// ditto
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
137
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
138 /** Draw a window border plus background. */
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
139 void drawWindow (Border* border, wdim x, wdim y, wdim w, wdim h);
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
140
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
141 /** Draws a widget background. Usually doesn't do anything since backgrounds are transparent. */
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
142 void drawWidgetBack (wdim x, wdim y, wdim w, wdim h);
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
143
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
144 /** Draws a blank widget (temporary) */
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
145 void drawBlank (wdim x, wdim y, wdim w, wdim h);
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
146
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
147 /** Draws a button frame, in if pushed == true. */
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
148 void drawButton (wdim x, wdim y, wdim w, wdim h, bool pushed);
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
149
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
150 /** Toggle buttons.
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
151 *
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
152 * These have a fixed size which getToggleSize returns. */
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
153 wdimPair getToggleSize ();
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
154 void drawToggle (wdim x, wdim y, bool state, bool pushed); /// ditto
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
155
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
156 /** Get a TextAdapter to draw some text.
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
157 *
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
158 * If no colour is passes, a default is used (white). */
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
159 TextAdapter getAdapter (char[] text, int colour = 0xFFFFFF);
30470bc19ca4 Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 95
diff changeset
160 //END Methods
32
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
161 }