summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FL/Fl_Rect.H18
1 files changed, 18 insertions, 0 deletions
diff --git a/FL/Fl_Rect.H b/FL/Fl_Rect.H
index a73a0e732..0de6dfcb2 100644
--- a/FL/Fl_Rect.H
+++ b/FL/Fl_Rect.H
@@ -125,6 +125,24 @@ public:
w_ -= Fl::box_dw(bt);
h_ -= Fl::box_dh(bt);
}
+
+ /** Move all edges in by \p left, \p top, \p right, \p bottom.
+
+ Shrinks the rectangle on all sides keeping the center of the
+ rectangle at the same spot.
+
+ If any value is negative, the rectangle is enlarged.
+
+ Values are not range checked; it is possible to create
+ an invalid or empty rectangle.
+ */
+ void inset(int left, int top, int right, int bottom) {
+ x_ += left;
+ y_ += top;
+ w_ -= (left + right);
+ h_ -= (top + bottom);
+ }
+
}; // class Fl_Rect
#endif // Fl_Rect_H