aboutsummaryrefslogtreecommitdiff
path: root/lib/gdi/erect.h
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2004-09-25 16:13:48 +0000
committerFelix Domke <tmbinc@elitedvb.net>2004-09-25 16:13:48 +0000
commit1aeefd997cc362c3b37c1587c5f08891b35c3a75 (patch)
tree621600d89b20531ee9e6497dbc9fb50db8a4d759 /lib/gdi/erect.h
parent636a782d8920b4b52a881a4565c46c06f68785b5 (diff)
downloadenigma2-1aeefd997cc362c3b37c1587c5f08891b35c3a75.tar.gz
enigma2-1aeefd997cc362c3b37c1587c5f08891b35c3a75.zip
- new GUI lib
- fixes
Diffstat (limited to 'lib/gdi/erect.h')
-rw-r--r--lib/gdi/erect.h44
1 files changed, 11 insertions, 33 deletions
diff --git a/lib/gdi/erect.h b/lib/gdi/erect.h
index 9eaa7906..a67d0fb9 100644
--- a/lib/gdi/erect.h
+++ b/lib/gdi/erect.h
@@ -11,7 +11,8 @@ class eRect // rectangle class
{
friend class gRegion;
public:
- eRect() { x1 = y1 = x2 = y2 = 0; }
+ /* eRect() constructs an INVALID rectangle. */
+ eRect() { x1 = y1 = 0; x2 = y2 = -1; }
eRect( const ePoint &topleft, const ePoint &bottomright );
// we use this contructor very often... do it inline...
@@ -25,9 +26,8 @@ public:
eRect( int left, int top, int width, int height );
- bool isNull() const;
- bool isEmpty() const;
- bool isValid() const;
+ bool empty() const;
+ bool valid() const;
eRect normalize() const;
int left() const;
@@ -103,7 +103,10 @@ public:
friend bool operator==( const eRect &, const eRect & );
friend bool operator!=( const eRect &, const eRect & );
-
+
+ static eRect emptyRect() { return eRect(0, 0, 0, 0); }
+ static eRect invalidRect() { return eRect(); }
+
private:
int x1;
int y1;
@@ -116,28 +119,6 @@ bool operator!=( const eRect &, const eRect & );
/*****************************************************************************
- eRect stream functions
- *****************************************************************************/
-namespace std
-{
- inline ostream &operator<<( ostream & s, const eRect & r )
- {
- s << r.left() << r.top()
- << r.right() << r.bottom();
-
- return s;
- }
-
- inline istream &operator>>( istream & s, eRect & r )
- {
- int x1, y1, x2, y2;
- s >> x1 >> y1 >> x2 >> y2;
- r.setCoords( x1, y1, x2, y2 );
- return s;
- }
-}
-
-/*****************************************************************************
eRect inline member functions
*****************************************************************************/
@@ -149,13 +130,10 @@ inline eRect::eRect( int left, int top, int width, int height )
y2 = top+height;
}
-inline bool eRect::isNull() const
-{ return x2 == x1 && y2 == y1; }
-
-inline bool eRect::isEmpty() const
-{ return x1 >= x2 || y1 >= y2; }
+inline bool eRect::empty() const
+{ return x1 == x2 && y1 == y2; }
-inline bool eRect::isValid() const
+inline bool eRect::valid() const
{ return x1 <= x2 && y1 <= y2; }
inline int eRect::left() const