diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2018-03-12 12:57:28 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2018-03-12 12:57:28 +0000 |
| commit | 1b52ead802e1f3b24c33cadacb8d67dbfb209253 (patch) | |
| tree | 9db02c4ee0d18a9c937f28bb9fa80fc6584cbff2 /FL | |
| parent | 371cfd1476de37c4741b6455af77bfc9a07cd9c1 (diff) | |
Android: Reinstated working simple cliping functionality based on an
improved Fl_Rect_Region class instead of Fl_Rect. Commented out
complex clipping.
Android lib and apps now use C++11 because they can (and I like it).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12741 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL')
| -rw-r--r-- | FL/Fl_Rect.H | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/FL/Fl_Rect.H b/FL/Fl_Rect.H index dc09e45a0..91f651392 100644 --- a/FL/Fl_Rect.H +++ b/FL/Fl_Rect.H @@ -40,42 +40,29 @@ public: /** The default constructor creates an empty rectangle (x = y = w = h = 0). */ Fl_Rect() - : x_(0), y_(0), w_(0), h_(0) {} + : x_(0), y_(0), w_(0), h_(0) {} /** This constructor creates a rectangle with x = y = 0 and the given width and height. */ Fl_Rect(int W, int H) - : x_(0), y_(0), w_(W), h_(H) {} + : x_(0), y_(0), w_(W), h_(H) {} /** This constructor creates a rectangle with the given x,y coordinates and the given width and height. */ Fl_Rect(int X, int Y, int W, int H) - : x_(X), y_(Y), w_(W), h_(H) {} + : x_(X), y_(Y), w_(W), h_(H) {} - /** This constructor creates a rectangle based on a widget's position and size. */ + /** Copy constructor. */ + Fl_Rect (const Fl_Rect& r) + : x_(r.x()), y_(r.y()), w_(r.w()), h_(r.h()) {} + + /** This constructor creates a rectangle based a widget's position and size. */ Fl_Rect (const Fl_Widget& widget) - : x_(widget.x()), y_(widget.y()), w_(widget.w()), h_(widget.h()) {} + : x_(widget.x()), y_(widget.y()), w_(widget.w()), h_(widget.h()) {} - /** This constructor creates a rectangle based on a widget's position and size. */ + /** This constructor creates a rectangle based a widget's position and size. */ Fl_Rect (const Fl_Widget* const widget) - : x_(widget->x()), y_(widget->y()), w_(widget->w()), h_(widget->h()) {} - - virtual ~Fl_Rect() { } - - /** Return 1 if the rectangle is empty, width or height are 0 */ - int is_empty() { return (w_<=0)||(h_<=0); } - - /** Set the position and size */ - virtual void set(int x, int y, int w, int h) { x_=x; y_=y; w_=w; h_=h; } - - /** Clone another rectangle */ - virtual void set(Fl_Rect *r) { x_=r->x_; y_=r->y_; w_=r->w_; h_=r->h_; } - - /** return 0 if the rectangles are different, or 1 if they are the same */ - int equals(int x, int y, int w, int h) { return ( (x_==x) && (y_==y) && (w_==w) && (h_==h) ); } - - /** Set the position and size to zero, making this rect empty */ - void clear() { x_ = y_ = w_ = h_ = 0; } + : x_(widget->x()), y_(widget->y()), w_(widget->w()), h_(widget->h()) {} int x() const { return x_; } ///< gets the x coordinate (left edge) int y() const { return y_; } ///< gets the y coordinate (top edge) |
