1 module bindbc.kw.rect;
2 
3 struct KW_Rect {
4     int x;
5     int y;
6     int w;
7     int h;
8 }
9 
10 enum /*KW_RectVerticalAlignment*/{
11     KW_RECT_ALIGN_VERTICALLY_NONE,    /** Do not align vertically. */
12     KW_RECT_ALIGN_TOP,     /** Top align the rectangles */
13     KW_RECT_ALIGN_MIDDLE,  /** Make the rectangles centralized on a horizontal lign  */
14     KW_RECT_ALIGN_BOTTOM   /** Bottom align the rectangles */
15 }
16 
17 enum /*KW_RectHorizontalAlignment*/ {
18     KW_RECT_ALIGN_HORIZONTALLY_NONE,  /* Do not align horizontally */
19     KW_RECT_ALIGN_LEFT,    /** Left align the rectangles */
20     KW_RECT_ALIGN_CENTER,  /** Make the rectangles centralized on a vertical lign */
21     KW_RECT_ALIGN_RIGHT    /** Right align the rectangles */
22 }
23 
24 version(BindKiwi_Static){
25     extern (C) @nogc nothrow {
26         void KW_RectCenterInParent(const KW_Rect * outer, KW_Rect * inner);
27         void KW_RectVerticallyCenterInParent(const KW_Rect * outer, KW_Rect * inner);
28         void KW_RectHorizontallyCenterInParent(const KW_Rect * outer, KW_Rect * inner);
29         void KW_RectLayoutVertically(KW_Rect** rects, uint count, int padding, int _align);
30         void KW_RectLayoutHorizontally(KW_Rect** rects, uint count, int padding, int _align);
31         void KW_RectFillParentVertically(const KW_Rect* outer, KW_Rect**  rects, uint* weights, uint count, int padding);
32         void KW_RectFillParentHorizontally(const KW_Rect* outer, KW_Rect**  rects, uint* weights, uint count,
33                                                     int padding, int _align);
34         void KW_RectCalculateEnclosingRect(const KW_Rect**  rects, uint count, KW_Rect * outer);
35         void KW_SetRect(KW_Rect * rect, int x, int y, int w, int h);
36         void KW_CopyRect(const KW_Rect * src, KW_Rect * dst);
37         void KW_ZeroRect(KW_Rect * rect);
38         void KW_MarginRect(const KW_Rect * outer, KW_Rect * inner, int margin);
39     }
40 } else {
41     extern (C) @nogc nothrow {
42         alias pKW_RectCenterInParent = void function(const KW_Rect* outer, KW_Rect * inner);
43         alias pKW_RectVerticallyCenterInParent = void function(const KW_Rect* outer, KW_Rect * inner);
44         alias pKW_RectHorizontallyCenterInParent = void function(const KW_Rect* outer, KW_Rect * inner);
45         alias pKW_RectLayoutVertically = void function(KW_Rect** rects, uint count, int padding, int _align);
46         alias pKW_RectLayoutHorizontally = void function(KW_Rect** rects, uint count, int padding, int _align);
47         alias pKW_RectFillParentVertically = void function(const KW_Rect* outer, KW_Rect**  rects, uint* weights, uint count, int padding);
48         alias pKW_RectFillParentHorizontally = void function(const KW_Rect* outer, KW_Rect**  rects, uint* weights, uint count,
49                                                     int padding, int _align);
50         alias pKW_RectCalculateEnclosingRect = void function(const KW_Rect**  rects, uint count, KW_Rect * outer);
51         alias pKW_SetRect = void function(KW_Rect * rect, int x, int y, int w, int h);
52         alias pKW_CopyRect = void function(const KW_Rect* src, KW_Rect * dst);
53         alias pKW_ZeroRect = void function(KW_Rect * rect);
54         alias pKW_MarginRect = void function(const KW_Rect* outer, KW_Rect * inner, int margin);
55     }
56 
57     __gshared {
58         pKW_RectCenterInParent KW_RectCenterInParent;
59         pKW_RectVerticallyCenterInParent KW_RectVerticallyCenterInParent;
60         pKW_RectHorizontallyCenterInParent KW_RectHorizontallyCenterInParent;
61         pKW_RectLayoutVertically KW_RectLayoutVertically;
62         pKW_RectLayoutHorizontally KW_RectLayoutHorizontally;
63         pKW_RectFillParentVertically KW_RectFillParentVertically;
64         pKW_RectFillParentHorizontally KW_RectFillParentHorizontally;
65         pKW_RectCalculateEnclosingRect KW_RectCalculateEnclosingRect;
66         pKW_SetRect KW_SetRect;
67         pKW_CopyRect KW_CopyRect;
68         pKW_ZeroRect KW_ZeroRect;
69         pKW_MarginRect KW_MarginRect;
70     }
71 }