]> git.decadent.org.uk Git - ion3.git/blob - ioncore/rectangle.h
19e8c1175d502a0408d083876d8b22c0261d895c
[ion3.git] / ioncore / rectangle.h
1 /*
2  * ion/ioncore/rectangle.h
3  *
4  * Copyright (c) Tuomo Valkonen 1999-2008. 
5  *
6  * See the included file LICENSE for details.
7  */
8
9 #ifndef ION_IONCORE_RECTANGLE_H
10 #define ION_IONCORE_RECTANGLE_H
11
12 #include <stdio.h>
13 #include "common.h"
14 #include <libextl/extl.h>
15
16 INTRSTRUCT(WRectangle);
17
18 DECLSTRUCT(WRectangle){
19     int x, y;
20     int w, h;
21 };
22
23 #define RECTANGLE_SAME   0x00
24 #define RECTANGLE_X_DIFF 0x01
25 #define RECTANGLE_Y_DIFF 0x02
26 #define RECTANGLE_POS_DIFF (RECTANGLE_X_DIFF|RECTANGLE_Y_DIFF)
27 #define RECTANGLE_W_DIFF 0x04
28 #define RECTANGLE_H_DIFF 0x08
29 #define RECTANGLE_SZ_DIFF (RECTANGLE_W_DIFF|RECTANGLE_H_DIFF)
30
31 extern int rectangle_compare(const WRectangle *g, const WRectangle *h);
32 extern bool rectangle_contains(const WRectangle *g, int x, int y);
33 extern void rectangle_constrain(WRectangle *g, const WRectangle *bounds);
34
35 extern void rectange_debugprint(const WRectangle *g, const char *n);
36
37 #endif /* ION_IONCORE_RECTANGLE_H */
38