4 * Miscellaneous handling of window-related geometries
6 * © 1994-1998 Straylight
9 /*----- Licensing note ----------------------------------------------------*
11 * This file is part of Straylight's Steel library.
13 * Steel is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2, or (at your option)
18 * Steel is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with Steel. If not, write to the Free Software Foundation,
25 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 /* --- Passing window information to coords --- */
45 /* --- Passing individual points --- *
47 * This is actually slightly silly, but we do it this way for compatibility
59 * int coords_x_toscreen(int x,coords_cvtstr *c)
60 * int coords_y_toscreen(int y,coords_cvtstr *c)
61 * int coords_x_toworkarea(int x,coords_cvtstr *c)
62 * int coords_y_toworkarea(int y,coords_cvtstr *c)
65 * Convert x- or y-coordinates from window to screen coordinates or vice-
69 * int x or int y == the coordinate to convert
70 * coords_cvtstr *c == pointer to window information (e.g. cast from a
71 * wimp_wstate or a wimp_redrawstr)
74 * The appropriate screen- or window-relative coordinate
77 int coords_x_toscreen(int x,coords_cvtstr *c);
78 int coords_y_toscreen(int y,coords_cvtstr *c);
79 int coords_x_toworkarea(int x,coords_cvtstr *c);
80 int coords_y_toworkarea(int y,coords_cvtstr *c);
83 * void coords_box_toscreen(wimp_box *b,coords_cvtstr *c)
84 * void coords_box_toworkarea(wimp_box *b,coords_cvtstr *c)
87 * Converts a whole rectangle from window to screen coordinates or vice-
91 * wimp_box *b == pointer to the rectangle to convert
92 * coords_cvtstr *c == pointer to the window information to use
95 void coords_box_toscreen(wimp_box *b,coords_cvtstr *c);
96 void coords_box_toworkarea(wimp_box *b,coords_cvtstr *c);
99 * void coords_point_toscreen(coords_pointstr *p,coords_cvtstr *c)
100 * void coords_point_toworkarea(coords_pointstr *p,coords_cvtstr *c)
103 * Converts a single point from window to screen coordinates or vice-versa.
106 * coords_pointstr *p == pointer to the rectangle to convert
107 * coords_cvtstr *c == pointer to the window information to use
110 void coords_point_toscreen(coords_pointstr *p,coords_cvtstr *c);
111 void coords_point_toworkarea(wimp_box *b,coords_cvtstr *c);
114 * BOOL coords_withinbox(coords_pointstr *p,wimp_box *b)
117 * Returns whether the given point lies within (or on the edge of) the
121 * coords_pointstr *p == pointer to the point
122 * wimp_box *b == pointer to the box
125 * TRUE if the point is indeed within the box, and FALSE otherwise
128 BOOL coords_withinbox(coords_pointstr *p,wimp_box *b);
131 * void coords_offsetbox(wimp_box *source,int ox,int oy,wimp_box *dest)
134 * Nudges the given rectangle by adding the given offsets to the x and y
138 * wimp_box *source == pointer to the rectangle to nudge
139 * int ox == amount to nudge the x-coordinates of the box
140 * int oy == amount to nudge the y-coordinates of the box
141 * wimp_box *dest == pointer to where to put the nudged rectangle (may be
142 * the same as source)
145 void coords_offsetbox(wimp_box *source,int ox,int oy,wimp_box *dest);
148 * BOOL coords_intersects(wimp_box *line,wimp_box *box,int width)
151 * Returns FALSE only if the line specified does not intersect the specified
152 * box. The line is considered to have a thickness of width. The method
153 * used is very approximate, and false positives may occur.
156 * wimp_box *line == pointer to the coordinates of the line
157 * wimp_box *box == pointer to the coordinates of the box
160 * FALSE if the line does not intersect the box
163 BOOL coords_intersects(wimp_box *line,wimp_box *box,int width);
166 * BOOL coords_boxesoverlap(wimp_box *a,wimp_box *b)
169 * Determines whether two boxes overlap at all (useful for checking whether
170 * to redraw something).
173 * wimp_box *a == pointer to one of the rectangles to test
174 * wimp_box *b == pointer to the other rectangle
177 * TRUE if the boxes overlap, or FALSE if they don't
180 BOOL coords_boxesoverlap(wimp_box *a,wimp_box *b);