42 FXRectangle(FXshort xx,FXshort yy,FXshort ww,FXshort hh):x(xx),y(yy),w(ww),h(hh){ }
43 FXRectangle(
const FXRectangle& src):x(src.x),y(src.y),w(src.w),h(src.h){ }
44 FXRectangle(
const FXPoint& p,
const FXSize& s):x(p.x),y(p.y),w(s.w),h(s.h){ }
45 FXRectangle(
const FXPoint& topleft,
const FXPoint& bottomright):x(topleft.x),y(topleft.y),w(bottomright.x-topleft.x+1),h(bottomright.y-topleft.y+1){ }
48 FXbool
empty()
const {
return w<=0 || h<=0; }
51 FXbool
operator!()
const {
return x==0 && y==0 && w==0 && h==0; }
55 FXbool operator!=(
const FXRectangle& r)
const {
return x!=r.x || y!=r.y || w!=r.w || h!=r.h; }
58 FXbool
contains(
const FXPoint& p)
const {
return x<=p.x && y<=p.y && p.x<x+w && p.y<y+h; }
59 FXbool contains(FXshort xx,FXshort yy)
const {
return x<=xx && y<=yy && xx<x+w && yy<y+h; }
62 FXbool
contains(
const FXRectangle& r)
const {
return x<=r.x && y<=r.y && r.x+r.w<=x+w && r.y+r.h<=y+h; }
66 FXRectangle& move(FXshort dx,FXshort dy){ x+=dx; y+=dy;
return *
this; }
69 FXRectangle& grow(FXshort margin);
70 FXRectangle& grow(FXshort hormargin,FXshort vermargin);
71 FXRectangle& grow(FXshort leftmargin,FXshort rightmargin,FXshort topmargin,FXshort bottommargin);
74 FXRectangle& shrink(FXshort margin);
75 FXRectangle& shrink(FXshort hormargin,FXshort vermargin);
76 FXRectangle& shrink(FXshort leftmargin,FXshort rightmargin,FXshort topmargin,FXshort bottommargin);
81 FXPoint bl()
const {
return FXPoint(x,y+h-1); }
82 FXPoint br()
const {
return FXPoint(x+w-1,y+h-1); }
94 FXRectangle&
set(
const FXPoint& topleft,
const FXPoint& bottomright){ x=topleft.x; y=topleft.y; w=bottomright.x-topleft.x+1; h=bottomright.y-topleft.y+1;
return *
this; }
97 FXRectangle&
set(FXshort xx,FXshort yy,FXshort ww,FXshort hh){ x=xx; y=yy; w=ww; h=hh;
return *
this; }
113 inline FXbool overlap(
const FXRectangle& a,
const FXRectangle& b){
return b.x<a.x+a.w && b.y<a.y+a.h && a.x<b.x+b.w && a.y<b.y+b.h; }
116 extern FXAPI FXStream& operator<<(FXStream& store,
const FXRectangle& r);
119 extern FXAPI FXStream& operator>>(FXStream& store,FXRectangle& r);
Rectangle.
Definition: FXRectangle.h:32
FXbool contains(const FXPoint &p) const
Point in rectangle.
Definition: FXRectangle.h:58
FXRectangle & move(const FXPoint &p)
Return moved rectangle.
Definition: FXRectangle.h:65
FXRectangle & operator=(const FXRectangle &r)
Assignment.
Definition: FXRectangle.h:85
Size.
Definition: FXSize.h:28
FXPoint tl() const
Corners.
Definition: FXRectangle.h:79
FXRectangle()
Constructors.
Definition: FXRectangle.h:41
FXbool empty() const
Test if empty.
Definition: FXRectangle.h:48
Definition: FX4Splitter.h:28
FXbool contains(const FXRectangle &r) const
Rectangle properly contained in rectangle.
Definition: FXRectangle.h:62
FXbool operator==(const FXRectangle &r) const
Equality.
Definition: FXRectangle.h:54
Point.
Definition: FXPoint.h:32
FXbool operator!() const
Test if zero.
Definition: FXRectangle.h:51