]>
Commit | Line | Data |
---|---|---|
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 | ||
11 | \section{\class{wxSize}}\label{wxsize} | |
12 | ||
13 | A {\bf wxSize} is a useful data structure for graphics operations. | |
14 | It simply contains integer {\it width} and {\it height} members. | |
15 | ||
16 | wxSize is used throughout wxWidgets as well as wxPoint which, although almost | |
17 | equivalent to wxSize, has a different meaning: wxPoint represents a position | |
18 | while wxSize - the size. | |
19 | ||
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 | |
22 | sizes. | |
23 | } | |
24 | ||
25 | \wxheading{Derived from} | |
26 | ||
27 | None | |
28 | ||
29 | \wxheading{Include files} | |
30 | ||
31 | <wx/gdicmn.h> | |
32 | ||
33 | \wxheading{See also} | |
34 | ||
35 | \helpref{wxPoint}{wxpoint}, \helpref{wxRealPoint}{wxrealpoint} | |
36 | ||
37 | \latexignore{\rtfignore{\wxheading{Members}}} | |
38 | ||
39 | ||
40 | \membersection{wxSize::wxSize}\label{wxsizector} | |
41 | ||
42 | \func{}{wxSize}{\void} | |
43 | ||
44 | \func{}{wxSize}{\param{int}{ width}, \param{int}{ height}} | |
45 | ||
46 | Creates a size object. | |
47 | ||
48 | ||
49 | ||
50 | \membersection{wxSize::DecTo}\label{wxsizedecto} | |
51 | ||
52 | \func{void}{DecTo}{\param{const wxSize\& }{size}} | |
53 | ||
54 | Decrements this object so that both of its dimensions are not greater than the | |
55 | corresponding dimensions of the \arg{size}. | |
56 | ||
57 | \wxheading{See also} | |
58 | ||
59 | \helpref{IncTo}{wxsizeincto} | |
60 | ||
61 | ||
62 | \membersection{wxSize::IsFullySpecified}\label{wxsizeisfullyspecified} | |
63 | ||
64 | \constfunc{bool}{IsFullySpecified}{\void} | |
65 | ||
66 | Returns \true if neither of the size object components is equal to $-1$, which | |
67 | is used as default for the size values in wxWidgets (hence the predefined | |
68 | \texttt{wxDefaultSize} has both of its components equal to $-1$). | |
69 | ||
70 | This method is typically used before calling | |
71 | \helpref{SetDefaults}{wxsizesetdefaults}. | |
72 | ||
73 | ||
74 | \membersection{wxSize::GetWidth}\label{wxsizegetwidth} | |
75 | ||
76 | \constfunc{int}{GetWidth}{\void} | |
77 | ||
78 | Gets the width member. | |
79 | ||
80 | ||
81 | \membersection{wxSize::GetHeight}\label{wxsizegetheight} | |
82 | ||
83 | \constfunc{int}{GetHeight}{\void} | |
84 | ||
85 | Gets the height member. | |
86 | ||
87 | ||
88 | ||
89 | \membersection{wxSize::IncTo}\label{wxsizeincto} | |
90 | ||
91 | \func{void}{IncTo}{\param{const wxSize\& }{size}} | |
92 | ||
93 | Increments this object so that both of its dimensions are not less than the | |
94 | corresponding dimensions of the \arg{size}. | |
95 | ||
96 | \wxheading{See also} | |
97 | ||
98 | \helpref{DecTo}{wxsizedecto} | |
99 | ||
100 | ||
101 | ||
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 | ||
112 | \membersection{wxSize::Set}\label{wxsizeset} | |
113 | ||
114 | \func{void}{Set}{\param{int}{ width}, \param{int}{ height}} | |
115 | ||
116 | Sets the width and height members. | |
117 | ||
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 | ||
138 | \membersection{wxSize::SetHeight}\label{wxsizesetheight} | |
139 | ||
140 | \func{void}{SetHeight}{\param{int}{ height}} | |
141 | ||
142 | Sets the height. | |
143 | ||
144 | ||
145 | \membersection{wxSize::SetWidth}\label{wxsizesetwidth} | |
146 | ||
147 | \func{void}{SetWidth}{\param{int}{ width}} | |
148 | ||
149 | Sets the width. | |
150 | ||
151 | ||
152 | \membersection{Operators}\label{wxsizeoperators} | |
153 | ||
154 | \func{void}{operator $=$}{\param{const wxSize\& }{sz}} | |
155 | ||
156 | Assignment operator. | |
157 | ||
158 | ||
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. |