Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Fl_Rect.h

00001 /*
00002  * $Id: Fl_Rect.h,v 1.1 2003/04/20 05:19:52 parshin Exp $
00003  *
00004  * Extended Fast Light Toolkit (EFLTK)
00005  * Copyright (C) 2002-2003 by EDE-Team
00006  * WWW: http://www.sourceforge.net/projects/ede
00007  *
00008  * Fast Light Toolkit (FLTK)
00009  * Copyright (C) 1998-2003 by Bill Spitzak and others.
00010  * WWW: http://www.fltk.org
00011  *
00012  * This library is distributed under the GNU LIBRARY GENERAL PUBLIC LICENSE
00013  * version 2. See COPYING for details.
00014  *
00015  * Author : Mikko Lahteenmaki
00016  * Email  : mikko@fltk.net
00017  *
00018  * Please report all bugs and problems to "efltk-bugs@fltk.net"
00019  *
00020  */
00021 
00022 #ifndef __FL_RECT_H__
00023 #define __FL_RECT_H__
00024 
00025 #include "Fl_Point.h"
00026 
00028 class FL_API Fl_Rect
00029 {
00030     int x_, y_, width_, height_;
00031 public:
00032     Fl_Rect() : x_(0), y_(0), width_(0), height_(0) {}
00033     Fl_Rect(int x, int y, int w, int h) : x_(x), y_(y), width_(w), height_(h) {}
00034 
00035     Fl_Rect &operator=( const Fl_Rect &r ) { set(r.x(), r.y(), r.w(), r.h()); return *this; }
00036 
00037     bool pos_in_rect(int xs, int ys) const {
00038         if( xs > x_  && xs < (x_ + width_) && ys > y_  && ys < (y_ + height_) ) {
00039             return true;
00040         }
00041         return false;
00042     }
00043     bool posInRect(int x, int y) const { return pos_in_rect(x,y); }
00044 
00045     bool pos_in_rect(Fl_Point p) const {
00046         if( p.x() > x_  && p.x() < (x_ + width_) && p.y() > y_  && p.y() < (y_ + height_) ) {
00047             return true;
00048         }
00049         return false;
00050     }
00051     bool posInRect(Fl_Point p) const { return pos_in_rect(p); }
00052 
00053     int x() const { return x_; }
00054     int y() const { return y_; }
00055 
00056     int w() const { return width(); }
00057     int width() const { return width_; }
00058 
00059     int h() const { return height(); }
00060     int height() const { return height_; }
00061 
00062     int left() const { return x(); }
00063     int right() const { return x()+w(); }
00064     int top() const { return y(); }
00065     int bottom() const { return y()+h(); }
00066 
00067     void x(int x) { x_ = x; }
00068     void y(int y) { y_ = y; }
00069     void w(int w) { width_ = w; }
00070     void h(int h) { height_ = h; }
00071 
00072     void set(int x, int y, int w, int h) { x_=x; y_=y; width_=w; height_=h; }
00073 };
00074 
00075 #endif

Generated on Thu Jul 31 15:33:45 2003 for eFLTK by doxygen1.2.15