sptk2 logo
SPTK Home Page
CRect.h
1/*
2╔══════════════════════════════════════════════════════════════════════════════╗
3║ SIMPLY POWERFUL TOOLKIT (SPTK) ║
4╟──────────────────────────────────────────────────────────────────────────────╢
5║ copyright © 1999-2022 Alexey Parshin. All rights reserved. ║
6║ email alexeyp@gmail.com ║
7╚══════════════════════════════════════════════════════════════════════════════╝
8┌──────────────────────────────────────────────────────────────────────────────┐
9│ This library is free software; you can redistribute it and/or modify it │
10│ under the terms of the GNU Library General Public License as published by │
11│ the Free Software Foundation; either version 2 of the License, or (at your │
12│ option) any later version. │
13│ │
14│ This library is distributed in the hope that it will be useful, but │
15│ WITHOUT ANY WARRANTY; without even the implied warranty of │
16│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library │
17│ General Public License for more details. │
18│ │
19│ You should have received a copy of the GNU Library General Public License │
20│ along with this library; if not, write to the Free Software Foundation, │
21│ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. │
22│ │
23│ Please report all bugs and problems to alexeyp@gmail.com. │
24└──────────────────────────────────────────────────────────────────────────────┘
25*/
26
27#pragma once
28
29namespace sptk {
30
39class CRect
40{
44 int m_x;
45
49 int m_y;
50
54 int m_w;
55
59 int m_h;
60
61public:
69 CRect(int x = 0, int y = 0, int w = 0, int h = 0)
70 : m_x(x)
71 , m_y(y)
72 , m_w(w)
73 , m_h(h)
74 {
75 }
76
80 int x() const
81 {
82 return m_x;
83 }
84
88 int y() const
89 {
90 return m_y;
91 }
92
96 int w() const
97 {
98 return m_w;
99 }
100
104 int h() const
105 {
106 return m_h;
107 }
108
114 void move(int x, int y)
115 {
116 m_x = x;
117 m_y = y;
118 }
119
125 void size(int w, int h)
126 {
127 m_w = w;
128 m_h = h;
129 }
130
136 void shift(int dx, int dy)
137 {
138 m_x += dx;
139 m_y += dy;
140 }
141
147 void shrink(int dw, int dh)
148 {
149 m_w -= dw;
150 m_h -= dh;
151 }
152
158 void expand(int dw, int dh)
159 {
160 m_w += dw;
161 m_h += dh;
162 }
163};
167} // namespace sptk
Definition: CRect.h:40
void expand(int dw, int dh)
Definition: CRect.h:158
void shift(int dx, int dy)
Definition: CRect.h:136
int x() const
Definition: CRect.h:80
void move(int x, int y)
Definition: CRect.h:114
void shrink(int dw, int dh)
Definition: CRect.h:147
void size(int w, int h)
Definition: CRect.h:125
int y() const
Definition: CRect.h:88
int h() const
Definition: CRect.h:104
CRect(int x=0, int y=0, int w=0, int h=0)
Definition: CRect.h:69
int w() const
Definition: CRect.h:96

Fri Oct 14 2022 09:58:31: SPTK 5.4.1