source: trunk/doc/html/qwidget-h.html@ 190

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

reference documentation added

File size: 35.3 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/qwidget.h:1 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>qwidget.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>qwidget.h</h1>
33
34<p>This is the verbatim text of the qwidget.h include file. It is provided only for illustration; the copyright remains with Trolltech.
35<hr>
36<pre>
37/****************************************************************************
38** $Id: qwidget-h.html 2051 2007-02-21 10:04:20Z chehrlic $
39**
40** Definition of QWidget class
41**
42** Created : 931029
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 QWIDGET_H
75#define QWIDGET_H
76
77#ifndef QT_H
78#include "qwindowdefs.h"
79#include "qobject.h"
80#include "qpaintdevice.h"
81#include "qpalette.h"
82#include "qfont.h"
83#include "qfontmetrics.h"
84#include "qfontinfo.h"
85#include "qsizepolicy.h"
86#endif // QT_H
87
88class QLayout;
89struct QWExtra;
90struct QTLWExtra;
91class QFocusData;
92class QCursor;
93class QWSRegionManager;
94class QStyle;
95
96class Q_EXPORT QWidget : public QObject, public QPaintDevice
97{
98 Q_OBJECT
99 Q_ENUMS( BackgroundMode FocusPolicy BackgroundOrigin )
100 Q_PROPERTY( bool isTopLevel READ isTopLevel )
101 Q_PROPERTY( bool isDialog READ isDialog )
102 Q_PROPERTY( bool isModal READ isModal )
103 Q_PROPERTY( bool isPopup READ isPopup )
104 Q_PROPERTY( bool isDesktop READ isDesktop )
105 Q_PROPERTY( bool enabled READ isEnabled WRITE setEnabled )
106 Q_PROPERTY( QRect geometry READ geometry WRITE setGeometry )
107 Q_PROPERTY( QRect frameGeometry READ frameGeometry )
108 Q_PROPERTY( int x READ x )
109 Q_PROPERTY( int y READ y )
110 Q_PROPERTY( QPoint pos READ pos WRITE move DESIGNABLE false STORED false )
111 Q_PROPERTY( QSize frameSize READ frameSize )
112 Q_PROPERTY( QSize size READ size WRITE resize DESIGNABLE false STORED false )
113 Q_PROPERTY( int width READ width )
114 Q_PROPERTY( int height READ height )
115 Q_PROPERTY( QRect rect READ rect )
116 Q_PROPERTY( QRect childrenRect READ childrenRect )
117 Q_PROPERTY( QRegion childrenRegion READ childrenRegion )
118 Q_PROPERTY( QSizePolicy sizePolicy READ sizePolicy WRITE setSizePolicy )
119 Q_PROPERTY( QSize minimumSize READ minimumSize WRITE setMinimumSize )
120 Q_PROPERTY( QSize maximumSize READ maximumSize WRITE setMaximumSize )
121 Q_PROPERTY( int minimumWidth READ minimumWidth WRITE setMinimumWidth STORED false DESIGNABLE false )
122 Q_PROPERTY( int minimumHeight READ minimumHeight WRITE setMinimumHeight STORED false DESIGNABLE false )
123 Q_PROPERTY( int maximumWidth READ maximumWidth WRITE setMaximumWidth STORED false DESIGNABLE false )
124 Q_PROPERTY( int maximumHeight READ maximumHeight WRITE setMaximumHeight STORED false DESIGNABLE false )
125 Q_PROPERTY( QSize sizeIncrement READ sizeIncrement WRITE setSizeIncrement )
126 Q_PROPERTY( QSize baseSize READ baseSize WRITE setBaseSize )
127 Q_PROPERTY( BackgroundMode backgroundMode READ backgroundMode WRITE setBackgroundMode DESIGNABLE false )
128 Q_PROPERTY( QColor paletteForegroundColor READ paletteForegroundColor WRITE setPaletteForegroundColor RESET unsetPalette )
129 Q_PROPERTY( QColor paletteBackgroundColor READ paletteBackgroundColor WRITE setPaletteBackgroundColor RESET unsetPalette )
130 Q_PROPERTY( QPixmap paletteBackgroundPixmap READ paletteBackgroundPixmap WRITE setPaletteBackgroundPixmap RESET unsetPalette )
131 Q_PROPERTY( QBrush backgroundBrush READ backgroundBrush )
132 Q_PROPERTY( QColorGroup colorGroup READ colorGroup )
133 Q_PROPERTY( QPalette palette READ palette WRITE setPalette RESET unsetPalette STORED ownPalette )
134 Q_PROPERTY( BackgroundOrigin backgroundOrigin READ backgroundOrigin WRITE setBackgroundOrigin )
135 Q_PROPERTY( bool ownPalette READ ownPalette )
136 Q_PROPERTY( QFont font READ font WRITE setFont RESET unsetFont STORED ownFont )
137 Q_PROPERTY( bool ownFont READ ownFont )
138#ifndef QT_NO_CURSOR
139 Q_PROPERTY( QCursor cursor READ cursor WRITE setCursor RESET unsetCursor STORED ownCursor )
140 Q_PROPERTY( bool ownCursor READ ownCursor )
141#endif
142#ifndef QT_NO_WIDGET_TOPEXTRA
143 Q_PROPERTY( QString caption READ caption WRITE setCaption )
144 Q_PROPERTY( QPixmap icon READ icon WRITE setIcon )
145 Q_PROPERTY( QString iconText READ iconText WRITE setIconText )
146#endif
147 Q_PROPERTY( bool mouseTracking READ hasMouseTracking WRITE setMouseTracking )
148 Q_PROPERTY( bool underMouse READ hasMouse )
149 Q_PROPERTY( bool isActiveWindow READ isActiveWindow )
150 Q_PROPERTY( bool focusEnabled READ isFocusEnabled )
151 Q_PROPERTY( FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy )
152 Q_PROPERTY( bool focus READ hasFocus )
153 Q_PROPERTY( bool updatesEnabled READ isUpdatesEnabled WRITE setUpdatesEnabled DESIGNABLE false )
154 Q_PROPERTY( bool visible READ isVisible )
155 Q_PROPERTY( QRect visibleRect READ visibleRect ) // obsolete
156 Q_PROPERTY( bool hidden READ isHidden WRITE setHidden DESIGNABLE false SCRIPTABLE false )
157 Q_PROPERTY( bool shown READ isShown WRITE setShown DESIGNABLE false SCRIPTABLE false )
158 Q_PROPERTY( bool minimized READ isMinimized )
159 Q_PROPERTY( bool maximized READ isMaximized )
160 Q_PROPERTY( bool fullScreen READ isFullScreen )
161 Q_PROPERTY( QSize sizeHint READ sizeHint )
162 Q_PROPERTY( QSize minimumSizeHint READ minimumSizeHint )
163 Q_PROPERTY( QRect microFocusHint READ microFocusHint )
164 Q_PROPERTY( bool acceptDrops READ acceptDrops WRITE setAcceptDrops )
165 Q_PROPERTY( bool autoMask READ autoMask WRITE setAutoMask DESIGNABLE false SCRIPTABLE false )
166 Q_PROPERTY( bool customWhatsThis READ customWhatsThis )
167 Q_PROPERTY( bool inputMethodEnabled READ isInputMethodEnabled WRITE setInputMethodEnabled DESIGNABLE false SCRIPTABLE false )
168 Q_PROPERTY( double windowOpacity READ windowOpacity WRITE setWindowOpacity DESIGNABLE false )
169
170public:
171 Q_EXPLICIT QWidget( QWidget* parent=0, const char* name=0, WFlags f=0 );
172 ~QWidget();
173
174 WId winId() const;
175 void setName( const char *name );
176#ifndef QT_NO_STYLE
177 // GUI style setting
178
179 QStyle &amp;style() const;
180 void setStyle( QStyle * );
181 QStyle* setStyle( const QString&amp; );
182#endif
183 // Widget types and states
184
185 bool isTopLevel() const;
186 bool isDialog() const;
187 bool isPopup() const;
188 bool isDesktop() const;
189 bool isModal() const;
190
191 bool isEnabled() const;
192 bool isEnabledTo(QWidget*) const;
193 bool isEnabledToTLW() const;
194
195public slots:
196 virtual void setEnabled( bool );
197 void setDisabled( bool );
198
199 // Widget coordinates
200
201public:
202 QRect frameGeometry() const;
203 const QRect &amp;geometry() const;
204 int x() const;
205 int y() const;
206 QPoint pos() const;
207 QSize frameSize() const;
208 QSize size() const;
209 int width() const;
210 int height() const;
211 QRect rect() const;
212 QRect childrenRect() const;
213 QRegion childrenRegion() const;
214
215 QSize minimumSize() const;
216 QSize maximumSize() const;
217 int minimumWidth() const;
218 int minimumHeight() const;
219 int maximumWidth() const;
220 int maximumHeight() const;
221 void setMinimumSize( const QSize &amp; );
222 virtual void setMinimumSize( int minw, int minh );
223 void setMaximumSize( const QSize &amp; );
224 virtual void setMaximumSize( int maxw, int maxh );
225 void setMinimumWidth( int minw );
226 void setMinimumHeight( int minh );
227 void setMaximumWidth( int maxw );
228 void setMaximumHeight( int maxh );
229
230 QSize sizeIncrement() const;
231 void setSizeIncrement( const QSize &amp; );
232 virtual void setSizeIncrement( int w, int h );
233 QSize baseSize() const;
234 void setBaseSize( const QSize &amp; );
235 void setBaseSize( int basew, int baseh );
236
237 void setFixedSize( const QSize &amp; );
238 void setFixedSize( int w, int h );
239 void setFixedWidth( int w );
240 void setFixedHeight( int h );
241
242 // Widget coordinate mapping
243
244 QPoint mapToGlobal( const QPoint &amp; ) const;
245 QPoint mapFromGlobal( const QPoint &amp; ) const;
246 QPoint mapToParent( const QPoint &amp; ) const;
247 QPoint mapFromParent( const QPoint &amp; ) const;
248 QPoint mapTo( QWidget *, const QPoint &amp; ) const;
249 QPoint mapFrom( QWidget *, const QPoint &amp; ) const;
250
251 QWidget *topLevelWidget() const;
252
253 // Widget attribute functions
254
255 BackgroundMode backgroundMode() const;
256 virtual void setBackgroundMode( BackgroundMode );
257 void setBackgroundMode( BackgroundMode, BackgroundMode );
258
259 const QColor &amp; foregroundColor() const;
260
261 const QColor &amp; eraseColor() const;
262 virtual void setEraseColor( const QColor &amp; );
263
264 const QPixmap * erasePixmap() const;
265 virtual void setErasePixmap( const QPixmap &amp; );
266
267#ifndef QT_NO_PALETTE
268 const QColorGroup &amp; colorGroup() const;
269 const QPalette &amp; palette() const;
270 bool ownPalette() const;
271 virtual void setPalette( const QPalette &amp; );
272 void unsetPalette();
273#endif
274
275 const QColor &amp; paletteForegroundColor() const;
276 void setPaletteForegroundColor( const QColor &amp; );
277
278 const QColor &amp; paletteBackgroundColor() const;
279 virtual void setPaletteBackgroundColor( const QColor &amp; );
280
281 const QPixmap * paletteBackgroundPixmap() const;
282 virtual void setPaletteBackgroundPixmap( const QPixmap &amp; );
283
284 const QBrush&amp; backgroundBrush() const;
285
286 QFont font() const;
287 bool ownFont() const;
288 virtual void setFont( const QFont &amp; );
289 void unsetFont();
290 QFontMetrics fontMetrics() const;
291 QFontInfo fontInfo() const;
292
293#ifndef QT_NO_CURSOR
294 const QCursor &amp;cursor() const;
295 bool ownCursor() const;
296 virtual void setCursor( const QCursor &amp; );
297 virtual void unsetCursor();
298#endif
299#ifndef QT_NO_WIDGET_TOPEXTRA
300 QString caption() const;
301 const QPixmap *icon() const;
302 QString iconText() const;
303#endif
304 bool hasMouseTracking() const;
305 bool hasMouse() const;
306
307 virtual void setMask( const QBitmap &amp; );
308 virtual void setMask( const QRegion &amp; );
309 void clearMask();
310
311 const QColor &amp; backgroundColor() const; // obsolete, use eraseColor()
312 virtual void setBackgroundColor( const QColor &amp; ); // obsolete, use setEraseColor()
313 const QPixmap * backgroundPixmap() const; // obsolete, use erasePixmap()
314 virtual void setBackgroundPixmap( const QPixmap &amp; ); // obsolete, use setErasePixmap()
315
316public slots:
317#ifndef QT_NO_WIDGET_TOPEXTRA
318 virtual void setCaption( const QString &amp;);
319 virtual void setIcon( const QPixmap &amp; );
320 virtual void setIconText( const QString &amp;);
321#endif
322 virtual void setMouseTracking( bool enable );
323
324 // Keyboard input focus functions
325
326 virtual void setFocus();
327 void clearFocus();
328
329public:
330 enum FocusPolicy {
331 NoFocus = 0,
332 TabFocus = 0x1,
333 ClickFocus = 0x2,
334 StrongFocus = TabFocus | ClickFocus | 0x8,
335 WheelFocus = StrongFocus | 0x4
336 };
337
338 bool isActiveWindow() const;
339 virtual void setActiveWindow();
340 bool isFocusEnabled() const;
341
342 FocusPolicy focusPolicy() const;
343 virtual void setFocusPolicy( FocusPolicy );
344 bool hasFocus() const;
345 static void setTabOrder( QWidget *, QWidget * );
346 virtual void setFocusProxy( QWidget * );
347 QWidget * focusProxy() const;
348
349 void setInputMethodEnabled( bool b );
350 bool isInputMethodEnabled() const;
351 // Grab functions
352
353 void grabMouse();
354#ifndef QT_NO_CURSOR
355 void grabMouse( const QCursor &amp; );
356#endif
357 void releaseMouse();
358 void grabKeyboard();
359 void releaseKeyboard();
360 static QWidget * mouseGrabber();
361 static QWidget * keyboardGrabber();
362
363 // Update/refresh functions
364
365 bool isUpdatesEnabled() const;
366
367#if 0 //def Q_WS_QWS
368 void repaintUnclipped( const QRegion &amp;, bool erase = TRUE );
369#endif
370public slots:
371 virtual void setUpdatesEnabled( bool enable );
372 void update();
373 void update( int x, int y, int w, int h );
374 void update( const QRect&amp; );
375 void repaint();
376 void repaint( bool erase );
377 void repaint( int x, int y, int w, int h, bool erase=TRUE );
378 void repaint( const QRect &amp;, bool erase = TRUE );
379 void repaint( const QRegion &amp;, bool erase = TRUE );
380
381 // Widget management functions
382
383 virtual void show();
384 virtual void hide();
385 void setShown( bool show );
386 void setHidden( bool hide );
387#ifndef QT_NO_COMPAT
388 void iconify() { showMinimized(); }
389#endif
390 virtual void showMinimized();
391 virtual void showMaximized();
392 void showFullScreen();
393 virtual void showNormal();
394 virtual void polish();
395 void constPolish() const;
396 bool close();
397
398 void raise();
399 void lower();
400 void stackUnder( QWidget* );
401 virtual void move( int x, int y );
402 void move( const QPoint &amp; );
403 virtual void resize( int w, int h );
404 void resize( const QSize &amp; );
405 virtual void setGeometry( int x, int y, int w, int h );
406 virtual void setGeometry( const QRect &amp; ); // ### make non virtual in Qt 4?
407
408public:
409 virtual bool close( bool alsoDelete );
410 bool isVisible() const;
411 bool isVisibleTo(QWidget*) const;
412 bool isVisibleToTLW() const; // obsolete
413 QRect visibleRect() const; // obsolete
414 bool isHidden() const;
415 bool isShown() const;
416 bool isMinimized() const;
417 bool isMaximized() const;
418 bool isFullScreen() const;
419
420 uint windowState() const;
421 void setWindowState(uint windowState);
422
423 virtual QSize sizeHint() const;
424 virtual QSize minimumSizeHint() const;
425 virtual QSizePolicy sizePolicy() const;
426 virtual void setSizePolicy( QSizePolicy );
427 void setSizePolicy( QSizePolicy::SizeType hor, QSizePolicy::SizeType ver, bool hfw = FALSE );
428 virtual int heightForWidth(int) const;
429
430 QRegion clipRegion() const;
431
432// ### move together with other slots in Qt 4.0
433public slots:
434 virtual void adjustSize();
435
436public:
437#ifndef QT_NO_LAYOUT
438 QLayout * layout() const { return lay_out; }
439#endif
440 void updateGeometry();
441 virtual void reparent( QWidget *parent, WFlags, const QPoint &amp;,
442 bool showIt=FALSE );
443 void reparent( QWidget *parent, const QPoint &amp;,
444 bool showIt=FALSE );
445#ifndef QT_NO_COMPAT
446 void recreate( QWidget *parent, WFlags f, const QPoint &amp; p,
447 bool showIt=FALSE ) { reparent(parent,f,p,showIt); }
448#endif
449
450 void erase();
451 void erase( int x, int y, int w, int h );
452 void erase( const QRect &amp; );
453 void erase( const QRegion &amp; );
454 void scroll( int dx, int dy );
455 void scroll( int dx, int dy, const QRect&amp; );
456
457 void drawText( int x, int y, const QString &amp;);
458 void drawText( const QPoint &amp;, const QString &amp;);
459
460 // Misc. functions
461
462 QWidget * focusWidget() const;
463 QRect microFocusHint() const;
464
465 // drag and drop
466
467 bool acceptDrops() const;
468 virtual void setAcceptDrops( bool on );
469
470 // transparency and pseudo transparency
471
472 virtual void setAutoMask(bool);
473 bool autoMask() const;
474
475 enum BackgroundOrigin { WidgetOrigin, ParentOrigin, WindowOrigin, AncestorOrigin };
476
477 virtual void setBackgroundOrigin( BackgroundOrigin );
478 BackgroundOrigin backgroundOrigin() const;
479 QPoint backgroundOffset() const;
480
481 // whats this help
482 virtual bool customWhatsThis() const;
483
484 QWidget * parentWidget( bool sameWindow = FALSE ) const;
485 WState testWState( WState s ) const;
486 WFlags testWFlags( WFlags f ) const;
487 static QWidget * find( WId );
488 static QWidgetMapper *wmapper();
489
490 QWidget *childAt( int x, int y, bool includeThis = FALSE ) const;
491 QWidget *childAt( const QPoint &amp;, bool includeThis = FALSE ) const;
492
493#if defined(Q_WS_QWS)
494 virtual QGfx * graphicsContext(bool clip_children=TRUE) const;
495#endif
496#if defined(Q_WS_MAC)
497 QRegion clippedRegion(bool do_children=TRUE);
498 uint clippedSerial(bool do_children=TRUE);
499#ifndef QMAC_NO_QUARTZ
500 CGContextRef macCGContext(bool clipped=TRUE) const;
501#endif
502#endif
503
504 void setWindowOpacity(double level);
505 double windowOpacity() const;
506
507protected:
508 // Event handlers
509 bool event( QEvent * );
510 virtual void mousePressEvent( QMouseEvent * );
511 virtual void mouseReleaseEvent( QMouseEvent * );
512 virtual void mouseDoubleClickEvent( QMouseEvent * );
513 virtual void mouseMoveEvent( QMouseEvent * );
514#ifndef QT_NO_WHEELEVENT
515 virtual void wheelEvent( QWheelEvent * );
516#endif
517 virtual void keyPressEvent( QKeyEvent * );
518 virtual void keyReleaseEvent( QKeyEvent * );
519 virtual void focusInEvent( QFocusEvent * );
520 virtual void focusOutEvent( QFocusEvent * );
521 virtual void enterEvent( QEvent * );
522 virtual void leaveEvent( QEvent * );
523 virtual void paintEvent( QPaintEvent * );
524 virtual void moveEvent( QMoveEvent * );
525 virtual void resizeEvent( QResizeEvent * );
526 virtual void closeEvent( QCloseEvent * );
527 virtual void contextMenuEvent( QContextMenuEvent * );
528 virtual void imStartEvent( QIMEvent * );
529 virtual void imComposeEvent( QIMEvent * );
530 virtual void imEndEvent( QIMEvent * );
531 virtual void tabletEvent( QTabletEvent * );
532
533#ifndef QT_NO_DRAGANDDROP
534 virtual void dragEnterEvent( QDragEnterEvent * );
535 virtual void dragMoveEvent( QDragMoveEvent * );
536 virtual void dragLeaveEvent( QDragLeaveEvent * );
537 virtual void dropEvent( QDropEvent * );
538#endif
539
540 virtual void showEvent( QShowEvent * );
541 virtual void hideEvent( QHideEvent * );
542
543#if defined(Q_WS_MAC)
544 virtual bool macEvent( MSG * );
545#endif
546#if defined(Q_WS_WIN)
547 virtual bool winEvent( MSG * );
548#endif
549#if defined(Q_WS_X11)
550 virtual bool x11Event( XEvent * );
551#endif
552#if defined(Q_WS_QWS)
553 virtual bool qwsEvent( QWSEvent * );
554 virtual unsigned char *scanLine( int ) const;
555 virtual int bytesPerLine() const;
556#endif
557
558 virtual void updateMask();
559
560 // Misc. protected functions
561
562#ifndef QT_NO_STYLE
563 virtual void styleChange( QStyle&amp; );
564#endif
565 virtual void enabledChange( bool oldEnabled );
566#ifndef QT_NO_PALETTE
567 virtual void paletteChange( const QPalette &amp; );
568#endif
569 virtual void fontChange( const QFont &amp; );
570 virtual void windowActivationChange( bool oldActive );
571
572 int metric( int ) const;
573
574 void resetInputContext();
575
576 virtual void create( WId = 0, bool initializeWindow = TRUE,
577 bool destroyOldWindow = TRUE );
578 virtual void destroy( bool destroyWindow = TRUE,
579 bool destroySubWindows = TRUE );
580 uint getWState() const;
581 virtual void setWState( uint );
582 void clearWState( uint n );
583 WFlags getWFlags() const;
584 virtual void setWFlags( WFlags );
585 void clearWFlags( WFlags n );
586
587 virtual bool focusNextPrevChild( bool next );
588
589 QWExtra *extraData();
590 QTLWExtra *topData();
591 QFocusData *focusData();
592
593 virtual void setKeyCompression(bool);
594 virtual void setMicroFocusHint(int x, int y, int w, int h, bool text=TRUE, QFont *f = 0);
595
596#if defined(Q_WS_MAC)
597 void dirtyClippedRegion(bool);
598 bool isClippedRegionDirty();
599 virtual void setRegionDirty(bool);
600 virtual void macWidgetChangedWindow();
601#endif
602
603private slots:
604 void focusProxyDestroyed();
605
606private:
607 void setFontSys( QFont *f = 0 );
608#if defined(Q_WS_X11)
609 void createInputContext();
610 void destroyInputContext();
611 void focusInputContext();
612 void checkChildrenDnd();
613#elif defined(Q_WS_MAC)
614 uint own_id : 1, macDropEnabled : 1;
615 EventHandlerRef window_event;
616 //mac event functions
617 void propagateUpdates(bool update_rgn=TRUE);
618 void update( const QRegion&amp; );
619 //friends, way too many - fix this immediately!
620 friend void qt_clean_root_win();
621 friend bool qt_recreate_root_win();
622 friend QPoint posInWindow(QWidget *);
623 friend bool qt_mac_update_sizer(QWidget *, int);
624 friend QWidget *qt_recursive_match(QWidget *widg, int x, int y);
625 friend bool qt_paint_children(QWidget *,QRegion &amp;, uchar ops);
626 friend QMAC_PASCAL OSStatus qt_window_event(EventHandlerCallRef er, EventRef event, void *);
627 friend void qt_event_request_updates(QWidget *, const QRegion &amp;, bool subtract);
628 friend bool qt_window_rgn(WId, short, RgnHandle, bool);
629 friend class QDragManager;
630#endif
631
632#ifndef QT_NO_LAYOUT
633 void setLayout( QLayout *l );
634#endif
635 void setWinId( WId );
636 void showWindow();
637 void hideWindow();
638 void showChildren( bool spontaneous );
639 void hideChildren( bool spontaneous );
640 void reparentSys( QWidget *parent, WFlags, const QPoint &amp;, bool showIt);
641 void createTLExtra();
642 void createExtra();
643 void deleteExtra();
644 void createSysExtra();
645 void deleteSysExtra();
646 void createTLSysExtra();
647 void deleteTLSysExtra();
648 void deactivateWidgetCleanup();
649 void internalSetGeometry( int, int, int, int, bool );
650 void reparentFocusWidgets( QWidget * );
651 QFocusData *focusData( bool create );
652 void setBackgroundFromMode();
653 void setBackgroundColorDirect( const QColor &amp; );
654 void setBackgroundPixmapDirect( const QPixmap &amp; );
655 void setBackgroundModeDirect( BackgroundMode );
656 void setBackgroundEmpty();
657 void updateFrameStrut() const;
658#if defined(Q_WS_X11)
659 void setBackgroundX11Relative();
660#endif
661
662 WId winid;
663 uint widget_state;
664 uint widget_flags;
665 uint focus_policy : 4;
666 uint own_font :1;
667 uint own_palette :1;
668 uint sizehint_forced :1;
669 uint is_closing :1;
670 uint in_show : 1;
671 uint in_show_maximized : 1;
672 uint fstrut_dirty : 1;
673 uint im_enabled : 1;
674 QRect crect;
675 QColor bg_col;
676#ifndef QT_NO_PALETTE
677 QPalette pal;
678#endif
679 QFont fnt;
680#ifndef QT_NO_LAYOUT
681 QLayout *lay_out;
682#endif
683 QWExtra *extra;
684#if defined(Q_WS_QWS)
685 QRegion req_region; // Requested region
686 mutable QRegion paintable_region; // Paintable region
687 mutable bool paintable_region_dirty;// needs to be recalculated
688 mutable QRegion alloc_region; // Allocated region
689 mutable bool alloc_region_dirty; // needs to be recalculated
690 mutable int overlapping_children; // Handle overlapping children
691
692 int alloc_region_index;
693 int alloc_region_revision;
694
695 void updateOverlappingChildren() const;
696 void setChildrenAllocatedDirty();
697 void setChildrenAllocatedDirty( const QRegion &amp;r, const QWidget *dirty=0 );
698 bool isAllocatedRegionDirty() const;
699 void updateRequestedRegion( const QPoint &amp;gpos );
700 QRegion requestedRegion() const;
701 QRegion allocatedRegion() const;
702 QRegion paintableRegion() const;
703
704 void updateGraphicsContext( QGfx *qgfx_qws, bool clip_children ) const;
705#ifndef QT_NO_CURSOR
706 void updateCursor( const QRegion &amp;r ) const;
707#endif
708
709 // used to accumulate dirty region when children moved/resized.
710 QRegion dirtyChildren;
711 bool isSettingGeometry;
712 friend class QWSManager;
713#endif
714 static int instanceCounter; // Current number of widget instances
715 static int maxInstances; // Maximum number of widget instances
716
717 static void createMapper();
718 static void destroyMapper();
719 static QWidgetList *wList();
720 static QWidgetList *tlwList();
721 static QWidgetMapper *mapper;
722 friend class QApplication;
723 friend class QBaseApplication;
724 friend class QPainter;
725 friend class QFontMetrics;
726 friend class QFontInfo;
727 friend class QETWidget;
728 friend class QLayout;
729
730private: // Disabled copy constructor and operator=
731#if defined(Q_DISABLE_COPY)
732 QWidget( const QWidget &amp; );
733 QWidget &amp;operator=( const QWidget &amp; );
734#endif
735
736public: // obsolete functions to dissappear or to become inline in 3.0
737#ifndef QT_NO_PALETTE
738 void setPalette( const QPalette &amp;p, bool ) { setPalette( p ); }
739#endif
740 void setFont( const QFont &amp;f, bool ) { setFont( f ); }
741};
742
743
744inline Qt::WState QWidget::testWState( WState s ) const
745{ return (widget_state &amp; s); }
746
747inline Qt::WFlags QWidget::testWFlags( WFlags f ) const
748{ return (widget_flags &amp; f); }
749
750
751inline WId QWidget::winId() const
752{ return winid; }
753
754inline bool QWidget::isTopLevel() const
755{ return testWFlags(WType_TopLevel); }
756
757inline bool QWidget::isDialog() const
758{ return testWFlags(WType_Dialog); }
759
760inline bool QWidget::isPopup() const
761{ return testWFlags(WType_Popup); }
762
763inline bool QWidget::isDesktop() const
764{ return testWFlags(WType_Desktop); }
765
766inline bool QWidget::isEnabled() const
767{ return !testWState(WState_Disabled); }
768
769inline bool QWidget::isModal() const
770{ return testWFlags(WShowModal); }
771
772inline bool QWidget::isEnabledToTLW() const
773{ return isEnabled(); }
774
775inline const QRect &amp;QWidget::geometry() const
776{ return crect; }
777
778inline QSize QWidget::size() const
779{ return crect.size(); }
780
781inline int QWidget::width() const
782{ return crect.width(); }
783
784inline int QWidget::height() const
785{ return crect.height(); }
786
787inline QRect QWidget::rect() const
788{ return QRect(0,0,crect.width(),crect.height()); }
789
790inline int QWidget::minimumWidth() const
791{ return minimumSize().width(); }
792
793inline int QWidget::minimumHeight() const
794{ return minimumSize().height(); }
795
796inline int QWidget::maximumWidth() const
797{ return maximumSize().width(); }
798
799inline int QWidget::maximumHeight() const
800{ return maximumSize().height(); }
801
802inline void QWidget::setMinimumSize( const QSize &amp;s )
803{ setMinimumSize(s.width(),s.height()); }
804
805inline void QWidget::setMaximumSize( const QSize &amp;s )
806{ setMaximumSize(s.width(),s.height()); }
807
808inline void QWidget::setSizeIncrement( const QSize &amp;s )
809{ setSizeIncrement(s.width(),s.height()); }
810
811inline void QWidget::setBaseSize( const QSize &amp;s )
812{ setBaseSize(s.width(),s.height()); }
813
814inline const QColor &amp;QWidget::eraseColor() const
815{ return bg_col; }
816
817#ifndef QT_NO_PALETTE
818inline const QPalette &amp;QWidget::palette() const
819{ return pal; }
820#endif
821
822inline QFont QWidget::font() const
823{ return fnt; }
824
825inline QFontMetrics QWidget::fontMetrics() const
826{ return QFontMetrics(font()); }
827
828inline QFontInfo QWidget::fontInfo() const
829{ return QFontInfo(font()); }
830
831inline bool QWidget::hasMouseTracking() const
832{ return testWState(WState_MouseTracking); }
833
834inline bool QWidget::hasMouse() const
835{ return testWState(WState_HasMouse); }
836
837inline bool QWidget::isFocusEnabled() const
838{ return (FocusPolicy)focus_policy != NoFocus; }
839
840inline QWidget::FocusPolicy QWidget::focusPolicy() const
841{ return (FocusPolicy)focus_policy; }
842
843inline bool QWidget::isUpdatesEnabled() const
844{ return !testWState(WState_BlockUpdates); }
845
846inline void QWidget::update( const QRect &amp;r )
847{ update( r.x(), r.y(), r.width(), r.height() ); }
848
849inline void QWidget::repaint()
850{ repaint( TRUE ); }
851
852inline void QWidget::repaint( const QRect &amp;r, bool erase )
853{ repaint( r.x(), r.y(), r.width(), r.height(), erase ); }
854
855inline void QWidget::erase()
856{ erase( 0, 0, crect.width(), crect.height() ); }
857
858inline void QWidget::erase( const QRect &amp;r )
859{ erase( r.x(), r.y(), r.width(), r.height() ); }
860
861inline bool QWidget::close()
862{ return close( FALSE ); }
863
864inline bool QWidget::isVisible() const
865{ return testWState(WState_Visible); }
866
867inline bool QWidget::isVisibleToTLW() const // obsolete
868{ return isVisible(); }
869
870inline bool QWidget::isHidden() const
871{ return testWState(WState_ForceHide); }
872
873inline bool QWidget::isShown() const
874{ return !testWState(WState_ForceHide); }
875
876inline void QWidget::move( const QPoint &amp;p )
877{ move( p.x(), p.y() ); }
878
879inline void QWidget::resize( const QSize &amp;s )
880{ resize( s.width(), s.height()); }
881
882inline void QWidget::setGeometry( const QRect &amp;r )
883{ setGeometry( r.left(), r.top(), r.width(), r.height() ); }
884
885inline void QWidget::drawText( const QPoint &amp;p, const QString &amp;s )
886{ drawText( p.x(), p.y(), s ); }
887
888inline QWidget *QWidget::parentWidget( bool sameWindow ) const
889{
890 if ( sameWindow )
891 return isTopLevel() ? 0 : (QWidget *)QObject::parent();
892 return (QWidget *)QObject::parent();
893}
894
895inline QWidgetMapper *QWidget::wmapper()
896{ return mapper; }
897
898inline uint QWidget::getWState() const
899{ return widget_state; }
900
901inline void QWidget::setWState( uint f )
902{ widget_state |= f; }
903
904inline void QWidget::clearWState( uint f )
905{ widget_state &amp;= ~f; }
906
907inline Qt::WFlags QWidget::getWFlags() const
908{ return widget_flags; }
909
910inline void QWidget::setWFlags( WFlags f )
911{ widget_flags |= f; }
912
913inline void QWidget::clearWFlags( WFlags f )
914{ widget_flags &amp;= ~f; }
915
916inline void QWidget::constPolish() const
917{
918 if ( !testWState(WState_Polished) ) {
919 QWidget* that = (QWidget*) this;
920 that-&gt;polish();
921 that-&gt;setWState(WState_Polished); // be on the safe side...
922 }
923}
924#ifndef QT_NO_CURSOR
925inline bool QWidget::ownCursor() const
926{
927 return testWState( WState_OwnCursor );
928}
929#endif
930inline bool QWidget::ownFont() const
931{
932 return own_font;
933}
934#ifndef QT_NO_PALETTE
935inline bool QWidget::ownPalette() const
936{
937 return own_palette;
938}
939#endif
940
941inline void QWidget::setSizePolicy( QSizePolicy::SizeType hor, QSizePolicy::SizeType ver, bool hfw )
942{
943 setSizePolicy( QSizePolicy( hor, ver, hfw) );
944}
945
946inline bool QWidget::isInputMethodEnabled() const
947{
948 return (bool)im_enabled;
949}
950
951// Extra QWidget data
952// - to minimize memory usage for members that are seldom used.
953// - top-level widgets have extra extra data to reduce cost further
954
955class QFocusData;
956class QWSManager;
957#if defined(Q_WS_WIN)
958class QOleDropTarget;
959#endif
960#if defined(Q_WS_MAC)
961class QMacDndExtra;
962#endif
963
964struct Q_EXPORT QTLWExtra {
965#ifndef QT_NO_WIDGET_TOPEXTRA
966 QString caption; // widget caption
967 QString iconText; // widget icon text
968 QPixmap *icon; // widget icon
969#endif
970 QFocusData *focusData; // focus data (for TLW)
971 short incw, inch; // size increments
972 // frame strut
973 ulong fleft, fright, ftop, fbottom;
974 uint unused : 8; // not used at this point...
975#if defined( Q_WS_WIN ) || defined( Q_WS_MAC )
976 uint opacity : 8; // Stores opacity level on Windows/Mac OS X.
977#endif
978 uint savedFlags; // Save widgetflags while showing fullscreen
979 short basew, baseh; // base sizes
980#if defined(Q_WS_X11)
981 WId parentWinId; // parent window Id (valid after reparenting)
982 uint embedded : 1; // window is embedded in another Qt application
983 uint spont_unmapped: 1; // window was spontaneously unmapped
984 uint reserved: 1; // reserved
985 uint dnd : 1; // DND properties installed
986 uint uspos : 1; // User defined position
987 uint ussize : 1; // User defined size
988 void *xic; // XIM Input Context
989#endif
990#if defined(Q_WS_MAC)
991 WindowGroupRef group;
992 uint is_moved: 1;
993 uint resizer : 4;
994#endif
995#if defined(Q_WS_QWS) &amp;&amp; !defined ( QT_NO_QWS_MANAGER )
996 QRegion decor_allocated_region; // decoration allocated region
997 QWSManager *qwsManager;
998#endif
999#if defined(Q_WS_WIN)
1000 HICON winIcon; // internal Windows icon
1001#endif
1002 QRect normalGeometry; // used by showMin/maximized/FullScreen
1003#ifdef Q_WS_WIN
1004 uint style, exstyle;
1005#endif
1006};
1007
1008
1009#define QWIDGETSIZE_MAX 32767
1010
1011// dear user: you can see this struct, but it is internal. do not touch.
1012
1013struct Q_EXPORT QWExtra {
1014 Q_INT16 minw, minh; // minimum size
1015 Q_INT16 maxw, maxh; // maximum size
1016 QPixmap *bg_pix; // background pixmap
1017 QWidget *focus_proxy;
1018#ifndef QT_NO_CURSOR
1019 QCursor *curs;
1020#endif
1021 QTLWExtra *topextra; // only useful for TLWs
1022#if defined(Q_WS_WIN)
1023 QOleDropTarget *dropTarget; // drop target
1024#endif
1025#if defined(Q_WS_X11)
1026 WId xDndProxy; // XDND forwarding to embedded windows
1027#endif
1028#if defined(Q_WS_MAC)
1029 QRegion clip_saved, clip_sibs, clip_children;
1030 QMacDndExtra *macDndExtra;
1031 QRegion dirty_area;
1032 uint clip_dirty : 1, clip_serial : 15;
1033 uint child_dirty : 1, child_serial : 15;
1034#ifndef QMAC_NO_QUARTZ
1035 uint ctx_children_clipped:1;
1036#endif // QMAC_NO_QUARTZ
1037 uint has_dirty_area:1;
1038#endif // Q_WS_MAC
1039 uint bg_origin : 2;
1040#if defined(Q_WS_X11)
1041 uint children_use_dnd : 1;
1042 uint compress_events : 1;
1043#endif
1044#if defined(Q_WS_QWS) || defined(Q_WS_MAC)
1045 QRegion mask; // widget mask
1046#endif
1047 char bg_mode; // background mode
1048 char bg_mode_visual; // visual background mode
1049#ifndef QT_NO_STYLE
1050 QStyle* style;
1051#endif
1052 QRect micro_focus_hint; // micro focus hint
1053 QSizePolicy size_policy;
1054};
1055
1056#define Q_DEFINED_QWIDGET
1057#include "qwinexport.h"
1058
1059#endif // QWIDGET_H
1060</pre>
1061<!-- eof -->
1062<p><address><hr><div align=center>
1063<table width=100% cellspacing=0 border=0><tr>
1064<td>Copyright &copy; 2007
1065<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
1066<td align=right><div align=right>Qt 3.3.8</div>
1067</table></div></address></body>
1068</html>
Note: See TracBrowser for help on using the repository browser.