diff options
| author | Greg Ercolano <erco@seriss.com> | 2023-01-08 09:42:58 -0800 |
|---|---|---|
| committer | Greg Ercolano <erco@seriss.com> | 2023-01-08 09:42:58 -0800 |
| commit | 1324c623fe768289beb3a6bb85fe0c859628714a (patch) | |
| tree | fa212668b4ce6e434202c2b856e55f9c5fc9b2c8 /FL | |
| parent | 09db3a6dea4b6c6d23a81ba32c84e278c1964184 (diff) | |
Add new Fl_Rect::inset(lt,top,rt,bot) method
Diffstat (limited to 'FL')
| -rw-r--r-- | FL/Fl_Rect.H | 18 |
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 |
