60 #ifdef Q_WS_QPA //should this go somewhere else?
64 #ifdef QT_INCLUDE_COMPAT
75 class QWSRegionManager;
103 class QWindowSurface;
108 class QRasterWindowSurface;
109 class QUnifiedToolbarSurface;
110 #if defined(Q_WS_X11)
134 #if defined(Q_WS_QWS)
142 int alloc_region_index;
148 class QWidgetPrivate;
174 Q_PROPERTY(
int minimumWidth READ minimumWidth WRITE setMinimumWidth STORED false DESIGNABLE false)
175 Q_PROPERTY(
int minimumHeight READ minimumHeight WRITE setMinimumHeight STORED false DESIGNABLE false)
176 Q_PROPERTY(
int maximumWidth READ maximumWidth WRITE setMaximumWidth STORED false DESIGNABLE false)
177 Q_PROPERTY(
int maximumHeight READ maximumHeight WRITE setMaximumHeight STORED false DESIGNABLE false)
185 Q_PROPERTY(
bool mouseTracking READ hasMouseTracking WRITE setMouseTracking)
190 Q_PROPERTY(
bool updatesEnabled READ updatesEnabled WRITE setUpdatesEnabled DESIGNABLE false)
191 Q_PROPERTY(
bool visible READ isVisible WRITE setVisible DESIGNABLE false)
197 Q_PROPERTY(
bool acceptDrops READ acceptDrops WRITE setAcceptDrops)
200 Q_PROPERTY(
QString windowIconText READ windowIconText WRITE setWindowIconText DESIGNABLE isWindow)
201 Q_PROPERTY(
double windowOpacity READ windowOpacity WRITE setWindowOpacity DESIGNABLE isWindow)
202 Q_PROPERTY(
bool windowModified READ isWindowModified WRITE setWindowModified DESIGNABLE isWindow)
203 #ifndef QT_NO_TOOLTIP
206 #ifndef QT_NO_STATUSTIP
209 #ifndef QT_NO_WHATSTHIS
212 #ifndef QT_NO_ACCESSIBILITY
214 Q_PROPERTY(
QString accessibleDescription READ accessibleDescription WRITE setAccessibleDescription)
217 QDOC_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags)
218 Q_PROPERTY(
bool autoFillBackground READ autoFillBackground WRITE setAutoFillBackground)
219 #ifndef QT_NO_STYLE_STYLESHEET
223 Q_PROPERTY(
QString windowFilePath READ windowFilePath WRITE setWindowFilePath DESIGNABLE isWindow)
224 Q_PROPERTY(
Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints)
228 DrawWindowBackground = 0x1,
232 Q_DECLARE_FLAGS(RenderFlags, RenderFlag)
236 QT3_SUPPORT_CONSTRUCTOR
QWidget(
QWidget* parent,
const char *
name, Qt::WindowFlags f = 0);
245 WId effectiveWinId()
const;
248 QStyle *style()
const;
249 void setStyle(QStyle *);
252 bool isTopLevel()
const;
253 bool isWindow()
const;
255 bool isModal()
const;
259 bool isEnabled()
const;
260 bool isEnabledTo(
QWidget*)
const;
261 bool isEnabledToTLW()
const;
264 void setEnabled(
bool);
265 void setDisabled(
bool);
266 void setWindowModified(
bool);
271 QRect frameGeometry()
const;
272 const QRect &geometry()
const;
273 QRect normalGeometry()
const;
278 QSize frameSize()
const;
280 inline int width()
const;
281 inline int height()
const;
282 inline QRect rect()
const;
283 QRect childrenRect()
const;
284 QRegion childrenRegion()
const;
286 QSize minimumSize()
const;
287 QSize maximumSize()
const;
288 int minimumWidth()
const;
289 int minimumHeight()
const;
290 int maximumWidth()
const;
291 int maximumHeight()
const;
292 void setMinimumSize(
const QSize &);
293 void setMinimumSize(
int minw,
int minh);
294 void setMaximumSize(
const QSize &);
295 void setMaximumSize(
int maxw,
int maxh);
296 void setMinimumWidth(
int minw);
297 void setMinimumHeight(
int minh);
298 void setMaximumWidth(
int maxw);
299 void setMaximumHeight(
int maxh);
305 QSize sizeIncrement()
const;
306 void setSizeIncrement(
const QSize &);
307 void setSizeIncrement(
int w,
int h);
308 QSize baseSize()
const;
309 void setBaseSize(
const QSize &);
310 void setBaseSize(
int basew,
int baseh);
312 void setFixedSize(
const QSize &);
313 void setFixedSize(
int w,
int h);
314 void setFixedWidth(
int w);
315 void setFixedHeight(
int h);
327 QWidget *nativeParentWidget()
const;
340 const QFont &font()
const;
341 void setFont(
const QFont &);
347 void setCursor(
const QCursor &);
351 void setMouseTracking(
bool enable);
352 bool hasMouseTracking()
const;
353 bool underMouse()
const;
362 RenderFlags renderFlags = RenderFlags(DrawWindowBackground | DrawChildren));
366 RenderFlags renderFlags = RenderFlags(DrawWindowBackground | DrawChildren));
368 #ifndef QT_NO_GRAPHICSEFFECT
371 #endif //QT_NO_GRAPHICSEFFECT
373 #ifndef QT_NO_GESTURES
379 void setWindowTitle(
const QString &);
380 #ifndef QT_NO_STYLE_STYLESHEET
381 void setStyleSheet(
const QString& styleSheet);
384 #ifndef QT_NO_STYLE_STYLESHEET
388 void setWindowIcon(
const QIcon &icon);
389 QIcon windowIcon()
const;
390 void setWindowIconText(
const QString &);
391 QString windowIconText()
const;
392 void setWindowRole(
const QString &);
394 void setWindowFilePath(
const QString &filePath);
395 QString windowFilePath()
const;
397 void setWindowOpacity(qreal
level);
398 qreal windowOpacity()
const;
400 bool isWindowModified()
const;
401 #ifndef QT_NO_TOOLTIP
402 void setToolTip(
const QString &);
405 #ifndef QT_NO_STATUSTIP
406 void setStatusTip(
const QString &);
409 #ifndef QT_NO_WHATSTHIS
410 void setWhatsThis(
const QString &);
413 #ifndef QT_NO_ACCESSIBILITY
414 QString accessibleName()
const;
416 QString accessibleDescription()
const;
417 void setAccessibleDescription(
const QString &description);
422 void unsetLayoutDirection();
424 void setLocale(
const QLocale &locale);
435 bool isActiveWindow()
const;
436 void activateWindow();
442 bool hasFocus()
const;
452 void grabMouse(
const QCursor &);
456 void releaseKeyboard();
457 #ifndef QT_NO_SHORTCUT
459 void releaseShortcut(
int id);
460 void setShortcutEnabled(
int id,
bool enable =
true);
461 void setShortcutAutoRepeat(
int id,
bool enable =
true);
463 static QWidget *mouseGrabber();
464 static QWidget *keyboardGrabber();
467 inline bool updatesEnabled()
const;
468 void setUpdatesEnabled(
bool enable);
471 void repaintUnclipped(
const QRegion &,
bool erase =
true);
474 #ifndef QT_NO_GRAPHICSVIEW
483 inline void update(
int x,
int y,
int w,
int h);
484 void update(
const QRect&);
487 void repaint(
int x,
int y,
int w,
int h);
488 void repaint(
const QRect &);
494 virtual void setVisible(
bool visible);
495 inline void setHidden(
bool hidden) { setVisible(!hidden); }
497 inline void show() { setVisible(
true); }
501 inline void hide() { setVisible(
false); }
502 inline QT_MOC_COMPAT
void setShown(
bool shown) { setVisible(shown); }
504 void showMinimized();
505 void showMaximized();
506 void showFullScreen();
515 void move(
int x,
int y);
516 void move(
const QPoint &);
517 void resize(
int w,
int h);
518 void resize(
const QSize &);
519 inline void setGeometry(
int x,
int y,
int w,
int h);
520 void setGeometry(
const QRect &);
522 bool restoreGeometry(
const QByteArray &geometry);
524 bool isVisible()
const;
525 bool isVisibleTo(
QWidget*)
const;
527 inline bool isHidden()
const;
529 bool isMinimized()
const;
530 bool isMaximized()
const;
531 bool isFullScreen()
const;
533 Qt::WindowStates windowState()
const;
534 void setWindowState(Qt::WindowStates state);
535 void overrideWindowState(Qt::WindowStates state);
537 virtual QSize sizeHint()
const;
538 virtual QSize minimumSizeHint()
const;
543 virtual int heightForWidth(
int)
const;
547 void setContentsMargins(
int left,
int top,
int right,
int bottom);
548 void setContentsMargins(
const QMargins &margins);
549 void getContentsMargins(
int *
left,
int *top,
int *
right,
int *bottom)
const;
552 QRect contentsRect()
const;
555 QLayout *layout()
const;
556 void setLayout(QLayout *);
557 void updateGeometry();
562 void scroll(
int dx,
int dy);
563 void scroll(
int dx,
int dy,
const QRect&);
568 QWidget *nextInFocusChain()
const;
569 QWidget *previousInFocusChain()
const;
572 bool acceptDrops()
const;
573 void setAcceptDrops(
bool on);
577 void addAction(QAction *action);
579 void insertAction(QAction *before, QAction *action);
581 void removeAction(QAction *action);
587 void setWindowFlags(Qt::WindowFlags type);
588 inline Qt::WindowFlags windowFlags()
const;
589 void overrideWindowFlags(Qt::WindowFlags type);
597 inline QWidget *childAt(
int x,
int y)
const;
600 #if defined(Q_WS_X11)
605 #if defined(Q_WS_MAC)
610 #if defined(Q_WS_WIN)
612 void releaseDC(HDC)
const;
622 void ensurePolished()
const;
627 bool isAncestorOf(
const QWidget *child)
const;
629 #ifdef QT_KEYPAD_NAVIGATION
630 bool hasEditFocus()
const;
631 void setEditFocus(
bool on);
634 bool autoFillBackground()
const;
635 void setAutoFillBackground(
bool enabled);
637 void setWindowSurface(QWindowSurface *surface);
638 QWindowSurface *windowSurface()
const;
640 #if defined(Q_WS_QPA)
647 friend class QDesktopScreenWidget;
651 void customContextMenuRequested(
const QPoint &pos);
656 virtual void mousePressEvent(QMouseEvent *);
657 virtual void mouseReleaseEvent(QMouseEvent *);
658 virtual void mouseDoubleClickEvent(QMouseEvent *);
659 virtual void mouseMoveEvent(QMouseEvent *);
660 #ifndef QT_NO_WHEELEVENT
661 virtual void wheelEvent(QWheelEvent *);
663 virtual void keyPressEvent(QKeyEvent *);
664 virtual void keyReleaseEvent(QKeyEvent *);
665 virtual void focusInEvent(QFocusEvent *);
666 virtual void focusOutEvent(QFocusEvent *);
667 virtual void enterEvent(
QEvent *);
668 virtual void leaveEvent(
QEvent *);
669 virtual void paintEvent(QPaintEvent *);
670 virtual void moveEvent(QMoveEvent *);
671 virtual void resizeEvent(QResizeEvent *);
672 virtual void closeEvent(QCloseEvent *);
673 #ifndef QT_NO_CONTEXTMENU
674 virtual void contextMenuEvent(QContextMenuEvent *);
676 #ifndef QT_NO_TABLETEVENT
677 virtual void tabletEvent(QTabletEvent *);
680 virtual void actionEvent(QActionEvent *);
683 #ifndef QT_NO_DRAGANDDROP
684 virtual void dragEnterEvent(QDragEnterEvent *);
685 virtual void dragMoveEvent(QDragMoveEvent *);
686 virtual void dragLeaveEvent(QDragLeaveEvent *);
687 virtual void dropEvent(QDropEvent *);
690 virtual void showEvent(QShowEvent *);
691 virtual void hideEvent(QHideEvent *);
693 #if defined(Q_WS_MAC)
696 #if defined(Q_WS_WIN)
697 virtual bool winEvent(
MSG *message,
long *result);
699 #if defined(Q_WS_X11)
700 virtual bool x11Event(
XEvent *);
702 #if defined(Q_WS_QWS)
707 virtual void changeEvent(
QEvent *);
709 int metric(PaintDeviceMetric)
const;
711 virtual void inputMethodEvent(QInputMethodEvent *);
715 Qt::InputMethodHints inputMethodHints()
const;
716 void setInputMethodHints(Qt::InputMethodHints hints);
719 void resetInputContext();
721 void updateMicroFocus();
724 void create(
WId = 0,
bool initializeWindow =
true,
725 bool destroyOldWindow =
true);
726 void destroy(
bool destroyWindow =
true,
727 bool destroySubWindows =
true);
729 virtual bool focusNextPrevChild(
bool next);
739 QLayout *takeLayout();
741 friend class QBackingStoreDevice;
742 friend class QWidgetBackingStore;
744 friend class QApplicationPrivate;
745 friend class QBaseApplication;
747 friend class QPainterPrivate;
751 friend class QETWidget;
752 friend class QLayout;
757 friend class QGLWindowSurface;
758 friend class QX11PaintEngine;
759 friend class QWin32PaintEngine;
760 friend class QShortcutPrivate;
761 friend class QShortcutMap;
762 friend class QWindowSurface;
764 friend class QGraphicsProxyWidgetPrivate;
765 friend class QStyleSheetStyle;
766 friend struct QWidgetExceptionCleaner;
767 #ifndef QT_NO_GESTURES
768 friend class QGestureManager;
769 friend class QWinNativePanGestureRecognizer;
770 #endif // QT_NO_GESTURES
771 friend class QWidgetEffectSourcePrivate;
774 friend class QCoreGraphicsPaintEnginePrivate;
777 friend bool qt_mac_is_metal(
const QWidget *
w);
779 friend void qt_event_request_window_change(
QWidget *widget);
781 friend class QRasterWindowSurface;
782 friend class QUnifiedToolbarSurface;
785 friend class QWSBackingStore;
787 friend class QWSManagerPrivate;
789 friend class QWSWindowSurface;
791 friend class QVNCScreen;
792 friend bool isWidgetOpaque(
const QWidget *);
793 friend class QGLWidgetPrivate;
796 friend class QSymbianControl;
797 friend class QS60WindowSurface;
800 friend void qt_net_update_user_time(
QWidget *tlw,
unsigned long timestamp);
801 friend void qt_net_remove_user_time(
QWidget *tlw);
806 friend Q_GUI_EXPORT QWidgetPrivate *qt_widget_private(
QWidget *widget);
819 inline QT3_SUPPORT
bool isUpdatesEnabled()
const {
return updatesEnabled(); }
820 QT3_SUPPORT QStyle *setStyle(
const QString&);
821 inline QT3_SUPPORT
bool isVisibleToTLW()
const;
822 QT3_SUPPORT
QRect visibleRect()
const;
823 inline QT3_SUPPORT
void iconify() { showMinimized(); }
824 inline QT3_SUPPORT
void constPolish()
const { ensurePolished(); }
825 inline QT3_SUPPORT
void polish() { ensurePolished(); }
826 inline QT3_SUPPORT
void reparent(
QWidget *parent, Qt::WindowFlags f,
const QPoint &
p,
bool showIt=
false)
828 inline QT3_SUPPORT
void reparent(
QWidget *parent,
const QPoint &p,
bool showIt=
false)
830 inline QT3_SUPPORT
void recreate(
QWidget *parent, Qt::WindowFlags f,
const QPoint & p,
bool showIt=
false)
833 {
QSizePolicy sp(hor, ver); sp.setHeightForWidth(hfw); setSizePolicy(sp);}
834 inline QT3_SUPPORT
bool hasMouse()
const {
return testAttribute(
Qt::WA_UnderMouse); }
836 inline QT3_SUPPORT
bool ownCursor()
const {
return testAttribute(
Qt::WA_SetCursor); }
838 inline QT3_SUPPORT
bool ownFont()
const {
return testAttribute(
Qt::WA_SetFont); }
839 inline QT3_SUPPORT
void unsetFont() { setFont(
QFont()); }
840 inline QT3_SUPPORT
bool ownPalette()
const {
return testAttribute(
Qt::WA_SetPalette); }
841 inline QT3_SUPPORT
void unsetPalette() { setPalette(
QPalette()); }
842 Qt::BackgroundMode QT3_SUPPORT backgroundMode()
const;
843 void QT3_SUPPORT setBackgroundMode(Qt::BackgroundMode, Qt::BackgroundMode = Qt::PaletteBackground);
844 const QT3_SUPPORT
QColor &eraseColor()
const;
845 void QT3_SUPPORT setEraseColor(
const QColor &);
846 const QT3_SUPPORT
QColor &foregroundColor()
const;
847 const QT3_SUPPORT
QPixmap *erasePixmap()
const;
848 void QT3_SUPPORT setErasePixmap(
const QPixmap &);
849 const QT3_SUPPORT
QColor &paletteForegroundColor()
const;
850 void QT3_SUPPORT setPaletteForegroundColor(
const QColor &);
851 const QT3_SUPPORT
QColor &paletteBackgroundColor()
const;
852 void QT3_SUPPORT setPaletteBackgroundColor(
const QColor &);
853 const QT3_SUPPORT
QPixmap *paletteBackgroundPixmap()
const;
854 void QT3_SUPPORT setPaletteBackgroundPixmap(
const QPixmap &);
855 const QT3_SUPPORT
QBrush& backgroundBrush()
const;
856 const QT3_SUPPORT
QColor &backgroundColor()
const;
857 const QT3_SUPPORT
QPixmap *backgroundPixmap()
const;
858 void QT3_SUPPORT setBackgroundPixmap(
const QPixmap &);
859 QT3_SUPPORT
void setBackgroundColor(
const QColor &);
860 QT3_SUPPORT QColorGroup colorGroup()
const;
861 QT3_SUPPORT
QWidget *parentWidget(
bool sameWindow)
const;
863 inline QT3_SUPPORT
void setFont(
const QFont &f,
bool) { setFont(f); }
864 inline QT3_SUPPORT
void setPalette(
const QPalette &p,
bool) { setPalette(p); }
865 enum BackgroundOrigin { WidgetOrigin, ParentOrigin, WindowOrigin, AncestorOrigin };
866 inline QT3_SUPPORT
void setBackgroundOrigin(BackgroundOrigin) {}
867 inline QT3_SUPPORT BackgroundOrigin backgroundOrigin()
const {
return WindowOrigin; }
868 inline QT3_SUPPORT
QPoint backgroundOffset()
const {
return QPoint(); }
869 inline QT3_SUPPORT
void repaint(
bool) { repaint(); }
870 inline QT3_SUPPORT
void repaint(
int x,
int y,
int w,
int h,
bool) { repaint(x,y,w,h); }
871 inline QT3_SUPPORT
void repaint(
const QRect &
r,
bool) { repaint(r); }
872 inline QT3_SUPPORT
void repaint(
const QRegion &rgn,
bool) { repaint(rgn); }
873 QT3_SUPPORT
void erase();
874 inline QT3_SUPPORT
void erase(
int x,
int y,
int w,
int h) { erase_helper(x, y, w, h); }
875 QT3_SUPPORT
void erase(
const QRect &);
876 QT3_SUPPORT
void erase(
const QRegion &);
878 { drawText_helper(p.
x(), p.
y(),
s); }
879 inline QT3_SUPPORT
void drawText(
int x,
int y,
const QString &s)
880 { drawText_helper(x, y, s); }
881 QT3_SUPPORT
bool close(
bool);
882 inline QT3_SUPPORT
QWidget *childAt(
int x,
int y,
bool includeThis)
const
885 return w ? w : ((includeThis && rect().contains(x,y))?const_cast<QWidget*>(
this):0);
887 inline QT3_SUPPORT
QWidget *childAt(
const QPoint &p,
bool includeThis)
const
890 return w ? w : ((includeThis && rect().contains(p))?const_cast<QWidget*>(
this):0);
892 inline QT3_SUPPORT
void setCaption(
const QString &
c) { setWindowTitle(c); }
893 QT3_SUPPORT
void setIcon(
const QPixmap &i);
894 inline QT3_SUPPORT
void setIconText(
const QString &it) { setWindowIconText(it); }
895 inline QT3_SUPPORT
QString caption()
const {
return windowTitle(); }
896 QT3_SUPPORT
const QPixmap *icon()
const;
897 inline QT3_SUPPORT
QString iconText()
const {
return windowIconText(); }
900 inline QT3_SUPPORT
void setActiveWindow() { activateWindow(); }
901 inline QT3_SUPPORT
bool isShown()
const {
return !isHidden(); }
902 inline QT3_SUPPORT
bool isDialog()
const {
return windowType() ==
Qt::Dialog; }
903 inline QT3_SUPPORT
bool isPopup()
const {
return windowType() ==
Qt::Popup; }
904 inline QT3_SUPPORT
bool isDesktop()
const {
return windowType() ==
Qt::Desktop; }
908 void drawText_helper(
int x,
int y,
const QString &);
909 void erase_helper(
int x,
int y,
int w,
int h);
910 #endif // QT3_SUPPORT
913 virtual void styleChange(QStyle&);
914 virtual void enabledChange(
bool);
915 virtual void paletteChange(
const QPalette &);
916 virtual void fontChange(
const QFont &);
917 virtual void windowActivationChange(
bool);
918 virtual void languageChange();
921 Q_DECLARE_OPERATORS_FOR_FLAGS(QWidget::RenderFlags)
925 if (!o || !o->isWidgetType())
return 0;
926 return static_cast<QWidget*
>(o);
930 if (!o || !o->isWidgetType())
return 0;
931 return static_cast<const QWidget*
>(o);
940 {
return data->window_flags; }
982 {
return data->fnt; }
1021 {
return QRect(0,0,data->crect.width(),data->crect.height()); }
1024 {
return data->crect; }
1027 {
return data->crect.size(); }
1030 {
return data->crect.width(); }
1033 {
return data->crect.height(); }
1043 if (attribute <
int(8*
sizeof(uint)))
1044 return data->widget_attributes & (1<<
attribute);
1045 return testAttribute_helper(attribute);
1049 inline bool QWidget::isVisibleToTLW()
const
1057 inline QColorGroup QWidget::colorGroup()
const
1058 {
return QColorGroup(
palette()); }
1059 inline void QWidget::setPaletteForegroundColor(
const QColor &
c)
1062 inline void QWidget::setBackgroundPixmap(
const QPixmap &pm)
1064 inline const QPixmap *QWidget::backgroundPixmap()
const {
return 0; }
1065 inline void QWidget::setBackgroundColor(
const QColor &c)
1070 inline void QWidget::setEraseColor(
const QColor &c)
1072 inline const QPixmap *QWidget::erasePixmap()
const {
return 0; }
1073 inline void QWidget::setErasePixmap(
const QPixmap &pm)
1077 inline void QWidget::setPaletteBackgroundColor(
const QColor &c)
1079 inline const QPixmap *QWidget::paletteBackgroundPixmap()
const
1081 inline void QWidget::setPaletteBackgroundPixmap(
const QPixmap &pm)
1083 inline QT3_SUPPORT
void QWidget::erase() { erase_helper(0, 0, data->crect.width(), data->crect.height()); }
1084 inline QT3_SUPPORT
void QWidget::erase(
const QRect &
r) { erase_helper(r.
x(), r.
y(), r.
width(), r.
height()); }
1087 #define QWIDGETSIZE_MAX ((1<<24)-1)
T qobject_cast(QObject *object)
GLuint GLuint GLsizei GLenum type
GLdouble GLdouble GLdouble r
unsigned int(APIENTRYP PFNGLXGETAGPOFFSETMESAPROC)(const void *pointer)
virtual QPaintEngine * paintEngine() const =0
void setBrush(ColorRole cr, const QBrush &brush)
void setColor(ColorGroup cg, ColorRole cr, const QColor &color)
#define Q_PRIVATE_SLOT(d, signature)
const QColor & color(ColorGroup cg, ColorRole cr) const
void setParent(QObject *)
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
virtual int devType() const
#define QT_BEGIN_NAMESPACE
const QBrush & brush(ColorGroup cg, ColorRole cr) const
GLsizei GLsizei GLenum GLenum const GLvoid * data
GLenum GLsizei GLenum format
GLenum GLsizei GLsizei height
struct OpaqueEventRef * EventRef
virtual bool event(QEvent *)
int int int int int int h
GLuint const GLchar * name
GLXFBConfig int attribute
struct OpaqueEventHandlerCallRef * EventHandlerCallRef
GLubyte GLubyte GLubyte GLubyte w
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
virtual int metric(PaintDeviceMetric metric) const