1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/qsize.h:1 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>qsize.h Include File</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>qsize.h</h1>
|
---|
33 |
|
---|
34 | <p>This is the verbatim text of the qsize.h include file. It is provided only for illustration; the copyright remains with Trolltech.
|
---|
35 | <hr>
|
---|
36 | <pre>
|
---|
37 | /****************************************************************************
|
---|
38 | ** $Id: qsize-h.html 2051 2007-02-21 10:04:20Z chehrlic $
|
---|
39 | **
|
---|
40 | ** Definition of QSize class
|
---|
41 | **
|
---|
42 | ** Created : 931028
|
---|
43 | **
|
---|
44 | ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
|
---|
45 | **
|
---|
46 | ** This file is part of the kernel module of the Qt GUI Toolkit.
|
---|
47 | **
|
---|
48 | ** This file may be distributed under the terms of the Q Public License
|
---|
49 | ** as defined by Trolltech ASA of Norway and appearing in the file
|
---|
50 | ** LICENSE.QPL included in the packaging of this file.
|
---|
51 | **
|
---|
52 | ** This file may be distributed and/or modified under the terms of the
|
---|
53 | ** GNU General Public License version 2 as published by the Free Software
|
---|
54 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
55 | ** packaging of this file.
|
---|
56 | **
|
---|
57 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
---|
58 | ** licenses may use this file in accordance with the Qt Commercial License
|
---|
59 | ** Agreement provided with the Software.
|
---|
60 | **
|
---|
61 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
62 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
63 | **
|
---|
64 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
65 | ** information about Qt Commercial License Agreements.
|
---|
66 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
---|
67 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
68 | **
|
---|
69 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
70 | ** not clear to you.
|
---|
71 | **
|
---|
72 | **********************************************************************/
|
---|
73 |
|
---|
74 | #ifndef QSIZE_H
|
---|
75 | #define QSIZE_H
|
---|
76 |
|
---|
77 | #ifndef QT_H
|
---|
78 | #include "qpoint.h" // ### change to qwindowdefs.h?
|
---|
79 | #endif // QT_H
|
---|
80 |
|
---|
81 | class Q_EXPORT QSize
|
---|
82 | // ### Make QSize inherit Qt in Qt 4.0
|
---|
83 | {
|
---|
84 | public:
|
---|
85 | // ### Move this enum to qnamespace.h in Qt 4.0
|
---|
86 | enum ScaleMode {
|
---|
87 | ScaleFree,
|
---|
88 | ScaleMin,
|
---|
89 | ScaleMax
|
---|
90 | };
|
---|
91 |
|
---|
92 | QSize();
|
---|
93 | QSize( int w, int h );
|
---|
94 |
|
---|
95 | bool isNull() const;
|
---|
96 | bool isEmpty() const;
|
---|
97 | bool isValid() const;
|
---|
98 |
|
---|
99 | int width() const;
|
---|
100 | int height() const;
|
---|
101 | void setWidth( int w );
|
---|
102 | void setHeight( int h );
|
---|
103 | void transpose();
|
---|
104 |
|
---|
105 | void scale( int w, int h, ScaleMode mode );
|
---|
106 | void scale( const QSize &s, ScaleMode mode );
|
---|
107 |
|
---|
108 | QSize expandedTo( const QSize & ) const;
|
---|
109 | QSize boundedTo( const QSize & ) const;
|
---|
110 |
|
---|
111 | QCOORD &rwidth();
|
---|
112 | QCOORD &rheight();
|
---|
113 |
|
---|
114 | QSize &operator+=( const QSize & );
|
---|
115 | QSize &operator-=( const QSize & );
|
---|
116 | QSize &operator*=( int c );
|
---|
117 | QSize &operator*=( double c );
|
---|
118 | QSize &operator/=( int c );
|
---|
119 | QSize &operator/=( double c );
|
---|
120 |
|
---|
121 | friend inline bool operator==( const QSize &, const QSize & );
|
---|
122 | friend inline bool operator!=( const QSize &, const QSize & );
|
---|
123 | friend inline const QSize operator+( const QSize &, const QSize & );
|
---|
124 | friend inline const QSize operator-( const QSize &, const QSize & );
|
---|
125 | friend inline const QSize operator*( const QSize &, int );
|
---|
126 | friend inline const QSize operator*( int, const QSize & );
|
---|
127 | friend inline const QSize operator*( const QSize &, double );
|
---|
128 | friend inline const QSize operator*( double, const QSize & );
|
---|
129 | friend inline const QSize operator/( const QSize &, int );
|
---|
130 | friend inline const QSize operator/( const QSize &, double );
|
---|
131 |
|
---|
132 | private:
|
---|
133 | static void warningDivByZero();
|
---|
134 |
|
---|
135 | QCOORD wd;
|
---|
136 | QCOORD ht;
|
---|
137 | };
|
---|
138 |
|
---|
139 |
|
---|
140 | /*****************************************************************************
|
---|
141 | QSize stream functions
|
---|
142 | *****************************************************************************/
|
---|
143 |
|
---|
144 | Q_EXPORT QDataStream &operator<<( QDataStream &, const QSize & );
|
---|
145 | Q_EXPORT QDataStream &operator>>( QDataStream &, QSize & );
|
---|
146 |
|
---|
147 |
|
---|
148 | /*****************************************************************************
|
---|
149 | QSize inline functions
|
---|
150 | *****************************************************************************/
|
---|
151 |
|
---|
152 | inline QSize::QSize()
|
---|
153 | { wd = ht = -1; }
|
---|
154 |
|
---|
155 | inline QSize::QSize( int w, int h )
|
---|
156 | { wd=(QCOORD)w; ht=(QCOORD)h; }
|
---|
157 |
|
---|
158 | inline bool QSize::isNull() const
|
---|
159 | { return wd==0 && ht==0; }
|
---|
160 |
|
---|
161 | inline bool QSize::isEmpty() const
|
---|
162 | { return wd<1 || ht<1; }
|
---|
163 |
|
---|
164 | inline bool QSize::isValid() const
|
---|
165 | { return wd>=0 && ht>=0; }
|
---|
166 |
|
---|
167 | inline int QSize::width() const
|
---|
168 | { return wd; }
|
---|
169 |
|
---|
170 | inline int QSize::height() const
|
---|
171 | { return ht; }
|
---|
172 |
|
---|
173 | inline void QSize::setWidth( int w )
|
---|
174 | { wd=(QCOORD)w; }
|
---|
175 |
|
---|
176 | inline void QSize::setHeight( int h )
|
---|
177 | { ht=(QCOORD)h; }
|
---|
178 |
|
---|
179 | inline QCOORD &QSize::rwidth()
|
---|
180 | { return wd; }
|
---|
181 |
|
---|
182 | inline QCOORD &QSize::rheight()
|
---|
183 | { return ht; }
|
---|
184 |
|
---|
185 | inline QSize &QSize::operator+=( const QSize &s )
|
---|
186 | { wd+=s.wd; ht+=s.ht; return *this; }
|
---|
187 |
|
---|
188 | inline QSize &QSize::operator-=( const QSize &s )
|
---|
189 | { wd-=s.wd; ht-=s.ht; return *this; }
|
---|
190 |
|
---|
191 | inline QSize &QSize::operator*=( int c )
|
---|
192 | { wd*=(QCOORD)c; ht*=(QCOORD)c; return *this; }
|
---|
193 |
|
---|
194 | inline QSize &QSize::operator*=( double c )
|
---|
195 | { wd=(QCOORD)(wd*c); ht=(QCOORD)(ht*c); return *this; }
|
---|
196 |
|
---|
197 | inline bool operator==( const QSize &s1, const QSize &s2 )
|
---|
198 | { return s1.wd == s2.wd && s1.ht == s2.ht; }
|
---|
199 |
|
---|
200 | inline bool operator!=( const QSize &s1, const QSize &s2 )
|
---|
201 | { return s1.wd != s2.wd || s1.ht != s2.ht; }
|
---|
202 |
|
---|
203 | inline const QSize operator+( const QSize & s1, const QSize & s2 )
|
---|
204 | { return QSize(s1.wd+s2.wd, s1.ht+s2.ht); }
|
---|
205 |
|
---|
206 | inline const QSize operator-( const QSize &s1, const QSize &s2 )
|
---|
207 | { return QSize(s1.wd-s2.wd, s1.ht-s2.ht); }
|
---|
208 |
|
---|
209 | inline const QSize operator*( const QSize &s, int c )
|
---|
210 | { return QSize(s.wd*c, s.ht*c); }
|
---|
211 |
|
---|
212 | inline const QSize operator*( int c, const QSize &s )
|
---|
213 | { return QSize(s.wd*c, s.ht*c); }
|
---|
214 |
|
---|
215 | inline const QSize operator*( const QSize &s, double c )
|
---|
216 | { return QSize((QCOORD)(s.wd*c), (QCOORD)(s.ht*c)); }
|
---|
217 |
|
---|
218 | inline const QSize operator*( double c, const QSize &s )
|
---|
219 | { return QSize((QCOORD)(s.wd*c), (QCOORD)(s.ht*c)); }
|
---|
220 |
|
---|
221 | inline QSize &QSize::operator/=( int c )
|
---|
222 | {
|
---|
223 | #if defined(QT_CHECK_MATH)
|
---|
224 | if ( c == 0 )
|
---|
225 | warningDivByZero();
|
---|
226 | #endif
|
---|
227 | wd/=(QCOORD)c; ht/=(QCOORD)c;
|
---|
228 | return *this;
|
---|
229 | }
|
---|
230 |
|
---|
231 | inline QSize &QSize::operator/=( double c )
|
---|
232 | {
|
---|
233 | #if defined(QT_CHECK_MATH)
|
---|
234 | if ( c == 0.0 )
|
---|
235 | warningDivByZero();
|
---|
236 | #endif
|
---|
237 | wd=(QCOORD)(wd/c); ht=(QCOORD)(ht/c);
|
---|
238 | return *this;
|
---|
239 | }
|
---|
240 |
|
---|
241 | inline const QSize operator/( const QSize &s, int c )
|
---|
242 | {
|
---|
243 | #if defined(QT_CHECK_MATH)
|
---|
244 | if ( c == 0 )
|
---|
245 | QSize::warningDivByZero();
|
---|
246 | #endif
|
---|
247 | return QSize(s.wd/c, s.ht/c);
|
---|
248 | }
|
---|
249 |
|
---|
250 | inline const QSize operator/( const QSize &s, double c )
|
---|
251 | {
|
---|
252 | #if defined(QT_CHECK_MATH)
|
---|
253 | if ( c == 0.0 )
|
---|
254 | QSize::warningDivByZero();
|
---|
255 | #endif
|
---|
256 | return QSize((QCOORD)(s.wd/c), (QCOORD)(s.ht/c));
|
---|
257 | }
|
---|
258 |
|
---|
259 | inline QSize QSize::expandedTo( const QSize & otherSize ) const
|
---|
260 | {
|
---|
261 | return QSize( QMAX(wd,otherSize.wd), QMAX(ht,otherSize.ht) );
|
---|
262 | }
|
---|
263 |
|
---|
264 | inline QSize QSize::boundedTo( const QSize & otherSize ) const
|
---|
265 | {
|
---|
266 | return QSize( QMIN(wd,otherSize.wd), QMIN(ht,otherSize.ht) );
|
---|
267 | }
|
---|
268 |
|
---|
269 |
|
---|
270 | #endif // QSIZE_H
|
---|
271 | </pre>
|
---|
272 | <!-- eof -->
|
---|
273 | <p><address><hr><div align=center>
|
---|
274 | <table width=100% cellspacing=0 border=0><tr>
|
---|
275 | <td>Copyright © 2007
|
---|
276 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
277 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
278 | </table></div></address></body>
|
---|
279 | </html>
|
---|