Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 103 lines (90 sloc) 3.725 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
/***********************************************************************
 * FXRuby -- the Ruby language bindings for the FOX GUI toolkit.
 * Copyright (c) 2001-2009 by Lyle Johnson. All Rights Reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 * For further information please contact the author by e-mail
 * at "lyle@lylejohnson.name".
 ***********************************************************************/

%rename("contains?") FXRectangle::contains(const FXPoint& p) const;
%rename("contains?") FXRectangle::contains(FXshort xx,FXshort yy) const;
%rename("contains?") FXRectangle::contains(const FXRectangle& r) const;
%rename("grow!") FXRectangle::grow(FXshort margin);
%rename("grow!") FXRectangle::grow(FXshort hormargin,FXshort vermargin);
%rename("grow!") FXRectangle::grow(FXshort leftmargin,FXshort rightmargin,FXshort topmargin,FXshort bottommargin);
%rename("move!") FXRectangle::move(const FXPoint&);
%rename("move!") FXRectangle::move(FXshort dx,FXshort dy);
%rename("overlaps?") FXRectangle::overlap(const FXRectangle& p) const;
%rename("shrink!") FXRectangle::shrink(FXshort margin);
%rename("shrink!") FXRectangle::shrink(FXshort hormargin,FXshort vermargin);
%rename("shrink!") FXRectangle::shrink(FXshort leftmargin,FXshort rightmargin,FXshort topmargin,FXshort bottommargin);

/// Rectangle
class FXRectangle {
public:
  FXshort x;
  FXshort y;
  FXshort w;
  FXshort h;
public:

  /// Constructors
  FXRectangle();
  FXRectangle(FXshort xx,FXshort yy,FXshort ww,FXshort hh);
  FXRectangle(const FXPoint& p,const FXSize& s);
  FXRectangle(const FXPoint& topleft,const FXPoint& bottomright);

  %extend {
    /// Equality
    bool operator==(const FXRectangle& p) const {
      return *self == p;
      }
    }

  /// Point in rectangle
  bool contains(const FXPoint& p) const;
  bool contains(FXshort xx,FXshort yy) const;

  /// Rectangle properly contained in rectangle
  bool contains(const FXRectangle& r) const;

  %extend {
    /// Rectangles overlap
    bool overlap(const FXRectangle& p) const {
      return overlap(*self,p);
      }
    }

  /// Return moved rectangle
  FXRectangle& move(const FXPoint& p);
  FXRectangle& move(FXshort dx,FXshort dy);

  /// Grow by amount
  FXRectangle& grow(FXshort margin);
  FXRectangle& grow(FXshort hormargin,FXshort vermargin);
  FXRectangle& grow(FXshort leftmargin,FXshort rightmargin,FXshort topmargin,FXshort bottommargin);

  /// Shrink by amount
  FXRectangle& shrink(FXshort margin);
  FXRectangle& shrink(FXshort hormargin,FXshort vermargin);
  FXRectangle& shrink(FXshort leftmargin,FXshort rightmargin,FXshort topmargin,FXshort bottommargin);

  /// Corners
  FXPoint tl() const;
  FXPoint tr() const;
  FXPoint bl() const;
  FXPoint br() const;

  %extend {
    /// Union with rectangle
    FXRectangle operator+(const FXRectangle& p) const {
      return *self + p;
      }

    /// Intersection with rectangle
    FXRectangle operator*(const FXRectangle& p) const {
      return *self * p;
      }
    }
  };
Something went wrong with that request. Please try again.