1 /**
2 Copyright: Copyright (c) 2013-2014 Andrey Penechko.
3 License: a$(WEB boost.org/LICENSE_1_0.txt, Boost License 1.0).
4 Authors: Andrey Penechko.
5 */
6 
7 module anchovy.gui.interfaces.iguirenderer;
8 
9 import anchovy.graphics.texture;
10 
11 public import anchovy.graphics.interfaces.irenderer;
12 
13 import anchovy.gui;
14 
15 enum HoriAlignment
16 {
17 	NONE   = 1<<0,
18 	LEFT   = 1<<1,
19 	CENTER = 1<<2,
20 	RIGHT  = 1<<3,
21 }
22 
23 enum VertAlignment
24 {
25 	NONE   = 1<<4,
26 	TOP    = 1<<5,
27 	CENTER = 1<<6,
28 	BOTTOM = 1<<7,
29 }
30 
31 enum AlignmentType
32 {
33 	NONE_NONE   = HoriAlignment.NONE | VertAlignment.NONE,
34 	NONE_TOP    = HoriAlignment.NONE | VertAlignment.TOP,
35 	NONE_CENTER = HoriAlignment.NONE | VertAlignment.CENTER,
36 	NONE_BOTTOM = HoriAlignment.NONE | VertAlignment.BOTTOM,
37 
38 	LEFT_NONE   = HoriAlignment.LEFT | VertAlignment.NONE,
39 	LEFT_TOP    = HoriAlignment.LEFT | VertAlignment.TOP,
40 	LEFT_CENTER = HoriAlignment.LEFT | VertAlignment.CENTER,
41 	LEFT_BOTTOM = HoriAlignment.LEFT | VertAlignment.BOTTOM,
42 
43 	CENTER_NONE   = HoriAlignment.CENTER | VertAlignment.NONE,
44 	CENTER_TOP    = HoriAlignment.CENTER | VertAlignment.TOP,
45 	CENTER_CENTER = HoriAlignment.CENTER | VertAlignment.CENTER,
46 	CENTER_BOTTOM = HoriAlignment.CENTER | VertAlignment.BOTTOM,
47 
48 	RIGHT_NONE   = HoriAlignment.RIGHT | VertAlignment.NONE,
49 	RIGHT_TOP    = HoriAlignment.RIGHT | VertAlignment.TOP,
50 	RIGHT_CENTER = HoriAlignment.RIGHT | VertAlignment.CENTER,
51 	RIGHT_BOTTOM = HoriAlignment.RIGHT | VertAlignment.BOTTOM,
52 }
53 
54 interface IGuiRenderer
55 {
56 	Texture getFontTexture();
57 	ref FontManager fontManager() @property;
58 	TextLine createTextLine(string fontName = "normal");
59 
60 	void drawControlBack(Widget widget, Rect staticRect);
61 
62 	/// draws text line with alignment specified relative to point
63 	void drawTextLine(TextLine line, ivec2 position, in AlignmentType alignment);
64 
65 	/// draws text line with alignment specified relative to rectangle
66 	void drawTextLine(TextLine line, in Rect area, in AlignmentType alignment);
67 	void pushClientArea(Rect area);
68 	void popClientArea();
69 	void setClientArea(Rect area);
70 	IRenderer renderer() @property;
71 }