| 15 | |
| 16 | template<typename T> |
| 17 | struct TRect |
| 18 | { |
| 19 | T left{}; |
| 20 | T top{}; |
| 21 | T right{}; |
| 22 | T bottom{}; |
| 23 | |
| 24 | TRect() = default; |
| 25 | |
| 26 | TRect(T const& _left, T const& _top, T const& _right, T const& _bottom) : |
| 27 | left(_left), |
| 28 | top(_top), |
| 29 | right(_right), |
| 30 | bottom(_bottom) |
| 31 | { |
| 32 | } |
| 33 | |
| 34 | |
| 35 | TRect& operator-=(TRect const& _obj) |
| 36 | { |
| 37 | left -= _obj.left; |
| 38 | top -= _obj.top; |
| 39 | right -= _obj.right; |
| 40 | bottom -= _obj.bottom; |
| 41 | return *this; |
| 42 | } |
| 43 | |
| 44 | TRect& operator+=(TRect const& _obj) |
| 45 | { |
| 46 | left += _obj.left; |
| 47 | top += _obj.top; |
| 48 | right += _obj.right; |
| 49 | bottom += _obj.bottom; |
| 50 | return *this; |
| 51 | } |
| 52 | |
| 53 | TRect operator-(TRect const& _obj) const |
| 54 | { |
| 55 | return TRect(left - _obj.left, top - _obj.top, right - _obj.right, bottom - _obj.bottom); |
| 56 | } |
| 57 | |
| 58 | TRect operator+(TRect const& _obj) const |
| 59 | { |
| 60 | return TRect(left + _obj.left, top + _obj.top, right + _obj.right, bottom + _obj.bottom); |
| 61 | } |
| 62 | |
| 63 | template<typename U> |
| 64 | TRect& operator=(TRect<U> const& _obj) |
| 65 | { |
| 66 | left = _obj.left; |
| 67 | top = _obj.top; |
| 68 | right = _obj.right; |
| 69 | bottom = _obj.bottom; |
| 70 | return *this; |
| 71 | } |
| 72 | |
| 73 | bool operator==(TRect const& _obj) const |
| 74 | { |