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