]>
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 | ||
a660d684 KB |
33 | \wxheading{See also} |
34 | ||
35 | \helpref{wxPoint}{wxpoint}, \helpref{wxRealPoint}{wxrealpoint} | |
36 | ||
37 | \latexignore{\rtfignore{\wxheading{Members}}} | |
38 | ||
706f1421 | 39 | |
08f1d438 | 40 | \membersection{wxSize::wxSize}\label{wxsizector} |
a660d684 KB |
41 | |
42 | \func{}{wxSize}{\void} | |
43 | ||
d75c7970 | 44 | \func{}{wxSize}{\param{int}{ width}, \param{int}{ height}} |
a660d684 KB |
45 | |
46 | Creates a size object. | |
47 | ||
5b087ae2 | 48 | |
706f1421 | 49 | |
23359747 VZ |
50 | \membersection{wxSize::DecBy}\label{wxsizedecby} |
51 | ||
52 | \func{void}{DecBy}{\param{const wxSize\& }{size}} | |
53 | ||
54 | \func{void}{DecBy}{\param{int }{dx}, \param{int }{dy}} | |
55 | ||
56 | \func{void}{DecBy}{\param{int }{d}} | |
57 | ||
58 | Decreases the size in x- and y- directions | |
59 | ||
60 | \begin{enumerate} | |
61 | \item By \arg{size.x} and \arg{size.y} for the first overload | |
62 | \item By \arg{dx} and \arg{dy} for the second one | |
63 | \item By \arg{d} and \arg{d} for the third one | |
64 | \end{enumerate} | |
65 | ||
66 | \wxheading{See also} | |
67 | ||
68 | \helpref{IncBy}{wxsizeincby} | |
69 | ||
70 | ||
5b087ae2 VZ |
71 | \membersection{wxSize::DecTo}\label{wxsizedecto} |
72 | ||
9a75ba66 | 73 | \func{void}{DecTo}{\param{const wxSize\& }{size}} |
5b087ae2 VZ |
74 | |
75 | Decrements this object so that both of its dimensions are not greater than the | |
36be32ec | 76 | corresponding dimensions of the \arg{size}. |
5b087ae2 VZ |
77 | |
78 | \wxheading{See also} | |
79 | ||
80 | \helpref{IncTo}{wxsizeincto} | |
81 | ||
82 | ||
706f1421 VZ |
83 | \membersection{wxSize::IsFullySpecified}\label{wxsizeisfullyspecified} |
84 | ||
7b0c238d | 85 | \constfunc{bool}{IsFullySpecified}{\void} |
706f1421 VZ |
86 | |
87 | Returns \true if neither of the size object components is equal to $-1$, which | |
8efb2907 | 88 | is used as default for the size values in wxWidgets (hence the predefined |
706f1421 VZ |
89 | \texttt{wxDefaultSize} has both of its components equal to $-1$). |
90 | ||
8efb2907 | 91 | This method is typically used before calling |
706f1421 VZ |
92 | \helpref{SetDefaults}{wxsizesetdefaults}. |
93 | ||
94 | ||
d75c7970 | 95 | \membersection{wxSize::GetWidth}\label{wxsizegetwidth} |
a660d684 | 96 | |
d75c7970 | 97 | \constfunc{int}{GetWidth}{\void} |
a660d684 | 98 | |
d75c7970 | 99 | Gets the width member. |
a660d684 | 100 | |
706f1421 | 101 | |
d75c7970 | 102 | \membersection{wxSize::GetHeight}\label{wxsizegetheight} |
a660d684 | 103 | |
d75c7970 | 104 | \constfunc{int}{GetHeight}{\void} |
a660d684 | 105 | |
d75c7970 | 106 | Gets the height member. |
a660d684 | 107 | |
5b087ae2 | 108 | |
23359747 VZ |
109 | \membersection{wxSize::IncBy}\label{wxsizeincby} |
110 | ||
111 | \func{void}{IncBy}{\param{const wxSize\& }{size}} | |
112 | ||
113 | \func{void}{IncBy}{\param{int }{dx}, \param{int }{dy}} | |
114 | ||
115 | \func{void}{IncBy}{\param{int }{d}} | |
116 | ||
117 | Increases the size in x- and y- directions | |
118 | ||
119 | \begin{enumerate} | |
120 | \item By \arg{size.x} and \arg{size.y} for the first overload | |
121 | \item By \arg{dx} and \arg{dy} for the second one | |
122 | \item By \arg{d} and \arg{d} for the third one | |
123 | \end{enumerate} | |
124 | ||
125 | \wxheading{See also} | |
126 | ||
127 | \helpref{DecBy}{wxsizedecby} | |
128 | ||
706f1421 | 129 | |
5b087ae2 VZ |
130 | \membersection{wxSize::IncTo}\label{wxsizeincto} |
131 | ||
9a75ba66 | 132 | \func{void}{IncTo}{\param{const wxSize\& }{size}} |
5b087ae2 VZ |
133 | |
134 | Increments this object so that both of its dimensions are not less than the | |
36be32ec | 135 | corresponding dimensions of the \arg{size}. |
5b087ae2 VZ |
136 | |
137 | \wxheading{See also} | |
138 | ||
139 | \helpref{DecTo}{wxsizedecto} | |
140 | ||
141 | ||
706f1421 | 142 | |
8efb2907 WS |
143 | \membersection{wxSize::Scale}\label{wxsizescale} |
144 | ||
c5bad604 | 145 | \func{wxSize\&}{Scale}{\param{float}{ xscale}, \param{float}{ yscale}} |
8efb2907 WS |
146 | |
147 | Scales the dimensions of this object by the given factors. | |
148 | If you want to scale both dimensions by the same factor you can also use | |
149 | the \helpref{operator *=}{wxsizeoperators} | |
150 | ||
c5bad604 | 151 | Returns a reference to this object (so that you can concatenate other operations in the same line). |
8efb2907 WS |
152 | |
153 | ||
d75c7970 | 154 | \membersection{wxSize::Set}\label{wxsizeset} |
a660d684 | 155 | |
d75c7970 | 156 | \func{void}{Set}{\param{int}{ width}, \param{int}{ height}} |
a660d684 | 157 | |
d75c7970 | 158 | Sets the width and height members. |
a660d684 | 159 | |
706f1421 VZ |
160 | |
161 | \membersection{wxSize::SetDefaults}\label{wxsizesetdefaults} | |
162 | ||
163 | \func{void}{SetDefaults}{\param{const wxSize\& }{sizeDefault}} | |
164 | ||
165 | Combine this size object with another one replacing the default (i.e. equal | |
166 | to $-1$) components of this object with those of the other. It is typically | |
167 | used like this: | |
168 | \begin{verbatim} | |
169 | if ( !size.IsFullySpecified() ) | |
170 | { | |
171 | size.SetDefaults(GetDefaultSize()); | |
172 | } | |
173 | \end{verbatim} | |
174 | ||
175 | \wxheading{See also} | |
176 | ||
177 | \helpref{IsFullySpecified}{wxsizeisfullyspecified} | |
178 | ||
179 | ||
d75c7970 | 180 | \membersection{wxSize::SetHeight}\label{wxsizesetheight} |
a660d684 | 181 | |
d75c7970 | 182 | \func{void}{SetHeight}{\param{int}{ height}} |
a660d684 | 183 | |
d75c7970 | 184 | Sets the height. |
a660d684 | 185 | |
706f1421 | 186 | |
d75c7970 | 187 | \membersection{wxSize::SetWidth}\label{wxsizesetwidth} |
a660d684 | 188 | |
d75c7970 | 189 | \func{void}{SetWidth}{\param{int}{ width}} |
a660d684 | 190 | |
d75c7970 | 191 | Sets the width. |
a660d684 | 192 | |
706f1421 | 193 | |
8efb2907 | 194 | \membersection{Operators}\label{wxsizeoperators} |
a660d684 KB |
195 | |
196 | \func{void}{operator $=$}{\param{const wxSize\& }{sz}} | |
197 | ||
198 | Assignment operator. | |
199 | ||
200 | ||
bc5e942b | 201 | \func{bool}{operator $==$}{\param{const wxSize\& }{s1}, \param{const wxSize\& }{s2}} |
8efb2907 | 202 | |
bc5e942b | 203 | \func{bool}{operator $!=$}{\param{const wxSize\& }{s1}, \param{const wxSize\& }{s2}} |
8efb2907 | 204 | |
bc5e942b | 205 | \func{wxSize}{operator $+$}{\param{const wxSize\& }{s1}, \param{const wxSize\& }{s2}} |
8efb2907 | 206 | |
bc5e942b | 207 | \func{wxSize}{operator $-$}{\param{const wxSize\& }{s1}, \param{const wxSize\& }{s2}} |
8efb2907 WS |
208 | |
209 | \func{wxSize\&}{operator $+=$}{\param{const wxSize\& }{sz}} | |
210 | ||
211 | \func{wxSize\&}{operator $-=$}{\param{const wxSize\& }{sz}} | |
212 | ||
213 | Operators for comparison, sum and subtraction between \helpref{wxSize}{wxsize} objects. | |
214 | ||
215 | ||
bc5e942b | 216 | \func{wxSize}{operator $/$}{\param{const wxSize\& }{sz}, \param{int }{factor}} |
8efb2907 | 217 | |
bc5e942b VZ |
218 | \func{wxSize}{operator $*$}{\param{const wxSize\& }{sz}, \param{int }{factor}} |
219 | ||
220 | \func{wxSize}{operator $*$}{\param{int }{factor}, \param{const wxSize\& }{sz}} | |
8efb2907 WS |
221 | |
222 | \func{wxSize\&}{operator $/=$}{\param{int }{factor}} | |
223 | ||
224 | \func{wxSize\&}{operator $*=$}{\param{int }{factor}} | |
225 | ||
226 | Operators for division and multiplication between a \helpref{wxSize}{wxsize} object and an integer. | |
b67a86d5 | 227 |