source: trunk/doc/html/qsize-h.html

Last change on this file was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 8.7 KB
Line 
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"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { 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&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;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&nbsp;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
81class Q_EXPORT QSize
82// ### Make QSize inherit Qt in Qt 4.0
83{
84public:
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 &amp;s, ScaleMode mode );
107
108 QSize expandedTo( const QSize &amp; ) const;
109 QSize boundedTo( const QSize &amp; ) const;
110
111 QCOORD &amp;rwidth();
112 QCOORD &amp;rheight();
113
114 QSize &amp;operator+=( const QSize &amp; );
115 QSize &amp;operator-=( const QSize &amp; );
116 QSize &amp;operator*=( int c );
117 QSize &amp;operator*=( double c );
118 QSize &amp;operator/=( int c );
119 QSize &amp;operator/=( double c );
120
121 friend inline bool operator==( const QSize &amp;, const QSize &amp; );
122 friend inline bool operator!=( const QSize &amp;, const QSize &amp; );
123 friend inline const QSize operator+( const QSize &amp;, const QSize &amp; );
124 friend inline const QSize operator-( const QSize &amp;, const QSize &amp; );
125 friend inline const QSize operator*( const QSize &amp;, int );
126 friend inline const QSize operator*( int, const QSize &amp; );
127 friend inline const QSize operator*( const QSize &amp;, double );
128 friend inline const QSize operator*( double, const QSize &amp; );
129 friend inline const QSize operator/( const QSize &amp;, int );
130 friend inline const QSize operator/( const QSize &amp;, double );
131
132private:
133 static void warningDivByZero();
134
135 QCOORD wd;
136 QCOORD ht;
137};
138
139
140/*****************************************************************************
141 QSize stream functions
142 *****************************************************************************/
143
144Q_EXPORT QDataStream &amp;operator&lt;&lt;( QDataStream &amp;, const QSize &amp; );
145Q_EXPORT QDataStream &amp;operator&gt;&gt;( QDataStream &amp;, QSize &amp; );
146
147
148/*****************************************************************************
149 QSize inline functions
150 *****************************************************************************/
151
152inline QSize::QSize()
153{ wd = ht = -1; }
154
155inline QSize::QSize( int w, int h )
156{ wd=(QCOORD)w; ht=(QCOORD)h; }
157
158inline bool QSize::isNull() const
159{ return wd==0 &amp;&amp; ht==0; }
160
161inline bool QSize::isEmpty() const
162{ return wd&lt;1 || ht&lt;1; }
163
164inline bool QSize::isValid() const
165{ return wd&gt;=0 &amp;&amp; ht&gt;=0; }
166
167inline int QSize::width() const
168{ return wd; }
169
170inline int QSize::height() const
171{ return ht; }
172
173inline void QSize::setWidth( int w )
174{ wd=(QCOORD)w; }
175
176inline void QSize::setHeight( int h )
177{ ht=(QCOORD)h; }
178
179inline QCOORD &amp;QSize::rwidth()
180{ return wd; }
181
182inline QCOORD &amp;QSize::rheight()
183{ return ht; }
184
185inline QSize &amp;QSize::operator+=( const QSize &amp;s )
186{ wd+=s.wd; ht+=s.ht; return *this; }
187
188inline QSize &amp;QSize::operator-=( const QSize &amp;s )
189{ wd-=s.wd; ht-=s.ht; return *this; }
190
191inline QSize &amp;QSize::operator*=( int c )
192{ wd*=(QCOORD)c; ht*=(QCOORD)c; return *this; }
193
194inline QSize &amp;QSize::operator*=( double c )
195{ wd=(QCOORD)(wd*c); ht=(QCOORD)(ht*c); return *this; }
196
197inline bool operator==( const QSize &amp;s1, const QSize &amp;s2 )
198{ return s1.wd == s2.wd &amp;&amp; s1.ht == s2.ht; }
199
200inline bool operator!=( const QSize &amp;s1, const QSize &amp;s2 )
201{ return s1.wd != s2.wd || s1.ht != s2.ht; }
202
203inline const QSize operator+( const QSize &amp; s1, const QSize &amp; s2 )
204{ return QSize(s1.wd+s2.wd, s1.ht+s2.ht); }
205
206inline const QSize operator-( const QSize &amp;s1, const QSize &amp;s2 )
207{ return QSize(s1.wd-s2.wd, s1.ht-s2.ht); }
208
209inline const QSize operator*( const QSize &amp;s, int c )
210{ return QSize(s.wd*c, s.ht*c); }
211
212inline const QSize operator*( int c, const QSize &amp;s )
213{ return QSize(s.wd*c, s.ht*c); }
214
215inline const QSize operator*( const QSize &amp;s, double c )
216{ return QSize((QCOORD)(s.wd*c), (QCOORD)(s.ht*c)); }
217
218inline const QSize operator*( double c, const QSize &amp;s )
219{ return QSize((QCOORD)(s.wd*c), (QCOORD)(s.ht*c)); }
220
221inline QSize &amp;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
231inline QSize &amp;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
241inline const QSize operator/( const QSize &amp;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
250inline const QSize operator/( const QSize &amp;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
259inline QSize QSize::expandedTo( const QSize &amp; otherSize ) const
260{
261 return QSize( QMAX(wd,otherSize.wd), QMAX(ht,otherSize.ht) );
262}
263
264inline QSize QSize::boundedTo( const QSize &amp; 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 &copy; 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>
Note: See TracBrowser for help on using the repository browser.