diff options
author | Joel Bosveld <Joel.Bosveld@gmail.com> | 2009-07-03 21:19:48 +0800 |
---|---|---|
committer | Joel Bosveld <Joel.Bosveld@gmail.com> | 2009-07-04 17:27:58 +0800 |
commit | b51c40029a9f776429cabcd745482cb5f04c9b11 (patch) | |
tree | 6091ecf38bf48ad37438bc8a6b16f73e624541ca /src | |
parent | 3b3f9ce97cf85f0bb4f973ce409c74b7b4fde871 (diff) | |
download | zcomp-b51c40029a9f776429cabcd745482cb5f04c9b11.tar.gz zcomp-b51c40029a9f776429cabcd745482cb5f04c9b11.tar.bz2 |
CompRect: add set{Left,Top,Right,Buttom} functions
Diffstat (limited to 'src')
-rw-r--r-- | src/rect.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/rect.cpp b/src/rect.cpp index 6adf10f..b64addf 100644 --- a/src/rect.cpp +++ b/src/rect.cpp @@ -124,6 +124,38 @@ CompRect::setSize (const CompSize& size) mRegion.extents.y2 = mRegion.extents.y1 + size.height (); } +void +CompRect::setLeft (int x1) +{ + mRegion.extents.x1 = x1; + if (mRegion.extents.x2 < x1) + mRegion.extents.x2 = x1; +} + +void +CompRect::setTop (int y1) +{ + mRegion.extents.y1 = y1; + if (mRegion.extents.y2 < y1) + mRegion.extents.y2 = y1; +} + +void +CompRect::setRight (int x2) +{ + mRegion.extents.x2 = x2; + if (mRegion.extents.x1 > x2) + mRegion.extents.x1 = x2; +} + +void +CompRect::setBottom (int y2) +{ + mRegion.extents.y2 = y2; + if (mRegion.extents.y1 > y2) + mRegion.extents.y1 = y2; +} + bool CompRect::contains (const CompPoint& point) const { |