1 #ifndef SCREEN_RECTANGLE_CLASS
2 #define SCREEN_RECTANGLE_CLASS
4 /*****************************************************************************\
6 * Name : screen_rectangle *
7 * Author : Chris Koeritz *
9 *******************************************************************************
10 * Copyright (c) 1992-$now By Author. This program is free software; you can *
11 * redistribute it and/or modify it under the terms of the GNU General Public *
12 * License as published by the Free Software Foundation; either version 2 of *
13 * the License or (at your option) any later version. This is online at: *
14 * http://www.fsf.org/copyleft/gpl.html *
15 * Please send any updates to: fred@gruntose.com *
16 \*****************************************************************************/
18 #include <application/windoze_helper.h>
20 #include "rectangle.h"
24 struct tagPOINT; struct tagRECT;
32 //! a simple class used to describe points on a graphics screen.
34 class screen_point : public point<int>
37 screen_point(int x = 0, int y = 0) : point<int>(x, y) {}
38 screen_point(int r, double_angle theta) : point<int>(r, theta) {}
39 screen_point(const point<int> &original) : point<int>(original) {}
40 DEFINE_CLASS_NAME("screen_point");
43 screen_point(const tagPOINT &original);
44 //!< helpful conversions from basic ms-windows type.
46 //!< helpful conversions to basic ms-windows type.
50 const screen_point &screen_origin();
51 //!< the origin of the screen coordinate system (which is top-left here).
55 //! Represents a rectangle as interpreted on display screens.
57 The origin is the top-left corner of the rectangle and the y coordinate
58 gets larger as one goes downwards. This class is primarily useful in
59 conjunction with a windowing environment.
62 class screen_rectangle : public rectangle<int>
65 screen_rectangle(const screen_point &vertex_1, const screen_point &vertex_2);
66 screen_rectangle(int x_1 = 0, int y_1 = 0, int x_2 = 0, int y_2 = 0);
67 screen_rectangle(const rectangle<int> &init);
69 screen_rectangle order() const;
70 //!< Re-orders the vertices to match expectations.
71 /*!< This is just like rectangle::order() except that the first vertex
72 will be closest to the top-left of the screen. */
74 screen_point top_left() const;
75 screen_point bottom_left() const;
76 screen_point top_right() const;
77 screen_point bottom_right() const;
79 int left() const { return top_left().x(); }
80 int top() const { return top_left().y(); }
81 int right() const { return bottom_right().x(); }
82 int bottom() const { return bottom_right().y(); }
85 screen_rectangle(const tagRECT &original);
86 //!< helpful conversion from basic ms-windows type.
87 operator tagRECT() const;
88 //!< helpful conversion to basic ms-windows type.