00001 #ifndef SCREEN_RECTANGLE_CLASS 00002 #define SCREEN_RECTANGLE_CLASS 00003 00004 /*****************************************************************************\ 00005 * * 00006 * Name : screen_rectangle * 00007 * Author : Chris Koeritz * 00008 * * 00009 ******************************************************************************* 00010 * Copyright (c) 1992-$now By Author. This program is free software; you can * 00011 * redistribute it and/or modify it under the terms of the GNU General Public * 00012 * License as published by the Free Software Foundation; either version 2 of * 00013 * the License or (at your option) any later version. This is online at: * 00014 * http://www.fsf.org/copyleft/gpl.html * 00015 * Please send any updates to: fred@gruntose.com * 00016 \*****************************************************************************/ 00017 00018 #include <application/windoze_helper.h> 00019 00020 #include "rectangle.h" 00021 00022 #ifdef __WIN32__ 00023 // forward. 00024 struct tagPOINT; struct tagRECT; 00025 #endif 00026 00027 namespace geometric { 00028 00029 // forward. 00030 class double_angle; 00031 00033 00034 class screen_point : public point<int> 00035 { 00036 public: 00037 screen_point(int x = 0, int y = 0) : point<int>(x, y) {} 00038 screen_point(int r, double_angle theta) : point<int>(r, theta) {} 00039 screen_point(const point<int> &original) : point<int>(original) {} 00040 DEFINE_CLASS_NAME("screen_point"); 00041 00042 #ifdef __WIN32__ 00043 screen_point(const tagPOINT &original); 00045 operator tagPOINT(); 00047 #endif 00048 }; 00049 00050 const screen_point &screen_origin(); 00052 00054 00056 00062 class screen_rectangle : public rectangle<int> 00063 { 00064 public: 00065 screen_rectangle(const screen_point &vertex_1, const screen_point &vertex_2); 00066 screen_rectangle(int x_1 = 0, int y_1 = 0, int x_2 = 0, int y_2 = 0); 00067 screen_rectangle(const rectangle<int> &init); 00068 00069 screen_rectangle order() const; 00071 00074 screen_point top_left() const; 00075 screen_point bottom_left() const; 00076 screen_point top_right() const; 00077 screen_point bottom_right() const; 00078 00079 int left() const { return top_left().x(); } 00080 int top() const { return top_left().y(); } 00081 int right() const { return bottom_right().x(); } 00082 int bottom() const { return bottom_right().y(); } 00083 00084 #ifdef __WIN32__ 00085 screen_rectangle(const tagRECT &original); 00087 operator tagRECT() const; 00089 #endif 00090 }; 00091 00092 } // namespace. 00093 00094 #endif 00095
1.6.3