]>
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 | |
5b087ae2 VZ |
50 | \membersection{wxSize::DecTo}\label{wxsizedecto} |
51 | ||
9a75ba66 | 52 | \func{void}{DecTo}{\param{const wxSize\& }{size}} |
5b087ae2 VZ |
53 | |
54 | Decrements this object so that both of its dimensions are not greater than the | |
36be32ec | 55 | corresponding dimensions of the \arg{size}. |
5b087ae2 VZ |
56 | |
57 | \wxheading{See also} | |
58 | ||
59 | \helpref{IncTo}{wxsizeincto} | |
60 | ||
61 | ||
706f1421 VZ |
62 | \membersection{wxSize::IsFullySpecified}\label{wxsizeisfullyspecified} |
63 | ||
7b0c238d | 64 | \constfunc{bool}{IsFullySpecified}{\void} |
706f1421 VZ |
65 | |
66 | Returns \true if neither of the size object components is equal to $-1$, which | |
8efb2907 | 67 | is used as default for the size values in wxWidgets (hence the predefined |
706f1421 VZ |
68 | \texttt{wxDefaultSize} has both of its components equal to $-1$). |
69 | ||
8efb2907 | 70 | This method is typically used before calling |
706f1421 VZ |
71 | \helpref{SetDefaults}{wxsizesetdefaults}. |
72 | ||
73 | ||
d75c7970 | 74 | \membersection{wxSize::GetWidth}\label{wxsizegetwidth} |
a660d684 | 75 | |
d75c7970 | 76 | \constfunc{int}{GetWidth}{\void} |
a660d684 | 77 | |
d75c7970 | 78 | Gets the width member. |
a660d684 | 79 | |
706f1421 | 80 | |
d75c7970 | 81 | \membersection{wxSize::GetHeight}\label{wxsizegetheight} |
a660d684 | 82 | |
d75c7970 | 83 | \constfunc{int}{GetHeight}{\void} |
a660d684 | 84 | |
d75c7970 | 85 | Gets the height member. |
a660d684 | 86 | |
5b087ae2 | 87 | |
706f1421 | 88 | |
5b087ae2 VZ |
89 | \membersection{wxSize::IncTo}\label{wxsizeincto} |
90 | ||
9a75ba66 | 91 | \func{void}{IncTo}{\param{const wxSize\& }{size}} |
5b087ae2 VZ |
92 | |
93 | Increments this object so that both of its dimensions are not less than the | |
36be32ec | 94 | corresponding dimensions of the \arg{size}. |
5b087ae2 VZ |
95 | |
96 | \wxheading{See also} | |
97 | ||
98 | \helpref{DecTo}{wxsizedecto} | |
99 | ||
100 | ||
706f1421 | 101 | |
8efb2907 WS |
102 | \membersection{wxSize::Scale}\label{wxsizescale} |
103 | ||
104 | \func{void}{Scale}{\param{float}{ xscale}, \param{float}{ yscale}} | |
105 | ||
106 | Scales the dimensions of this object by the given factors. | |
107 | If you want to scale both dimensions by the same factor you can also use | |
108 | the \helpref{operator *=}{wxsizeoperators} | |
109 | ||
110 | ||
111 | ||
d75c7970 | 112 | \membersection{wxSize::Set}\label{wxsizeset} |
a660d684 | 113 | |
d75c7970 | 114 | \func{void}{Set}{\param{int}{ width}, \param{int}{ height}} |
a660d684 | 115 | |
d75c7970 | 116 | Sets the width and height members. |
a660d684 | 117 | |
706f1421 VZ |
118 | |
119 | \membersection{wxSize::SetDefaults}\label{wxsizesetdefaults} | |
120 | ||
121 | \func{void}{SetDefaults}{\param{const wxSize\& }{sizeDefault}} | |
122 | ||
123 | Combine this size object with another one replacing the default (i.e. equal | |
124 | to $-1$) components of this object with those of the other. It is typically | |
125 | used like this: | |
126 | \begin{verbatim} | |
127 | if ( !size.IsFullySpecified() ) | |
128 | { | |
129 | size.SetDefaults(GetDefaultSize()); | |
130 | } | |
131 | \end{verbatim} | |
132 | ||
133 | \wxheading{See also} | |
134 | ||
135 | \helpref{IsFullySpecified}{wxsizeisfullyspecified} | |
136 | ||
137 | ||
d75c7970 | 138 | \membersection{wxSize::SetHeight}\label{wxsizesetheight} |
a660d684 | 139 | |
d75c7970 | 140 | \func{void}{SetHeight}{\param{int}{ height}} |
a660d684 | 141 | |
d75c7970 | 142 | Sets the height. |
a660d684 | 143 | |
706f1421 | 144 | |
d75c7970 | 145 | \membersection{wxSize::SetWidth}\label{wxsizesetwidth} |
a660d684 | 146 | |
d75c7970 | 147 | \func{void}{SetWidth}{\param{int}{ width}} |
a660d684 | 148 | |
d75c7970 | 149 | Sets the width. |
a660d684 | 150 | |
706f1421 | 151 | |
8efb2907 | 152 | \membersection{Operators}\label{wxsizeoperators} |
a660d684 KB |
153 | |
154 | \func{void}{operator $=$}{\param{const wxSize\& }{sz}} | |
155 | ||
156 | Assignment operator. | |
157 | ||
158 | ||
8efb2907 WS |
159 | \func{bool}{operator $==$}{\param{const wxSize\& }{sz}} |
160 | ||
161 | \func{bool}{operator $!=$}{\param{const wxSize\& }{sz}} | |
162 | ||
163 | \func{wxSize}{operator $+$}{\param{const wxSize\& }{sz}} | |
164 | ||
165 | \func{wxSize}{operator $-$}{\param{const wxSize\& }{sz}} | |
166 | ||
167 | \func{wxSize\&}{operator $+=$}{\param{const wxSize\& }{sz}} | |
168 | ||
169 | \func{wxSize\&}{operator $-=$}{\param{const wxSize\& }{sz}} | |
170 | ||
171 | Operators for comparison, sum and subtraction between \helpref{wxSize}{wxsize} objects. | |
172 | ||
173 | ||
174 | \func{wxSize}{operator $/$}{\param{int }{factor}} | |
175 | ||
176 | \func{wxSize}{operator $*$}{\param{int }{factor}} | |
177 | ||
178 | \func{wxSize\&}{operator $/=$}{\param{int }{factor}} | |
179 | ||
180 | \func{wxSize\&}{operator $*=$}{\param{int }{factor}} | |
181 | ||
182 | Operators for division and multiplication between a \helpref{wxSize}{wxsize} object and an integer. |