feisty meow concerns codebase  2.140
screen_rectangle.h
Go to the documentation of this file.
1 #ifndef SCREEN_RECTANGLE_CLASS
2 #define SCREEN_RECTANGLE_CLASS
3 
4 /*****************************************************************************\
5 * *
6 * Name : screen_rectangle *
7 * Author : Chris Koeritz *
8 * *
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 \*****************************************************************************/
17 
19 
20 #include "rectangle.h"
21 
22 #ifdef __WIN32__
23  // forward.
24  struct tagPOINT; struct tagRECT;
25 #endif
26 
27 namespace geometric {
28 
29 // forward.
30 class double_angle;
31 
33 
34 class screen_point : public point<int>
35 {
36 public:
37  screen_point(int x = 0, int y = 0) : point<int>(x, y) {}
39  screen_point(const point<int> &original) : point<int>(original) {}
40  DEFINE_CLASS_NAME("screen_point");
41 
42 #ifdef __WIN32__
43  screen_point(const tagPOINT &original);
45  operator tagPOINT();
47 #endif
48 };
49 
52 
54 
56 
62 class screen_rectangle : public rectangle<int>
63 {
64 public:
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);
68 
69  screen_rectangle order() const;
71 
74  screen_point top_left() const;
75  screen_point bottom_left() const;
76  screen_point top_right() const;
77  screen_point bottom_right() const;
78 
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(); }
83 
84 #ifdef __WIN32__
85  screen_rectangle(const tagRECT &original);
87  operator tagRECT() const;
89 #endif
90 };
91 
92 } // namespace.
93 
94 #endif
95 
double_angle provides a non-templated class for forward declarations.
Definition: angle.h:97
Represents a geometric point.
Definition: point.h:37
int r() const
Definition: point.h:122
int x() const
Definition: point.h:47
int y() const
Definition: point.h:48
double_angle theta() const
Definition: point.h:140
Represents a geometric rectangle.
Definition: rectangle.h:28
point< int > vertex_1() const
Definition: rectangle.h:148
point< int > vertex_2() const
Definition: rectangle.h:152
a simple class used to describe points on a graphics screen.
screen_point(const point< int > &original)
screen_point(int r, double_angle theta)
screen_point(int x=0, int y=0)
DEFINE_CLASS_NAME("screen_point")
Represents a rectangle as interpreted on display screens.
screen_point bottom_right() const
screen_point bottom_left() const
screen_point top_left() const
screen_point top_right() const
screen_rectangle order() const
Re-orders the vertices to match expectations.
screen_rectangle(const screen_point &vertex_1, const screen_point &vertex_2)
Contains all of our objects for geometry and avoids name clashes.
Definition: angle.h:25
const screen_point & screen_origin()
the origin of the screen coordinate system (which is top-left here).
Aids in achievement of platform independence.