]>
Commit | Line | Data |
---|---|---|
8efb2907 WS |
1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
2 | %% Name: size.tex | |
3 | %% Purpose: wxSize documentation | |
4 | %% Author: wxTeam | |
5 | %% Created: | |
6 | %% RCS-ID: $Id$ | |
7 | %% Copyright: (c) wxTeam | |
8 | %% License: wxWindows license | |
9 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
10 | ||
a660d684 KB |
11 | \section{\class{wxSize}}\label{wxsize} |
12 | ||
13 | A {\bf wxSize} is a useful data structure for graphics operations. | |
d75c7970 VZ |
14 | It simply contains integer {\it width} and {\it height} members. |
15 | ||
fc2171bd | 16 | wxSize is used throughout wxWidgets as well as wxPoint which, although almost |
d75c7970 VZ |
17 | equivalent to wxSize, has a different meaning: wxPoint represents a position |
18 | while wxSize - the size. | |
a660d684 | 19 | |
c9110876 VS |
20 | \pythonnote{wxPython defines aliases for the {\tt x} and {\tt y} members |
21 | named {\tt width} and {\tt height} since it makes much more sense for | |
d75c7970 | 22 | sizes. |
06d20283 RD |
23 | } |
24 | ||
954b8ae6 | 25 | \wxheading{Derived from} |
a660d684 | 26 | |
9838df2c | 27 | None |
a660d684 | 28 | |
954b8ae6 JS |
29 | \wxheading{Include files} |
30 | ||
31 | <wx/gdicmn.h> | |
32 | ||
a7af285d VZ |
33 | \wxheading{Library} |
34 | ||
35 | \helpref{wxCore}{librarieslist} | |
36 | ||
a660d684 KB |
37 | \wxheading{See also} |
38 | ||
39 | \helpref{wxPoint}{wxpoint}, \helpref{wxRealPoint}{wxrealpoint} | |
40 | ||
41 | \latexignore{\rtfignore{\wxheading{Members}}} | |
42 | ||
706f1421 | 43 | |
08f1d438 | 44 | \membersection{wxSize::wxSize}\label{wxsizector} |
a660d684 KB |
45 | |
46 | \func{}{wxSize}{\void} | |
47 | ||
d75c7970 | 48 | \func{}{wxSize}{\param{int}{ width}, \param{int}{ height}} |
a660d684 KB |
49 | |
50 | Creates a size object. | |
51 | ||
5b087ae2 | 52 | |
706f1421 | 53 | |
23359747 VZ |
54 | \membersection{wxSize::DecBy}\label{wxsizedecby} |
55 | ||
56 | \func{void}{DecBy}{\param{const wxSize\& }{size}} | |
57 | ||
58 | \func{void}{DecBy}{\param{int }{dx}, \param{int }{dy}} | |
59 | ||
60 | \func{void}{DecBy}{\param{int }{d}} | |
61 | ||
62 | Decreases the size in x- and y- directions | |
63 | ||
64 | \begin{enumerate} | |
65 | \item By \arg{size.x} and \arg{size.y} for the first overload | |
66 | \item By \arg{dx} and \arg{dy} for the second one | |
67 | \item By \arg{d} and \arg{d} for the third one | |
68 | \end{enumerate} | |
69 | ||
70 | \wxheading{See also} | |
71 | ||
72 | \helpref{IncBy}{wxsizeincby} | |
73 | ||
74 | ||
5b087ae2 VZ |
75 | \membersection{wxSize::DecTo}\label{wxsizedecto} |
76 | ||
9a75ba66 | 77 | \func{void}{DecTo}{\param{const wxSize\& }{size}} |
5b087ae2 VZ |
78 | |
79 | Decrements this object so that both of its dimensions are not greater than the | |
36be32ec | 80 | corresponding dimensions of the \arg{size}. |
5b087ae2 VZ |
81 | |
82 | \wxheading{See also} | |
83 | ||
84 | \helpref{IncTo}{wxsizeincto} | |
85 | ||
86 | ||
706f1421 VZ |
87 | \membersection{wxSize::IsFullySpecified}\label{wxsizeisfullyspecified} |
88 | ||
7b0c238d | 89 | \constfunc{bool}{IsFullySpecified}{\void} |
706f1421 VZ |
90 | |
91 | Returns \true if neither of the size object components is equal to $-1$, which | |
8efb2907 | 92 | is used as default for the size values in wxWidgets (hence the predefined |
706f1421 VZ |
93 | \texttt{wxDefaultSize} has both of its components equal to $-1$). |
94 | ||
8efb2907 | 95 | This method is typically used before calling |
706f1421 VZ |
96 | \helpref{SetDefaults}{wxsizesetdefaults}. |
97 | ||
98 | ||
d75c7970 | 99 | \membersection{wxSize::GetWidth}\label{wxsizegetwidth} |
a660d684 | 100 | |
d75c7970 | 101 | \constfunc{int}{GetWidth}{\void} |
a660d684 | 102 | |
d75c7970 | 103 | Gets the width member. |
a660d684 | 104 | |
706f1421 | 105 | |
d75c7970 | 106 | \membersection{wxSize::GetHeight}\label{wxsizegetheight} |
a660d684 | 107 | |
d75c7970 | 108 | \constfunc{int}{GetHeight}{\void} |
a660d684 | 109 | |
d75c7970 | 110 | Gets the height member. |
a660d684 | 111 | |
5b087ae2 | 112 | |
23359747 VZ |
113 | \membersection{wxSize::IncBy}\label{wxsizeincby} |
114 | ||
115 | \func{void}{IncBy}{\param{const wxSize\& }{size}} | |
116 | ||
117 | \func{void}{IncBy}{\param{int }{dx}, \param{int }{dy}} | |
118 | ||
119 | \func{void}{IncBy}{\param{int }{d}} | |
120 | ||
121 | Increases the size in x- and y- directions | |
122 | ||
123 | \begin{enumerate} | |
124 | \item By \arg{size.x} and \arg{size.y} for the first overload | |
125 | \item By \arg{dx} and \arg{dy} for the second one | |
126 | \item By \arg{d} and \arg{d} for the third one | |
127 | \end{enumerate} | |
128 | ||
129 | \wxheading{See also} | |
130 | ||
131 | \helpref{DecBy}{wxsizedecby} | |
132 | ||
706f1421 | 133 | |
5b087ae2 VZ |
134 | \membersection{wxSize::IncTo}\label{wxsizeincto} |
135 | ||
9a75ba66 | 136 | \func{void}{IncTo}{\param{const wxSize\& }{size}} |
5b087ae2 VZ |
137 | |
138 | Increments this object so that both of its dimensions are not less than the | |
36be32ec | 139 | corresponding dimensions of the \arg{size}. |
5b087ae2 VZ |
140 | |
141 | \wxheading{See also} | |
142 | ||
143 | \helpref{DecTo}{wxsizedecto} | |
144 | ||
145 | ||
706f1421 | 146 | |
8efb2907 WS |
147 | \membersection{wxSize::Scale}\label{wxsizescale} |
148 | ||
c5bad604 | 149 | \func{wxSize\&}{Scale}{\param{float}{ xscale}, \param{float}{ yscale}} |
8efb2907 WS |
150 | |
151 | Scales the dimensions of this object by the given factors. | |
152 | If you want to scale both dimensions by the same factor you can also use | |
153 | the \helpref{operator *=}{wxsizeoperators} | |
154 | ||
c5bad604 | 155 | Returns a reference to this object (so that you can concatenate other operations in the same line). |
8efb2907 WS |
156 | |
157 | ||
d75c7970 | 158 | \membersection{wxSize::Set}\label{wxsizeset} |
a660d684 | 159 | |
d75c7970 | 160 | \func{void}{Set}{\param{int}{ width}, \param{int}{ height}} |
a660d684 | 161 | |
d75c7970 | 162 | Sets the width and height members. |
a660d684 | 163 | |
706f1421 VZ |
164 | |
165 | \membersection{wxSize::SetDefaults}\label{wxsizesetdefaults} | |
166 | ||
167 | \func{void}{SetDefaults}{\param{const wxSize\& }{sizeDefault}} | |
168 | ||
169 | Combine this size object with another one replacing the default (i.e. equal | |
170 | to $-1$) components of this object with those of the other. It is typically | |
171 | used like this: | |
172 | \begin{verbatim} | |
173 | if ( !size.IsFullySpecified() ) | |
174 | { | |
175 | size.SetDefaults(GetDefaultSize()); | |
176 | } | |
177 | \end{verbatim} | |
178 | ||
179 | \wxheading{See also} | |
180 | ||
181 | \helpref{IsFullySpecified}{wxsizeisfullyspecified} | |
182 | ||
183 | ||
d75c7970 | 184 | \membersection{wxSize::SetHeight}\label{wxsizesetheight} |
a660d684 | 185 | |
d75c7970 | 186 | \func{void}{SetHeight}{\param{int}{ height}} |
a660d684 | 187 | |
d75c7970 | 188 | Sets the height. |
a660d684 | 189 | |
706f1421 | 190 | |
d75c7970 | 191 | \membersection{wxSize::SetWidth}\label{wxsizesetwidth} |
a660d684 | 192 | |
d75c7970 | 193 | \func{void}{SetWidth}{\param{int}{ width}} |
a660d684 | 194 | |
d75c7970 | 195 | Sets the width. |
a660d684 | 196 | |
706f1421 | 197 | |
8efb2907 | 198 | \membersection{Operators}\label{wxsizeoperators} |
a660d684 KB |
199 | |
200 | \func{void}{operator $=$}{\param{const wxSize\& }{sz}} | |
201 | ||
202 | Assignment operator. | |
203 | ||
204 | ||
bc5e942b | 205 | \func{bool}{operator $==$}{\param{const wxSize\& }{s1}, \param{const wxSize\& }{s2}} |
8efb2907 | 206 | |
bc5e942b | 207 | \func{bool}{operator $!=$}{\param{const wxSize\& }{s1}, \param{const wxSize\& }{s2}} |
8efb2907 | 208 | |
bc5e942b | 209 | \func{wxSize}{operator $+$}{\param{const wxSize\& }{s1}, \param{const wxSize\& }{s2}} |
8efb2907 | 210 | |
bc5e942b | 211 | \func{wxSize}{operator $-$}{\param{const wxSize\& }{s1}, \param{const wxSize\& }{s2}} |
8efb2907 WS |
212 | |
213 | \func{wxSize\&}{operator $+=$}{\param{const wxSize\& }{sz}} | |
214 | ||
215 | \func{wxSize\&}{operator $-=$}{\param{const wxSize\& }{sz}} | |
216 | ||
217 | Operators for comparison, sum and subtraction between \helpref{wxSize}{wxsize} objects. | |
218 | ||
219 | ||
bc5e942b | 220 | \func{wxSize}{operator $/$}{\param{const wxSize\& }{sz}, \param{int }{factor}} |
8efb2907 | 221 | |
bc5e942b VZ |
222 | \func{wxSize}{operator $*$}{\param{const wxSize\& }{sz}, \param{int }{factor}} |
223 | ||
224 | \func{wxSize}{operator $*$}{\param{int }{factor}, \param{const wxSize\& }{sz}} | |
8efb2907 WS |
225 | |
226 | \func{wxSize\&}{operator $/=$}{\param{int }{factor}} | |
227 | ||
228 | \func{wxSize\&}{operator $*=$}{\param{int }{factor}} | |
229 | ||
230 | Operators for division and multiplication between a \helpref{wxSize}{wxsize} object and an integer. | |
b67a86d5 | 231 |