src/gui/kernel/qwidget.h
changeset 0 1918ee327afb
child 3 41300fa6a67c
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the QtGui module of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #ifndef QWIDGET_H
       
    43 #define QWIDGET_H
       
    44 
       
    45 #include <QtGui/qwindowdefs.h>
       
    46 #include <QtCore/qobject.h>
       
    47 #include <QtCore/qmargins.h>
       
    48 #include <QtGui/qpaintdevice.h>
       
    49 #include <QtGui/qpalette.h>
       
    50 #include <QtGui/qfont.h>
       
    51 #include <QtGui/qfontmetrics.h>
       
    52 #include <QtGui/qfontinfo.h>
       
    53 #include <QtGui/qsizepolicy.h>
       
    54 #include <QtGui/qregion.h>
       
    55 #include <QtGui/qbrush.h>
       
    56 #include <QtGui/qcursor.h>
       
    57 #include <QtGui/qkeysequence.h>
       
    58 
       
    59 #ifdef QT_INCLUDE_COMPAT
       
    60 #include <QtGui/qevent.h>
       
    61 #endif
       
    62 
       
    63 QT_BEGIN_HEADER
       
    64 
       
    65 QT_BEGIN_NAMESPACE
       
    66 
       
    67 QT_MODULE(Gui)
       
    68 
       
    69 class QLayout;
       
    70 class QWSRegionManager;
       
    71 class QStyle;
       
    72 class QAction;
       
    73 class QVariant;
       
    74 
       
    75 class QActionEvent;
       
    76 class QMouseEvent;
       
    77 class QWheelEvent;
       
    78 class QHoverEvent;
       
    79 class QKeyEvent;
       
    80 class QFocusEvent;
       
    81 class QPaintEvent;
       
    82 class QMoveEvent;
       
    83 class QResizeEvent;
       
    84 class QCloseEvent;
       
    85 class QContextMenuEvent;
       
    86 class QInputMethodEvent;
       
    87 class QTabletEvent;
       
    88 class QDragEnterEvent;
       
    89 class QDragMoveEvent;
       
    90 class QDragLeaveEvent;
       
    91 class QDropEvent;
       
    92 class QShowEvent;
       
    93 class QHideEvent;
       
    94 class QInputContext;
       
    95 class QIcon;
       
    96 class QWindowSurface;
       
    97 class QLocale;
       
    98 class QGraphicsProxyWidget;
       
    99 class QGraphicsEffect;
       
   100 #if defined(Q_WS_X11)
       
   101 class QX11Info;
       
   102 #endif
       
   103 
       
   104 class QWidgetData
       
   105 {
       
   106 public:
       
   107     WId winid;
       
   108     uint widget_attributes;
       
   109     Qt::WindowFlags window_flags;
       
   110     uint window_state : 4;
       
   111     uint focus_policy : 4;
       
   112     uint sizehint_forced :1;
       
   113     uint is_closing :1;
       
   114     uint in_show : 1;
       
   115     uint in_set_window_state : 1;
       
   116     mutable uint fstrut_dirty : 1;
       
   117     uint context_menu_policy : 3;
       
   118     uint window_modality : 2;
       
   119     uint in_destructor : 1;
       
   120     uint unused : 13;
       
   121     QRect crect;
       
   122     mutable QPalette pal;
       
   123     QFont fnt;
       
   124 #if defined(Q_WS_QWS)
       
   125 //    QRegion req_region;                 // Requested region
       
   126 //     mutable QRegion paintable_region;   // Paintable region
       
   127 //     mutable bool paintable_region_dirty;// needs to be recalculated
       
   128 //     mutable QRegion alloc_region;       // Allocated region
       
   129 //     mutable bool alloc_region_dirty;    // needs to be recalculated
       
   130 //     mutable int overlapping_children;   // Handle overlapping children
       
   131 
       
   132     int alloc_region_index;
       
   133 //    int alloc_region_revision;
       
   134 #endif
       
   135     QRect wrect;
       
   136 };
       
   137 
       
   138 class QWidgetPrivate;
       
   139 
       
   140 class Q_GUI_EXPORT QWidget : public QObject, public QPaintDevice
       
   141 {
       
   142     Q_OBJECT
       
   143     Q_DECLARE_PRIVATE(QWidget)
       
   144 
       
   145     Q_PROPERTY(bool modal READ isModal)
       
   146     Q_PROPERTY(Qt::WindowModality windowModality READ windowModality WRITE setWindowModality)
       
   147     Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
       
   148     Q_PROPERTY(QRect geometry READ geometry WRITE setGeometry)
       
   149     Q_PROPERTY(QRect frameGeometry READ frameGeometry)
       
   150     Q_PROPERTY(QRect normalGeometry READ normalGeometry)
       
   151     Q_PROPERTY(int x READ x)
       
   152     Q_PROPERTY(int y READ y)
       
   153     Q_PROPERTY(QPoint pos READ pos WRITE move DESIGNABLE false STORED false)
       
   154     Q_PROPERTY(QSize frameSize READ frameSize)
       
   155     Q_PROPERTY(QSize size READ size WRITE resize DESIGNABLE false STORED false)
       
   156     Q_PROPERTY(int width READ width)
       
   157     Q_PROPERTY(int height READ height)
       
   158     Q_PROPERTY(QRect rect READ rect)
       
   159     Q_PROPERTY(QRect childrenRect READ childrenRect)
       
   160     Q_PROPERTY(QRegion childrenRegion READ childrenRegion)
       
   161     Q_PROPERTY(QSizePolicy sizePolicy READ sizePolicy WRITE setSizePolicy)
       
   162     Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize)
       
   163     Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize)
       
   164     Q_PROPERTY(int minimumWidth READ minimumWidth WRITE setMinimumWidth STORED false DESIGNABLE false)
       
   165     Q_PROPERTY(int minimumHeight READ minimumHeight WRITE setMinimumHeight STORED false DESIGNABLE false)
       
   166     Q_PROPERTY(int maximumWidth READ maximumWidth WRITE setMaximumWidth STORED false DESIGNABLE false)
       
   167     Q_PROPERTY(int maximumHeight READ maximumHeight WRITE setMaximumHeight STORED false DESIGNABLE false)
       
   168     Q_PROPERTY(QSize sizeIncrement READ sizeIncrement WRITE setSizeIncrement)
       
   169     Q_PROPERTY(QSize baseSize READ baseSize WRITE setBaseSize)
       
   170     Q_PROPERTY(QPalette palette READ palette WRITE setPalette)
       
   171     Q_PROPERTY(QFont font READ font WRITE setFont)
       
   172 #ifndef QT_NO_CURSOR
       
   173     Q_PROPERTY(QCursor cursor READ cursor WRITE setCursor RESET unsetCursor)
       
   174 #endif
       
   175     Q_PROPERTY(bool mouseTracking READ hasMouseTracking WRITE setMouseTracking)
       
   176     Q_PROPERTY(bool isActiveWindow READ isActiveWindow)
       
   177     Q_PROPERTY(Qt::FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy)
       
   178     Q_PROPERTY(bool focus READ hasFocus)
       
   179     Q_PROPERTY(Qt::ContextMenuPolicy contextMenuPolicy READ contextMenuPolicy WRITE setContextMenuPolicy)
       
   180     Q_PROPERTY(bool updatesEnabled READ updatesEnabled WRITE setUpdatesEnabled DESIGNABLE false)
       
   181     Q_PROPERTY(bool visible READ isVisible WRITE setVisible DESIGNABLE false)
       
   182     Q_PROPERTY(bool minimized READ isMinimized)
       
   183     Q_PROPERTY(bool maximized READ isMaximized)
       
   184     Q_PROPERTY(bool fullScreen READ isFullScreen)
       
   185     Q_PROPERTY(QSize sizeHint READ sizeHint)
       
   186     Q_PROPERTY(QSize minimumSizeHint READ minimumSizeHint)
       
   187     Q_PROPERTY(bool acceptDrops READ acceptDrops WRITE setAcceptDrops)
       
   188     Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle DESIGNABLE isWindow)
       
   189     Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon DESIGNABLE isWindow)
       
   190     Q_PROPERTY(QString windowIconText READ windowIconText WRITE setWindowIconText DESIGNABLE isWindow)
       
   191     Q_PROPERTY(double windowOpacity READ windowOpacity WRITE setWindowOpacity DESIGNABLE isWindow)
       
   192     Q_PROPERTY(bool windowModified READ isWindowModified WRITE setWindowModified DESIGNABLE isWindow)
       
   193 #ifndef QT_NO_TOOLTIP
       
   194     Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip)
       
   195 #endif
       
   196 #ifndef QT_NO_STATUSTIP
       
   197     Q_PROPERTY(QString statusTip READ statusTip WRITE setStatusTip)
       
   198 #endif
       
   199 #ifndef QT_NO_WHATSTHIS
       
   200     Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis)
       
   201 #endif
       
   202 #ifndef QT_NO_ACCESSIBILITY
       
   203     Q_PROPERTY(QString accessibleName READ accessibleName WRITE setAccessibleName)
       
   204     Q_PROPERTY(QString accessibleDescription READ accessibleDescription WRITE setAccessibleDescription)
       
   205 #endif
       
   206     Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection RESET unsetLayoutDirection)
       
   207     QDOC_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags)
       
   208     Q_PROPERTY(bool autoFillBackground READ autoFillBackground WRITE setAutoFillBackground)
       
   209 #ifndef QT_NO_STYLE_STYLESHEET
       
   210     Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet)
       
   211 #endif
       
   212     Q_PROPERTY(QLocale locale READ locale WRITE setLocale RESET unsetLocale)
       
   213     Q_PROPERTY(QString windowFilePath READ windowFilePath WRITE setWindowFilePath DESIGNABLE isWindow)
       
   214     Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints)
       
   215 
       
   216 public:
       
   217     enum RenderFlag {
       
   218         DrawWindowBackground = 0x1,
       
   219         DrawChildren = 0x2,
       
   220         IgnoreMask = 0x4
       
   221     };
       
   222     Q_DECLARE_FLAGS(RenderFlags, RenderFlag)
       
   223 
       
   224     explicit QWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
       
   225 #ifdef QT3_SUPPORT
       
   226     QT3_SUPPORT_CONSTRUCTOR QWidget(QWidget* parent, const char *name, Qt::WindowFlags f = 0);
       
   227 #endif
       
   228     ~QWidget();
       
   229 
       
   230     int devType() const;
       
   231 
       
   232     WId winId() const;
       
   233     void createWinId(); // internal, going away
       
   234     inline WId internalWinId() const { return data->winid; }
       
   235     WId effectiveWinId() const;
       
   236 
       
   237     // GUI style setting
       
   238     QStyle *style() const;
       
   239     void setStyle(QStyle *);
       
   240     // Widget types and states
       
   241 
       
   242     bool isTopLevel() const;
       
   243     bool isWindow() const;
       
   244 
       
   245     bool isModal() const;
       
   246     Qt::WindowModality windowModality() const;
       
   247     void setWindowModality(Qt::WindowModality windowModality);
       
   248 
       
   249     bool isEnabled() const;
       
   250     bool isEnabledTo(QWidget*) const;
       
   251     bool isEnabledToTLW() const;
       
   252 
       
   253 public Q_SLOTS:
       
   254     void setEnabled(bool);
       
   255     void setDisabled(bool);
       
   256     void setWindowModified(bool);
       
   257 
       
   258     // Widget coordinates
       
   259 
       
   260 public:
       
   261     QRect frameGeometry() const;
       
   262     const QRect &geometry() const;
       
   263     QRect normalGeometry() const;
       
   264 
       
   265     int x() const;
       
   266     int y() const;
       
   267     QPoint pos() const;
       
   268     QSize frameSize() const;
       
   269     QSize size() const;
       
   270     inline int width() const;
       
   271     inline int height() const;
       
   272     inline QRect rect() const;
       
   273     QRect childrenRect() const;
       
   274     QRegion childrenRegion() const;
       
   275 
       
   276     QSize minimumSize() const;
       
   277     QSize maximumSize() const;
       
   278     int minimumWidth() const;
       
   279     int minimumHeight() const;
       
   280     int maximumWidth() const;
       
   281     int maximumHeight() const;
       
   282     void setMinimumSize(const QSize &);
       
   283     void setMinimumSize(int minw, int minh);
       
   284     void setMaximumSize(const QSize &);
       
   285     void setMaximumSize(int maxw, int maxh);
       
   286     void setMinimumWidth(int minw);
       
   287     void setMinimumHeight(int minh);
       
   288     void setMaximumWidth(int maxw);
       
   289     void setMaximumHeight(int maxh);
       
   290 
       
   291     QSize sizeIncrement() const;
       
   292     void setSizeIncrement(const QSize &);
       
   293     void setSizeIncrement(int w, int h);
       
   294     QSize baseSize() const;
       
   295     void setBaseSize(const QSize &);
       
   296     void setBaseSize(int basew, int baseh);
       
   297 
       
   298     void setFixedSize(const QSize &);
       
   299     void setFixedSize(int w, int h);
       
   300     void setFixedWidth(int w);
       
   301     void setFixedHeight(int h);
       
   302 
       
   303     // Widget coordinate mapping
       
   304 
       
   305     QPoint mapToGlobal(const QPoint &) const;
       
   306     QPoint mapFromGlobal(const QPoint &) const;
       
   307     QPoint mapToParent(const QPoint &) const;
       
   308     QPoint mapFromParent(const QPoint &) const;
       
   309     QPoint mapTo(QWidget *, const QPoint &) const;
       
   310     QPoint mapFrom(QWidget *, const QPoint &) const;
       
   311 
       
   312     QWidget *window() const;
       
   313     QWidget *nativeParentWidget() const;
       
   314     inline QWidget *topLevelWidget() const { return window(); }
       
   315 
       
   316     // Widget appearance functions
       
   317     const QPalette &palette() const;
       
   318     void setPalette(const QPalette &);
       
   319 
       
   320     void setBackgroundRole(QPalette::ColorRole);
       
   321     QPalette::ColorRole backgroundRole() const;
       
   322 
       
   323     void setForegroundRole(QPalette::ColorRole);
       
   324     QPalette::ColorRole foregroundRole() const;
       
   325 
       
   326     const QFont &font() const;
       
   327     void setFont(const QFont &);
       
   328     QFontMetrics fontMetrics() const;
       
   329     QFontInfo fontInfo() const;
       
   330 
       
   331 #ifndef QT_NO_CURSOR
       
   332     QCursor cursor() const;
       
   333     void setCursor(const QCursor &);
       
   334     void unsetCursor();
       
   335 #endif
       
   336 
       
   337     void setMouseTracking(bool enable);
       
   338     bool hasMouseTracking() const;
       
   339     bool underMouse() const;
       
   340 
       
   341     void setMask(const QBitmap &);
       
   342     void setMask(const QRegion &);
       
   343     QRegion mask() const;
       
   344     void clearMask();
       
   345 
       
   346     void render(QPaintDevice *target, const QPoint &targetOffset = QPoint(),
       
   347                 const QRegion &sourceRegion = QRegion(),
       
   348                 RenderFlags renderFlags = RenderFlags(DrawWindowBackground | DrawChildren));
       
   349 
       
   350     void render(QPainter *painter, const QPoint &targetOffset = QPoint(),
       
   351                 const QRegion &sourceRegion = QRegion(),
       
   352                 RenderFlags renderFlags = RenderFlags(DrawWindowBackground | DrawChildren));
       
   353 
       
   354     QGraphicsEffect *graphicsEffect() const;
       
   355     void setGraphicsEffect(QGraphicsEffect *effect);
       
   356 
       
   357     void grabGesture(Qt::GestureType type, Qt::GestureContext context = Qt::WidgetWithChildrenGesture);
       
   358 
       
   359 public Q_SLOTS:
       
   360     void setWindowTitle(const QString &);
       
   361 #ifndef QT_NO_STYLE_STYLESHEET
       
   362     void setStyleSheet(const QString& styleSheet);
       
   363 #endif
       
   364 public:
       
   365 #ifndef QT_NO_STYLE_STYLESHEET
       
   366     QString styleSheet() const;
       
   367 #endif
       
   368     QString windowTitle() const;
       
   369     void setWindowIcon(const QIcon &icon);
       
   370     QIcon windowIcon() const;
       
   371     void setWindowIconText(const QString &);
       
   372     QString windowIconText() const;
       
   373     void setWindowRole(const QString &);
       
   374     QString windowRole() const;
       
   375     void setWindowFilePath(const QString &filePath);
       
   376     QString windowFilePath() const;
       
   377 
       
   378     void setWindowOpacity(qreal level);
       
   379     qreal windowOpacity() const;
       
   380 
       
   381     bool isWindowModified() const;
       
   382 #ifndef QT_NO_TOOLTIP
       
   383     void setToolTip(const QString &);
       
   384     QString toolTip() const;
       
   385 #endif
       
   386 #ifndef QT_NO_STATUSTIP
       
   387     void setStatusTip(const QString &);
       
   388     QString statusTip() const;
       
   389 #endif
       
   390 #ifndef QT_NO_WHATSTHIS
       
   391     void setWhatsThis(const QString &);
       
   392     QString whatsThis() const;
       
   393 #endif
       
   394 #ifndef QT_NO_ACCESSIBILITY
       
   395     QString accessibleName() const;
       
   396     void setAccessibleName(const QString &name);
       
   397     QString accessibleDescription() const;
       
   398     void setAccessibleDescription(const QString &description);
       
   399 #endif
       
   400 
       
   401     void setLayoutDirection(Qt::LayoutDirection direction);
       
   402     Qt::LayoutDirection layoutDirection() const;
       
   403     void unsetLayoutDirection();
       
   404 
       
   405     void setLocale(const QLocale &locale);
       
   406     QLocale locale() const;
       
   407     void unsetLocale();
       
   408 
       
   409     inline bool isRightToLeft() const { return layoutDirection() == Qt::RightToLeft; }
       
   410     inline bool isLeftToRight() const { return layoutDirection() == Qt::LeftToRight; }
       
   411 
       
   412 public Q_SLOTS:
       
   413     inline void setFocus() { setFocus(Qt::OtherFocusReason); }
       
   414 
       
   415 public:
       
   416     bool isActiveWindow() const;
       
   417     void activateWindow();
       
   418     void clearFocus();
       
   419 
       
   420     void setFocus(Qt::FocusReason reason);
       
   421     Qt::FocusPolicy focusPolicy() const;
       
   422     void setFocusPolicy(Qt::FocusPolicy policy);
       
   423     bool hasFocus() const;
       
   424     static void setTabOrder(QWidget *, QWidget *);
       
   425     void setFocusProxy(QWidget *);
       
   426     QWidget *focusProxy() const;
       
   427     Qt::ContextMenuPolicy contextMenuPolicy() const;
       
   428     void setContextMenuPolicy(Qt::ContextMenuPolicy policy);
       
   429 
       
   430     // Grab functions
       
   431     void grabMouse();
       
   432 #ifndef QT_NO_CURSOR
       
   433     void grabMouse(const QCursor &);
       
   434 #endif
       
   435     void releaseMouse();
       
   436     void grabKeyboard();
       
   437     void releaseKeyboard();
       
   438 #ifndef QT_NO_SHORTCUT
       
   439     int grabShortcut(const QKeySequence &key, Qt::ShortcutContext context = Qt::WindowShortcut);
       
   440     void releaseShortcut(int id);
       
   441     void setShortcutEnabled(int id, bool enable = true);
       
   442     void setShortcutAutoRepeat(int id, bool enable = true);
       
   443 #endif
       
   444     static QWidget *mouseGrabber();
       
   445     static QWidget *keyboardGrabber();
       
   446 
       
   447     // Update/refresh functions
       
   448     inline bool updatesEnabled() const;
       
   449     void setUpdatesEnabled(bool enable);
       
   450 
       
   451 #if 0 //def Q_WS_QWS
       
   452     void repaintUnclipped(const QRegion &, bool erase = true);
       
   453 #endif
       
   454 
       
   455 #ifndef QT_NO_GRAPHICSVIEW
       
   456     QGraphicsProxyWidget *graphicsProxyWidget() const;
       
   457 #endif
       
   458 
       
   459 public Q_SLOTS:
       
   460     void update();
       
   461     void repaint();
       
   462 
       
   463 public:
       
   464     inline void update(int x, int y, int w, int h);
       
   465     void update(const QRect&);
       
   466     void update(const QRegion&);
       
   467 
       
   468     void repaint(int x, int y, int w, int h);
       
   469     void repaint(const QRect &);
       
   470     void repaint(const QRegion &);
       
   471 
       
   472 public Q_SLOTS:
       
   473     // Widget management functions
       
   474 
       
   475     virtual void setVisible(bool visible);
       
   476     inline void setHidden(bool hidden) { setVisible(!hidden); }
       
   477 #ifndef Q_WS_WINCE
       
   478     inline void show() { setVisible(true); }
       
   479 #else
       
   480     void show();
       
   481 #endif
       
   482     inline void hide() { setVisible(false); }
       
   483     inline QT_MOC_COMPAT void setShown(bool shown) { setVisible(shown); }
       
   484 
       
   485     void showMinimized();
       
   486     void showMaximized();
       
   487     void showFullScreen();
       
   488     void showNormal();
       
   489 
       
   490     bool close();
       
   491     void raise();
       
   492     void lower();
       
   493 
       
   494 public:
       
   495     void stackUnder(QWidget*);
       
   496     void move(int x, int y);
       
   497     void move(const QPoint &);
       
   498     void resize(int w, int h);
       
   499     void resize(const QSize &);
       
   500     inline void setGeometry(int x, int y, int w, int h);
       
   501     void setGeometry(const QRect &);
       
   502     QByteArray saveGeometry() const;
       
   503     bool restoreGeometry(const QByteArray &geometry);
       
   504     void adjustSize();
       
   505     bool isVisible() const;
       
   506     bool isVisibleTo(QWidget*) const;
       
   507     // ### Qt 5: bool isVisibleTo(_const_ QWidget *) const
       
   508     inline bool isHidden() const;
       
   509 
       
   510     bool isMinimized() const;
       
   511     bool isMaximized() const;
       
   512     bool isFullScreen() const;
       
   513 
       
   514     Qt::WindowStates windowState() const;
       
   515     void setWindowState(Qt::WindowStates state);
       
   516     void overrideWindowState(Qt::WindowStates state);
       
   517 
       
   518     virtual QSize sizeHint() const;
       
   519     virtual QSize minimumSizeHint() const;
       
   520 
       
   521     QSizePolicy sizePolicy() const;
       
   522     void setSizePolicy(QSizePolicy);
       
   523     inline void setSizePolicy(QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical);
       
   524     virtual int heightForWidth(int) const;
       
   525 
       
   526     QRegion visibleRegion() const;
       
   527 
       
   528     void setContentsMargins(int left, int top, int right, int bottom);
       
   529     void setContentsMargins(const QMargins &margins);
       
   530     void getContentsMargins(int *left, int *top, int *right, int *bottom) const;
       
   531     QMargins contentsMargins() const;
       
   532 
       
   533     QRect contentsRect() const;
       
   534 
       
   535 public:
       
   536     QLayout *layout() const;
       
   537     void setLayout(QLayout *);
       
   538     void updateGeometry();
       
   539 
       
   540     void setParent(QWidget *parent);
       
   541     void setParent(QWidget *parent, Qt::WindowFlags f);
       
   542 
       
   543     void scroll(int dx, int dy);
       
   544     void scroll(int dx, int dy, const QRect&);
       
   545 
       
   546     // Misc. functions
       
   547 
       
   548     QWidget *focusWidget() const;
       
   549     QWidget *nextInFocusChain() const;
       
   550     QWidget *previousInFocusChain() const;
       
   551 
       
   552     // drag and drop
       
   553     bool acceptDrops() const;
       
   554     void setAcceptDrops(bool on);
       
   555 
       
   556 #ifndef QT_NO_ACTION
       
   557     //actions
       
   558     void addAction(QAction *action);
       
   559     void addActions(QList<QAction*> actions);
       
   560     void insertAction(QAction *before, QAction *action);
       
   561     void insertActions(QAction *before, QList<QAction*> actions);
       
   562     void removeAction(QAction *action);
       
   563     QList<QAction*> actions() const;
       
   564 #endif
       
   565 
       
   566     QWidget *parentWidget() const;
       
   567 
       
   568     void setWindowFlags(Qt::WindowFlags type);
       
   569     inline Qt::WindowFlags windowFlags() const;
       
   570     void overrideWindowFlags(Qt::WindowFlags type);
       
   571 
       
   572     inline Qt::WindowType windowType() const;
       
   573 
       
   574     static QWidget *find(WId);
       
   575 #ifdef QT3_SUPPORT
       
   576     static QT3_SUPPORT QWidgetMapper *wmapper();
       
   577 #endif
       
   578     inline QWidget *childAt(int x, int y) const;
       
   579     QWidget *childAt(const QPoint &p) const;
       
   580 
       
   581 #if defined(Q_WS_X11)
       
   582     const QX11Info &x11Info() const;
       
   583     Qt::HANDLE x11PictureHandle() const;
       
   584 #endif
       
   585 
       
   586 #if defined(Q_WS_MAC)
       
   587     Qt::HANDLE macQDHandle() const;
       
   588     Qt::HANDLE macCGHandle() const;
       
   589 #endif
       
   590 
       
   591 #if defined(Q_WS_WIN)
       
   592     HDC getDC() const;
       
   593     void releaseDC(HDC) const;
       
   594 #else
       
   595     Qt::HANDLE handle() const;
       
   596 #endif
       
   597 
       
   598     void setAttribute(Qt::WidgetAttribute, bool on = true);
       
   599     inline bool testAttribute(Qt::WidgetAttribute) const;
       
   600 
       
   601     QPaintEngine *paintEngine() const;
       
   602 
       
   603     void ensurePolished() const;
       
   604 
       
   605     QInputContext *inputContext();
       
   606     void setInputContext(QInputContext *);
       
   607 
       
   608     bool isAncestorOf(const QWidget *child) const;
       
   609 
       
   610 #ifdef QT_KEYPAD_NAVIGATION
       
   611     bool hasEditFocus() const;
       
   612     void setEditFocus(bool on);
       
   613 #endif
       
   614 
       
   615     bool autoFillBackground() const;
       
   616     void setAutoFillBackground(bool enabled);
       
   617 
       
   618     void setWindowSurface(QWindowSurface *surface);
       
   619     QWindowSurface *windowSurface() const;
       
   620 
       
   621 Q_SIGNALS:
       
   622     void customContextMenuRequested(const QPoint &pos);
       
   623 
       
   624 protected:
       
   625     // Event handlers
       
   626     bool event(QEvent *);
       
   627     virtual void mousePressEvent(QMouseEvent *);
       
   628     virtual void mouseReleaseEvent(QMouseEvent *);
       
   629     virtual void mouseDoubleClickEvent(QMouseEvent *);
       
   630     virtual void mouseMoveEvent(QMouseEvent *);
       
   631 #ifndef QT_NO_WHEELEVENT
       
   632     virtual void wheelEvent(QWheelEvent *);
       
   633 #endif
       
   634     virtual void keyPressEvent(QKeyEvent *);
       
   635     virtual void keyReleaseEvent(QKeyEvent *);
       
   636     virtual void focusInEvent(QFocusEvent *);
       
   637     virtual void focusOutEvent(QFocusEvent *);
       
   638     virtual void enterEvent(QEvent *);
       
   639     virtual void leaveEvent(QEvent *);
       
   640     virtual void paintEvent(QPaintEvent *);
       
   641     virtual void moveEvent(QMoveEvent *);
       
   642     virtual void resizeEvent(QResizeEvent *);
       
   643     virtual void closeEvent(QCloseEvent *);
       
   644 #ifndef QT_NO_CONTEXTMENU
       
   645     virtual void contextMenuEvent(QContextMenuEvent *);
       
   646 #endif
       
   647 #ifndef QT_NO_TABLETEVENT
       
   648     virtual void tabletEvent(QTabletEvent *);
       
   649 #endif
       
   650 #ifndef QT_NO_ACTION
       
   651     virtual void actionEvent(QActionEvent *);
       
   652 #endif
       
   653 
       
   654 #ifndef QT_NO_DRAGANDDROP
       
   655     virtual void dragEnterEvent(QDragEnterEvent *);
       
   656     virtual void dragMoveEvent(QDragMoveEvent *);
       
   657     virtual void dragLeaveEvent(QDragLeaveEvent *);
       
   658     virtual void dropEvent(QDropEvent *);
       
   659 #endif
       
   660 
       
   661     virtual void showEvent(QShowEvent *);
       
   662     virtual void hideEvent(QHideEvent *);
       
   663 
       
   664 #if defined(Q_WS_MAC)
       
   665     virtual bool macEvent(EventHandlerCallRef, EventRef);
       
   666 #endif
       
   667 #if defined(Q_WS_WIN)
       
   668     virtual bool winEvent(MSG *message, long *result);
       
   669 #endif
       
   670 #if defined(Q_WS_X11)
       
   671     virtual bool x11Event(XEvent *);
       
   672 #endif
       
   673 #if defined(Q_WS_QWS)
       
   674     virtual bool qwsEvent(QWSEvent *);
       
   675 #endif
       
   676 
       
   677     // Misc. protected functions
       
   678     virtual void changeEvent(QEvent *);
       
   679 
       
   680     int metric(PaintDeviceMetric) const;
       
   681 
       
   682     virtual void inputMethodEvent(QInputMethodEvent *);
       
   683 public:
       
   684     virtual QVariant inputMethodQuery(Qt::InputMethodQuery) const;
       
   685 
       
   686     Qt::InputMethodHints inputMethodHints() const;
       
   687     void setInputMethodHints(Qt::InputMethodHints hints);
       
   688 
       
   689 protected:
       
   690     void resetInputContext();
       
   691 protected Q_SLOTS:
       
   692     void updateMicroFocus();
       
   693 protected:
       
   694 
       
   695     void create(WId = 0, bool initializeWindow = true,
       
   696                          bool destroyOldWindow = true);
       
   697     void destroy(bool destroyWindow = true,
       
   698                  bool destroySubWindows = true);
       
   699 
       
   700     virtual bool focusNextPrevChild(bool next);
       
   701     inline bool focusNextChild() { return focusNextPrevChild(true); }
       
   702     inline bool focusPreviousChild() { return focusNextPrevChild(false); }
       
   703 
       
   704 protected:
       
   705     QWidget(QWidgetPrivate &d, QWidget* parent, Qt::WindowFlags f);
       
   706 private:
       
   707 
       
   708     bool testAttribute_helper(Qt::WidgetAttribute) const;
       
   709 
       
   710     QLayout *takeLayout();
       
   711 
       
   712     friend class QBackingStoreDevice;
       
   713     friend class QWidgetBackingStore;
       
   714     friend class QApplication;
       
   715     friend class QApplicationPrivate;
       
   716     friend class QBaseApplication;
       
   717     friend class QPainter;
       
   718     friend class QPainterPrivate;
       
   719     friend class QPixmap; // for QPixmap::fill()
       
   720     friend class QFontMetrics;
       
   721     friend class QFontInfo;
       
   722     friend class QETWidget;
       
   723     friend class QLayout;
       
   724     friend class QWidgetItem;
       
   725     friend class QWidgetItemV2;
       
   726     friend class QGLContext;
       
   727     friend class QGLWidget;
       
   728     friend class QGLWindowSurface;
       
   729     friend class QX11PaintEngine;
       
   730     friend class QWin32PaintEngine;
       
   731     friend class QShortcutPrivate;
       
   732     friend class QShortcutMap;
       
   733     friend class QWindowSurface;
       
   734     friend class QGraphicsProxyWidget;
       
   735     friend class QGraphicsProxyWidgetPrivate;
       
   736     friend class QStyleSheetStyle;
       
   737     friend struct QWidgetExceptionCleaner;
       
   738     friend class QGestureManager;
       
   739     friend class QWinNativePanGestureRecognizer;
       
   740 
       
   741 #ifdef Q_WS_MAC
       
   742     friend class QCoreGraphicsPaintEnginePrivate;
       
   743     friend QPoint qt_mac_posInWindow(const QWidget *w);
       
   744     friend OSWindowRef qt_mac_window_for(const QWidget *w);
       
   745     friend bool qt_mac_is_metal(const QWidget *w);
       
   746     friend OSViewRef qt_mac_nativeview_for(const QWidget *w);
       
   747     friend void qt_event_request_window_change(QWidget *widget);
       
   748     friend bool qt_mac_sendMacEventToWidget(QWidget *widget, EventRef ref);
       
   749 #endif
       
   750 #ifdef Q_WS_QWS
       
   751     friend class QWSBackingStore;
       
   752     friend class QWSManager;
       
   753     friend class QWSManagerPrivate;
       
   754     friend class QDecoration;
       
   755     friend class QWSWindowSurface;
       
   756     friend class QScreen;
       
   757     friend class QVNCScreen;
       
   758     friend bool isWidgetOpaque(const QWidget *);
       
   759     friend class QGLWidgetPrivate;
       
   760 #endif
       
   761 #ifdef Q_OS_SYMBIAN
       
   762     friend class QSymbianControl;
       
   763     friend class QS60WindowSurface;
       
   764 #endif
       
   765 #ifdef Q_WS_X11
       
   766     friend void qt_net_update_user_time(QWidget *tlw, unsigned long timestamp);
       
   767     friend void qt_net_remove_user_time(QWidget *tlw);
       
   768 #endif
       
   769 
       
   770     friend Q_GUI_EXPORT QWidgetData *qt_qwidget_data(QWidget *widget);
       
   771     friend Q_GUI_EXPORT QWidgetPrivate *qt_widget_private(QWidget *widget);
       
   772 
       
   773 private:
       
   774     Q_DISABLE_COPY(QWidget)
       
   775     Q_PRIVATE_SLOT(d_func(), void _q_showIfNotHidden())
       
   776 #ifdef Q_OS_SYMBIAN
       
   777     Q_PRIVATE_SLOT(d_func(), void _q_delayedDestroy(WId winId))
       
   778 #endif
       
   779 
       
   780     QWidgetData *data;
       
   781 
       
   782 #ifdef QT3_SUPPORT
       
   783 public:
       
   784     inline QT3_SUPPORT bool isUpdatesEnabled() const { return updatesEnabled(); }
       
   785     QT3_SUPPORT QStyle *setStyle(const QString&);
       
   786     inline QT3_SUPPORT bool isVisibleToTLW() const;
       
   787     QT3_SUPPORT QRect visibleRect() const;
       
   788     inline QT3_SUPPORT void iconify() { showMinimized(); }
       
   789     inline QT3_SUPPORT void constPolish() const { ensurePolished(); }
       
   790     inline QT3_SUPPORT void polish() { ensurePolished(); }
       
   791     inline QT3_SUPPORT void reparent(QWidget *parent, Qt::WindowFlags f, const QPoint &p, bool showIt=false)
       
   792     { setParent(parent, f); setGeometry(p.x(),p.y(),width(),height()); if (showIt) show(); }
       
   793     inline QT3_SUPPORT void reparent(QWidget *parent, const QPoint &p, bool showIt=false)
       
   794     { setParent(parent, windowFlags() & ~Qt::WindowType_Mask); setGeometry(p.x(),p.y(),width(),height()); if (showIt) show(); }
       
   795     inline QT3_SUPPORT void recreate(QWidget *parent, Qt::WindowFlags f, const QPoint & p, bool showIt=false)
       
   796     { setParent(parent, f); setGeometry(p.x(),p.y(),width(),height()); if (showIt) show(); }
       
   797     inline QT3_SUPPORT void setSizePolicy(QSizePolicy::Policy hor, QSizePolicy::Policy ver, bool hfw)
       
   798     { QSizePolicy sp(hor, ver); sp.setHeightForWidth(hfw); setSizePolicy(sp);}
       
   799     inline QT3_SUPPORT bool hasMouse() const { return testAttribute(Qt::WA_UnderMouse); }
       
   800 #ifndef QT_NO_CURSOR
       
   801     inline QT3_SUPPORT bool ownCursor() const { return testAttribute(Qt::WA_SetCursor); }
       
   802 #endif
       
   803     inline QT3_SUPPORT bool ownFont() const { return testAttribute(Qt::WA_SetFont); }
       
   804     inline QT3_SUPPORT void unsetFont() { setFont(QFont()); }
       
   805     inline QT3_SUPPORT bool ownPalette() const { return testAttribute(Qt::WA_SetPalette); }
       
   806     inline QT3_SUPPORT void unsetPalette() { setPalette(QPalette()); }
       
   807     Qt::BackgroundMode QT3_SUPPORT backgroundMode() const;
       
   808     void QT3_SUPPORT setBackgroundMode(Qt::BackgroundMode, Qt::BackgroundMode = Qt::PaletteBackground);
       
   809     const QT3_SUPPORT QColor &eraseColor() const;
       
   810     void QT3_SUPPORT setEraseColor(const QColor &);
       
   811     const QT3_SUPPORT QColor &foregroundColor() const;
       
   812     const QT3_SUPPORT QPixmap *erasePixmap() const;
       
   813     void QT3_SUPPORT setErasePixmap(const QPixmap &);
       
   814     const QT3_SUPPORT QColor &paletteForegroundColor() const;
       
   815     void QT3_SUPPORT setPaletteForegroundColor(const QColor &);
       
   816     const QT3_SUPPORT QColor &paletteBackgroundColor() const;
       
   817     void QT3_SUPPORT setPaletteBackgroundColor(const QColor &);
       
   818     const QT3_SUPPORT QPixmap *paletteBackgroundPixmap() const;
       
   819     void QT3_SUPPORT setPaletteBackgroundPixmap(const QPixmap &);
       
   820     const QT3_SUPPORT QBrush& backgroundBrush() const;
       
   821     const QT3_SUPPORT QColor &backgroundColor() const;
       
   822     const QT3_SUPPORT QPixmap *backgroundPixmap() const;
       
   823     void QT3_SUPPORT setBackgroundPixmap(const QPixmap &);
       
   824     QT3_SUPPORT void setBackgroundColor(const QColor &);
       
   825     QT3_SUPPORT QColorGroup colorGroup() const;
       
   826     QT3_SUPPORT QWidget *parentWidget(bool sameWindow) const;
       
   827     inline QT3_SUPPORT void setKeyCompression(bool b) { setAttribute(Qt::WA_KeyCompression, b); }
       
   828     inline QT3_SUPPORT void setFont(const QFont &f, bool) { setFont(f); }
       
   829     inline QT3_SUPPORT void setPalette(const QPalette &p, bool) { setPalette(p); }
       
   830     enum BackgroundOrigin { WidgetOrigin, ParentOrigin, WindowOrigin, AncestorOrigin };
       
   831     inline QT3_SUPPORT void setBackgroundOrigin(BackgroundOrigin) {}
       
   832     inline QT3_SUPPORT BackgroundOrigin backgroundOrigin() const { return WindowOrigin; }
       
   833     inline QT3_SUPPORT QPoint backgroundOffset() const { return QPoint(); }
       
   834     inline QT3_SUPPORT void repaint(bool) { repaint(); }
       
   835     inline QT3_SUPPORT void repaint(int x, int y, int w, int h, bool) { repaint(x,y,w,h); }
       
   836     inline QT3_SUPPORT void repaint(const QRect &r, bool) { repaint(r); }
       
   837     inline QT3_SUPPORT void repaint(const QRegion &rgn, bool) { repaint(rgn); }
       
   838     QT3_SUPPORT void erase();
       
   839     inline QT3_SUPPORT void erase(int x, int y, int w, int h) { erase_helper(x, y, w, h); }
       
   840     QT3_SUPPORT void erase(const QRect &);
       
   841     QT3_SUPPORT void erase(const QRegion &);
       
   842     QT3_SUPPORT void drawText(const QPoint &p, const QString &s)
       
   843     { drawText_helper(p.x(), p.y(), s); }
       
   844     inline QT3_SUPPORT void drawText(int x, int y, const QString &s)
       
   845     { drawText_helper(x, y, s); }
       
   846     QT3_SUPPORT bool close(bool);
       
   847     inline QT3_SUPPORT QWidget *childAt(int x, int y, bool includeThis) const
       
   848     {
       
   849         QWidget *w = childAt(x, y);
       
   850         return w ? w : ((includeThis && rect().contains(x,y))?const_cast<QWidget*>(this):0);
       
   851     }
       
   852     inline QT3_SUPPORT QWidget *childAt(const QPoint &p, bool includeThis) const
       
   853     {
       
   854         QWidget *w = childAt(p);
       
   855         return w ? w : ((includeThis && rect().contains(p))?const_cast<QWidget*>(this):0);
       
   856     }
       
   857     inline QT3_SUPPORT void setCaption(const QString &c)   { setWindowTitle(c); }
       
   858     QT3_SUPPORT void setIcon(const QPixmap &i);
       
   859     inline QT3_SUPPORT void setIconText(const QString &it) { setWindowIconText(it); }
       
   860     inline QT3_SUPPORT QString caption() const             { return windowTitle(); }
       
   861     QT3_SUPPORT const QPixmap *icon() const;
       
   862     inline QT3_SUPPORT QString iconText() const            { return windowIconText(); }
       
   863     inline QT3_SUPPORT void setInputMethodEnabled(bool b) { setAttribute(Qt::WA_InputMethodEnabled, b); }
       
   864     inline QT3_SUPPORT bool isInputMethodEnabled() const { return testAttribute(Qt::WA_InputMethodEnabled); }
       
   865     inline QT3_SUPPORT void setActiveWindow() { activateWindow(); }
       
   866     inline QT3_SUPPORT bool isShown() const { return !isHidden(); }
       
   867     inline QT3_SUPPORT bool isDialog() const { return windowType() == Qt::Dialog; }
       
   868     inline QT3_SUPPORT bool isPopup() const { return windowType() == Qt::Popup; }
       
   869     inline QT3_SUPPORT bool isDesktop() const { return windowType() == Qt::Desktop; }
       
   870 
       
   871 
       
   872 private:
       
   873     void drawText_helper(int x, int y, const QString &);
       
   874     void erase_helper(int x, int y, int w, int h);
       
   875 #endif // QT3_SUPPORT
       
   876 
       
   877 protected:
       
   878     virtual void styleChange(QStyle&); // compat
       
   879     virtual void enabledChange(bool);  // compat
       
   880     virtual void paletteChange(const QPalette &);  // compat
       
   881     virtual void fontChange(const QFont &); // compat
       
   882     virtual void windowActivationChange(bool);  // compat
       
   883     virtual void languageChange();  // compat
       
   884 };
       
   885 
       
   886 Q_DECLARE_OPERATORS_FOR_FLAGS(QWidget::RenderFlags)
       
   887 
       
   888 #if defined Q_CC_MSVC && _MSC_VER < 1300
       
   889 template <> inline QWidget *qobject_cast_helper<QWidget*>(QObject *o, QWidget *)
       
   890 {
       
   891     if (!o || !o->isWidgetType()) return 0;
       
   892     return (QWidget*)(o);
       
   893 }
       
   894 #else
       
   895 template <> inline QWidget *qobject_cast<QWidget*>(QObject *o)
       
   896 {
       
   897     if (!o || !o->isWidgetType()) return 0;
       
   898     return static_cast<QWidget*>(o);
       
   899 }
       
   900 template <> inline const QWidget *qobject_cast<const QWidget*>(const QObject *o)
       
   901 {
       
   902     if (!o || !o->isWidgetType()) return 0;
       
   903     return static_cast<const QWidget*>(o);
       
   904 }
       
   905 #endif
       
   906 
       
   907 inline QWidget *QWidget::childAt(int ax, int ay) const
       
   908 { return childAt(QPoint(ax, ay)); }
       
   909 
       
   910 inline Qt::WindowType QWidget::windowType() const
       
   911 { return static_cast<Qt::WindowType>(int(data->window_flags & Qt::WindowType_Mask)); }
       
   912 inline Qt::WindowFlags QWidget::windowFlags() const
       
   913 { return data->window_flags; }
       
   914 
       
   915 inline bool QWidget::isTopLevel() const
       
   916 { return (windowType() & Qt::Window); }
       
   917 
       
   918 inline bool QWidget::isWindow() const
       
   919 { return (windowType() & Qt::Window); }
       
   920 
       
   921 inline bool QWidget::isEnabled() const
       
   922 { return !testAttribute(Qt::WA_Disabled); }
       
   923 
       
   924 inline bool QWidget::isModal() const
       
   925 { return data->window_modality != Qt::NonModal; }
       
   926 
       
   927 inline bool QWidget::isEnabledToTLW() const
       
   928 { return isEnabled(); }
       
   929 
       
   930 inline int QWidget::minimumWidth() const
       
   931 { return minimumSize().width(); }
       
   932 
       
   933 inline int QWidget::minimumHeight() const
       
   934 { return minimumSize().height(); }
       
   935 
       
   936 inline int QWidget::maximumWidth() const
       
   937 { return maximumSize().width(); }
       
   938 
       
   939 inline int QWidget::maximumHeight() const
       
   940 { return maximumSize().height(); }
       
   941 
       
   942 inline void QWidget::setMinimumSize(const QSize &s)
       
   943 { setMinimumSize(s.width(),s.height()); }
       
   944 
       
   945 inline void QWidget::setMaximumSize(const QSize &s)
       
   946 { setMaximumSize(s.width(),s.height()); }
       
   947 
       
   948 inline void QWidget::setSizeIncrement(const QSize &s)
       
   949 { setSizeIncrement(s.width(),s.height()); }
       
   950 
       
   951 inline void QWidget::setBaseSize(const QSize &s)
       
   952 { setBaseSize(s.width(),s.height()); }
       
   953 
       
   954 inline const QFont &QWidget::font() const
       
   955 { return data->fnt; }
       
   956 
       
   957 inline QFontMetrics QWidget::fontMetrics() const
       
   958 { return QFontMetrics(data->fnt); }
       
   959 
       
   960 inline QFontInfo QWidget::fontInfo() const
       
   961 { return QFontInfo(data->fnt); }
       
   962 
       
   963 inline void QWidget::setMouseTracking(bool enable)
       
   964 { setAttribute(Qt::WA_MouseTracking, enable); }
       
   965 
       
   966 inline bool QWidget::hasMouseTracking() const
       
   967 { return testAttribute(Qt::WA_MouseTracking); }
       
   968 
       
   969 inline bool QWidget::underMouse() const
       
   970 { return testAttribute(Qt::WA_UnderMouse); }
       
   971 
       
   972 inline bool QWidget::updatesEnabled() const
       
   973 { return !testAttribute(Qt::WA_UpdatesDisabled); }
       
   974 
       
   975 inline void QWidget::update(int ax, int ay, int aw, int ah)
       
   976 { update(QRect(ax, ay, aw, ah)); }
       
   977 
       
   978 inline bool QWidget::isVisible() const
       
   979 { return testAttribute(Qt::WA_WState_Visible); }
       
   980 
       
   981 inline bool QWidget::isHidden() const
       
   982 { return testAttribute(Qt::WA_WState_Hidden); }
       
   983 
       
   984 inline void QWidget::move(int ax, int ay)
       
   985 { move(QPoint(ax, ay)); }
       
   986 
       
   987 inline void QWidget::resize(int w, int h)
       
   988 { resize(QSize(w, h)); }
       
   989 
       
   990 inline void QWidget::setGeometry(int ax, int ay, int aw, int ah)
       
   991 { setGeometry(QRect(ax, ay, aw, ah)); }
       
   992 
       
   993 inline QRect QWidget::rect() const
       
   994 { return QRect(0,0,data->crect.width(),data->crect.height()); }
       
   995 
       
   996 inline const QRect &QWidget::geometry() const
       
   997 { return data->crect; }
       
   998 
       
   999 inline QSize QWidget::size() const
       
  1000 { return data->crect.size(); }
       
  1001 
       
  1002 inline int QWidget::width() const
       
  1003 { return data->crect.width(); }
       
  1004 
       
  1005 inline int QWidget::height() const
       
  1006 { return data->crect.height(); }
       
  1007 
       
  1008 inline QWidget *QWidget::parentWidget() const
       
  1009 { return static_cast<QWidget *>(QObject::parent()); }
       
  1010 
       
  1011 inline void QWidget::setSizePolicy(QSizePolicy::Policy hor, QSizePolicy::Policy ver)
       
  1012 { setSizePolicy(QSizePolicy(hor, ver)); }
       
  1013 
       
  1014 inline bool QWidget::testAttribute(Qt::WidgetAttribute attribute) const
       
  1015 {
       
  1016     if (attribute < int(8*sizeof(uint)))
       
  1017         return data->widget_attributes & (1<<attribute);
       
  1018     return testAttribute_helper(attribute);
       
  1019 }
       
  1020 
       
  1021 #ifdef QT3_SUPPORT
       
  1022 inline bool QWidget::isVisibleToTLW() const
       
  1023 { return isVisible(); }
       
  1024 inline QWidget *QWidget::parentWidget(bool sameWindow) const
       
  1025 {
       
  1026     if (sameWindow && isWindow())
       
  1027         return 0;
       
  1028     return static_cast<QWidget *>(QObject::parent());
       
  1029 }
       
  1030 inline QColorGroup QWidget::colorGroup() const
       
  1031 { return QColorGroup(palette()); }
       
  1032 inline void QWidget::setPaletteForegroundColor(const QColor &c)
       
  1033 { QPalette p = palette(); p.setColor(foregroundRole(), c); setPalette(p); }
       
  1034 inline const QBrush& QWidget::backgroundBrush() const { return palette().brush(backgroundRole()); }
       
  1035 inline void QWidget::setBackgroundPixmap(const QPixmap &pm)
       
  1036 { QPalette p = palette(); p.setBrush(backgroundRole(), QBrush(pm)); setPalette(p); }
       
  1037 inline const QPixmap *QWidget::backgroundPixmap() const { return 0; }
       
  1038 inline void QWidget::setBackgroundColor(const QColor &c)
       
  1039 { QPalette p = palette(); p.setColor(backgroundRole(), c); setPalette(p); }
       
  1040 inline const QColor & QWidget::backgroundColor() const { return palette().color(backgroundRole()); }
       
  1041 inline const QColor &QWidget::foregroundColor() const { return palette().color(foregroundRole());}
       
  1042 inline const QColor &QWidget::eraseColor() const { return palette().color(backgroundRole()); }
       
  1043 inline void QWidget::setEraseColor(const QColor &c)
       
  1044 { QPalette p = palette(); p.setColor(backgroundRole(), c); setPalette(p); }
       
  1045 inline const QPixmap *QWidget::erasePixmap() const { return 0; }
       
  1046 inline void QWidget::setErasePixmap(const QPixmap &pm)
       
  1047 { QPalette p = palette(); p.setBrush(backgroundRole(), QBrush(pm)); setPalette(p); }
       
  1048 inline const QColor &QWidget::paletteForegroundColor() const { return palette().color(foregroundRole());}
       
  1049 inline const QColor &QWidget::paletteBackgroundColor() const { return palette().color(backgroundRole()); }
       
  1050 inline void QWidget::setPaletteBackgroundColor(const QColor &c)
       
  1051 { QPalette p = palette(); p.setColor(backgroundRole(), c); setPalette(p); }
       
  1052 inline const QPixmap *QWidget::paletteBackgroundPixmap() const
       
  1053 { return 0; }
       
  1054 inline void QWidget::setPaletteBackgroundPixmap(const QPixmap &pm)
       
  1055 { QPalette p = palette(); p.setBrush(backgroundRole(), QBrush(pm)); setPalette(p); }
       
  1056 inline QT3_SUPPORT void QWidget::erase() { erase_helper(0, 0, data->crect.width(), data->crect.height()); }
       
  1057 inline QT3_SUPPORT void QWidget::erase(const QRect &r) { erase_helper(r.x(), r.y(), r.width(), r.height()); }
       
  1058 #endif
       
  1059 
       
  1060 #define QWIDGETSIZE_MAX ((1<<24)-1)
       
  1061 
       
  1062 QT_END_NAMESPACE
       
  1063 
       
  1064 QT_END_HEADER
       
  1065 
       
  1066 #endif // QWIDGET_H