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