|
1 /* |
|
2 * GUI Common internal definitions |
|
3 * |
|
4 * Copyright (c) 2009 CodeSourcery |
|
5 * |
|
6 * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
7 * of this software and associated documentation files (the "Software"), to deal |
|
8 * in the Software without restriction, including without limitation the rights |
|
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
10 * copies of the Software, and to permit persons to whom the Software is |
|
11 * furnished to do so, subject to the following conditions: |
|
12 * |
|
13 * The above copyright notice and this permission notice shall be included in |
|
14 * all copies or substantial portions of the Software. |
|
15 * |
|
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
22 * THE SOFTWARE. |
|
23 */ |
|
24 |
|
25 #define X1_Y1 |
|
26 |
|
27 typedef struct |
|
28 { |
|
29 int x0; |
|
30 int y0; |
|
31 #if defined X1_Y1 |
|
32 int x1; |
|
33 int y1; |
|
34 #else |
|
35 int width; |
|
36 int height; |
|
37 #endif |
|
38 } gui_area_t; |
|
39 |
|
40 |
|
41 #if defined X1_Y1 |
|
42 # define GET_GUI_AREA_WIDTH(area_ptr) ((area_ptr)->x1 - (area_ptr)->x0) |
|
43 # define GET_GUI_AREA_HEIGHT(area_ptr) ((area_ptr)->y1 - (area_ptr)->y0) |
|
44 # define GET_GUI_AREA_X1(area_ptr) (area_ptr)->x1) |
|
45 # define GET_GUI_AREA_Y1(area_ptr) (area_ptr)->y1) |
|
46 # define SET_GUI_AREA_WIDTH(area_ptr,w) (area_ptr)->x1 = (area_ptr)->x0 + (w) |
|
47 # define SET_GUI_AREA_HEIGHT(area_ptr,h) (area_ptr)->y1 = (area_ptr)->y0 + (h) |
|
48 # define SET_GUI_AREA_X0(area_ptr,x0) (area_ptr)->x0 = (x0) |
|
49 # define SET_GUI_AREA_Y0(area_ptr,y0) (area_ptr)->y0 = (y0) |
|
50 # define SET_GUI_AREA_X1(area_ptr,x1) (area_ptr)->x1 = (x1) |
|
51 # define SET_GUI_AREA_Y1(area_ptr,y1) (area_ptr)->y1 = (y1) |
|
52 #elif define WIDTH_HEIGHT |
|
53 # define GET_GUI_AREA_WIDTH(area_ptr) (area_ptr)->width |
|
54 # define GET_GUI_AREA_HEIGHT(area_ptr) (area_ptr)->height |
|
55 # define GET_GUI_AREA_X1(area_ptr) ((area_ptr)->x0 + (area_ptr)->width) |
|
56 # define GET_GUI_AREA_Y1(area_ptr) ((area_ptr)->y0 + (area_ptr)->height) |
|
57 # define SET_GUI_AREA_WIDTH(area_ptr,w) (area_ptr)->width = (w) |
|
58 # define SET_GUI_AREA_HEIGHT(area_ptr,h) (area_ptr)->height = (h) |
|
59 # define SET_GUI_AREA_X0(area_ptr,x0) { (area_ptr)->width += (area_ptr)->x0 - (x0); (area_ptr)->x0 = (x0); } |
|
60 # define SET_GUI_AREA_Y0(area_ptr,y0) { (area_ptr)->height += (area_ptr)->y0 - (y0); (area_ptr)->y0 = (y0); } |
|
61 # define SET_GUI_AREA_X1(area_ptr,x1) (area_ptr)->width = (x1) - (area_ptr)->x0 |
|
62 # define SET_GUI_AREA_Y1(area_ptr,y1) (area_ptr)->height = (y1) - (area_ptr)->y0 |
|
63 #else |
|
64 # error BAD DEFINITIONS IN GUI_COMMON.H |
|
65 #endif |
|
66 |