1 /****************************************************************************
2 **
3 ** DQt - D bindings for the Qt Toolkit
4 **
5 ** GNU Lesser General Public License Usage
6 ** This file may be used under the terms of the GNU Lesser
7 ** General Public License version 3 as published by the Free Software
8 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
9 ** packaging of this file. Please review the following information to
10 ** ensure the GNU Lesser General Public License version 3 requirements
11 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
12 **
13 ****************************************************************************/
14 module qt.widgets.widget;
15 extern(C++):
16 
17 import core.stdc.config;
18 import qt.config;
19 import qt.core.bytearray;
20 import qt.core.coreevent;
21 import qt.core.flags;
22 import qt.core.global;
23 import qt.core.list;
24 import qt.core.locale;
25 import qt.core.margins;
26 import qt.core.namespace;
27 import qt.core.object;
28 import qt.core.point;
29 import qt.core.rect;
30 import qt.core.size;
31 import qt.core.string;
32 import qt.core.variant;
33 import qt.gui.bitmap;
34 import qt.gui.event;
35 import qt.gui.font;
36 import qt.gui.fontinfo;
37 import qt.gui.fontmetrics;
38 import qt.gui.icon;
39 import qt.gui.paintdevice;
40 import qt.gui.paintengine;
41 import qt.gui.painter;
42 import qt.gui.palette;
43 import qt.gui.pixmap;
44 import qt.gui.region;
45 import qt.gui.screen;
46 import qt.gui.windowdefs;
47 import qt.helpers;
48 import qt.widgets.layout;
49 import qt.widgets.sizepolicy;
50 import qt.widgets.style;
51 version(QT_NO_ACTION){}else
52 {
53     import qt.widgets.action;
54     import qt.widgets.event;
55 }
56 version(QT_NO_CURSOR){}else
57     import qt.gui.cursor;
58 version(QT_NO_SHORTCUT){}else
59     import qt.gui.keysequence;
60 
61 
62 alias QWidgetList = QList!(QWidget);
63 /+ #ifdef QT_INCLUDE_COMPAT
64 #endif
65 
66 
67 
68 class QLayout; +/
69 extern(C++, class) struct QWSRegionManager;
70 /+ class QStyle;
71 class QVariant;
72 class QWindow;class QMouseEvent;
73 class QWheelEvent;
74 class QHoverEvent;
75 class QKeyEvent;
76 class QFocusEvent;
77 class QPaintEvent;
78 class QMoveEvent;
79 class QResizeEvent;
80 class QCloseEvent;
81 class QTabletEvent;
82 class QDragEnterEvent;
83 class QDragMoveEvent;
84 class QDragLeaveEvent;
85 class QDropEvent;
86 class QScreen;
87 class QShowEvent;
88 class QHideEvent;
89 class QIcon; +/
90 extern(C++, class) struct QBackingStore;
91 extern(C++, class) struct QPlatformWindow;
92 /+ class QLocale; +/
93 extern(C++, class) struct QGraphicsProxyWidget;
94 extern(C++, class) struct QGraphicsEffect;
95 extern(C++, class) struct QRasterWindowSurface;
96 extern(C++, class) struct QUnifiedToolbarSurface;
97 /+ class QPixmap;
98 #ifndef QT_NO_DEBUG_STREAM
99 class QDebug;
100 #endif +/
101 
102 extern(C++, class) struct QWidgetData
103 {
104 public:
105     WId winid;
106     uint widget_attributes;
107     /+ Qt:: +/qt.core.namespace.WindowFlags window_flags;
108     /+ uint window_state : 4; +/
109     uint bitfieldData_window_state;
110     final uint window_state() const
111     {
112         return (bitfieldData_window_state >> 0) & 0xf;
113     }
114     final uint window_state(uint value)
115     {
116         bitfieldData_window_state = (bitfieldData_window_state & ~0xf) | ((value & 0xf) << 0);
117         return value;
118     }
119     /+ uint focus_policy : 4; +/
120     final uint focus_policy() const
121     {
122         return (bitfieldData_window_state >> 4) & 0xf;
123     }
124     final uint focus_policy(uint value)
125     {
126         bitfieldData_window_state = (bitfieldData_window_state & ~0xf0) | ((value & 0xf) << 4);
127         return value;
128     }
129     /+ uint sizehint_forced :1; +/
130     final uint sizehint_forced() const
131     {
132         return (bitfieldData_window_state >> 8) & 0x1;
133     }
134     final uint sizehint_forced(uint value)
135     {
136         bitfieldData_window_state = (bitfieldData_window_state & ~0x100) | ((value & 0x1) << 8);
137         return value;
138     }
139     /+ uint is_closing :1; +/
140     final uint is_closing() const
141     {
142         return (bitfieldData_window_state >> 9) & 0x1;
143     }
144     final uint is_closing(uint value)
145     {
146         bitfieldData_window_state = (bitfieldData_window_state & ~0x200) | ((value & 0x1) << 9);
147         return value;
148     }
149     /+ uint in_show : 1; +/
150     final uint in_show() const
151     {
152         return (bitfieldData_window_state >> 10) & 0x1;
153     }
154     final uint in_show(uint value)
155     {
156         bitfieldData_window_state = (bitfieldData_window_state & ~0x400) | ((value & 0x1) << 10);
157         return value;
158     }
159     /+ uint in_set_window_state : 1; +/
160     final uint in_set_window_state() const
161     {
162         return (bitfieldData_window_state >> 11) & 0x1;
163     }
164     final uint in_set_window_state(uint value)
165     {
166         bitfieldData_window_state = (bitfieldData_window_state & ~0x800) | ((value & 0x1) << 11);
167         return value;
168     }
169     /+ mutable uint fstrut_dirty : 1; +/
170     final uint fstrut_dirty() const
171     {
172         return (bitfieldData_window_state >> 12) & 0x1;
173     }
174     final uint fstrut_dirty(uint value)
175     {
176         bitfieldData_window_state = (bitfieldData_window_state & ~0x1000) | ((value & 0x1) << 12);
177         return value;
178     }
179     /+ uint context_menu_policy : 3; +/
180     final uint context_menu_policy() const
181     {
182         return (bitfieldData_window_state >> 13) & 0x7;
183     }
184     final uint context_menu_policy(uint value)
185     {
186         bitfieldData_window_state = (bitfieldData_window_state & ~0xe000) | ((value & 0x7) << 13);
187         return value;
188     }
189     /+ uint window_modality : 2; +/
190     final uint window_modality() const
191     {
192         return (bitfieldData_window_state >> 16) & 0x3;
193     }
194     final uint window_modality(uint value)
195     {
196         bitfieldData_window_state = (bitfieldData_window_state & ~0x30000) | ((value & 0x3) << 16);
197         return value;
198     }
199     /+ uint in_destructor : 1; +/
200     final uint in_destructor() const
201     {
202         return (bitfieldData_window_state >> 18) & 0x1;
203     }
204     final uint in_destructor(uint value)
205     {
206         bitfieldData_window_state = (bitfieldData_window_state & ~0x40000) | ((value & 0x1) << 18);
207         return value;
208     }
209     /+ uint unused : 13; +/
210     final uint unused() const
211     {
212         return (bitfieldData_window_state >> 19) & 0x1fff;
213     }
214     final uint unused(uint value)
215     {
216         bitfieldData_window_state = (bitfieldData_window_state & ~0xfff80000) | ((value & 0x1fff) << 19);
217         return value;
218     }
219     QRect crect;
220     /+ mutable +/ QPalette pal;
221     QFont fnt;
222     QRect wrect;
223 }
224 
225 extern(C++, class) struct QWidgetPrivate;
226 
227 class /+ Q_WIDGETS_EXPORT +/ QWidget : QObject, QPaintDeviceInterface
228 {
229     import qt.core.namespace;
230     QPaintDeviceFakeInheritance baseQPaintDeviceInterface;
231 
232     mixin(Q_OBJECT);
233     /+ Q_DECLARE_PRIVATE(QWidget) +/
234 
235     /+ Q_PROPERTY(bool modal READ isModal)
236     Q_PROPERTY(Qt::WindowModality windowModality READ windowModality WRITE setWindowModality)
237     Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
238     Q_PROPERTY(QRect geometry READ geometry WRITE setGeometry)
239     Q_PROPERTY(QRect frameGeometry READ frameGeometry)
240     Q_PROPERTY(QRect normalGeometry READ normalGeometry)
241     Q_PROPERTY(int x READ x)
242     Q_PROPERTY(int y READ y)
243     Q_PROPERTY(QPoint pos READ pos WRITE move DESIGNABLE false STORED false)
244     Q_PROPERTY(QSize frameSize READ frameSize)
245     Q_PROPERTY(QSize size READ size WRITE resize DESIGNABLE false STORED false)
246     Q_PROPERTY(int width READ width)
247     Q_PROPERTY(int height READ height)
248     Q_PROPERTY(QRect rect READ rect)
249     Q_PROPERTY(QRect childrenRect READ childrenRect)
250     Q_PROPERTY(QRegion childrenRegion READ childrenRegion)
251     Q_PROPERTY(QSizePolicy sizePolicy READ sizePolicy WRITE setSizePolicy)
252     Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize)
253     Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize)
254     Q_PROPERTY(int minimumWidth READ minimumWidth WRITE setMinimumWidth STORED false DESIGNABLE false)
255     Q_PROPERTY(int minimumHeight READ minimumHeight WRITE setMinimumHeight STORED false DESIGNABLE false)
256     Q_PROPERTY(int maximumWidth READ maximumWidth WRITE setMaximumWidth STORED false DESIGNABLE false)
257     Q_PROPERTY(int maximumHeight READ maximumHeight WRITE setMaximumHeight STORED false DESIGNABLE false)
258     Q_PROPERTY(QSize sizeIncrement READ sizeIncrement WRITE setSizeIncrement)
259     Q_PROPERTY(QSize baseSize READ baseSize WRITE setBaseSize)
260     Q_PROPERTY(QPalette palette READ palette WRITE setPalette)
261     Q_PROPERTY(QFont font READ font WRITE setFont)
262 #ifndef QT_NO_CURSOR
263     Q_PROPERTY(QCursor cursor READ cursor WRITE setCursor RESET unsetCursor)
264 #endif
265     Q_PROPERTY(bool mouseTracking READ hasMouseTracking WRITE setMouseTracking)
266     Q_PROPERTY(bool tabletTracking READ hasTabletTracking WRITE setTabletTracking)
267     Q_PROPERTY(bool isActiveWindow READ isActiveWindow)
268     Q_PROPERTY(Qt::FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy)
269     Q_PROPERTY(bool focus READ hasFocus)
270     Q_PROPERTY(Qt::ContextMenuPolicy contextMenuPolicy READ contextMenuPolicy WRITE setContextMenuPolicy)
271     Q_PROPERTY(bool updatesEnabled READ updatesEnabled WRITE setUpdatesEnabled DESIGNABLE false)
272     Q_PROPERTY(bool visible READ isVisible WRITE setVisible DESIGNABLE false)
273     Q_PROPERTY(bool minimized READ isMinimized)
274     Q_PROPERTY(bool maximized READ isMaximized)
275     Q_PROPERTY(bool fullScreen READ isFullScreen)
276     Q_PROPERTY(QSize sizeHint READ sizeHint)
277     Q_PROPERTY(QSize minimumSizeHint READ minimumSizeHint)
278     Q_PROPERTY(bool acceptDrops READ acceptDrops WRITE setAcceptDrops)
279     Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle NOTIFY windowTitleChanged)
280     Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon NOTIFY windowIconChanged)
281     Q_PROPERTY(QString windowIconText READ windowIconText WRITE setWindowIconText NOTIFY windowIconTextChanged) // deprecated
282     Q_PROPERTY(double windowOpacity READ windowOpacity WRITE setWindowOpacity)
283     Q_PROPERTY(bool windowModified READ isWindowModified WRITE setWindowModified)
284 #ifndef QT_NO_TOOLTIP
285     Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip)
286     Q_PROPERTY(int toolTipDuration READ toolTipDuration WRITE setToolTipDuration)
287 #endif
288 #if QT_CONFIG(statustip)
289     Q_PROPERTY(QString statusTip READ statusTip WRITE setStatusTip)
290 #endif
291 #if QT_CONFIG(whatsthis)
292     Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis)
293 #endif
294 #ifndef QT_NO_ACCESSIBILITY
295     Q_PROPERTY(QString accessibleName READ accessibleName WRITE setAccessibleName)
296     Q_PROPERTY(QString accessibleDescription READ accessibleDescription WRITE setAccessibleDescription)
297 #endif
298     Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection RESET unsetLayoutDirection)
299     QDOC_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags)
300     Q_PROPERTY(bool autoFillBackground READ autoFillBackground WRITE setAutoFillBackground)
301 #ifndef QT_NO_STYLE_STYLESHEET
302     Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet)
303 #endif
304     Q_PROPERTY(QLocale locale READ locale WRITE setLocale RESET unsetLocale)
305     Q_PROPERTY(QString windowFilePath READ windowFilePath WRITE setWindowFilePath)
306     Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints) +/
307 
308 public:
309     enum RenderFlag {
310         DrawWindowBackground = 0x1,
311         DrawChildren = 0x2,
312         IgnoreMask = 0x4
313     }
314     /+ Q_DECLARE_FLAGS(RenderFlags, RenderFlag) +/
315 alias RenderFlags = QFlags!(RenderFlag);
316     /+ explicit +/this(QWidget parent = null, /+ Qt:: +/qt.core.namespace.WindowFlags f = /+ Qt:: +/qt.core.namespace.WindowFlags());
317     ~this();
318 
319     override int devType() const;
320 
321     final WId winId() const;
322     final void createWinId(); // internal, going away
323     pragma(inline, true) final WId internalWinId() const { return data.winid; }
324     final WId effectiveWinId() const;
325 
326     // GUI style setting
327     final QStyle style() const;
328     final void setStyle(QStyle );
329     // Widget types and states
330 
331     pragma(inline, true) final bool isTopLevel() const
332     { return (cast(bool)(windowType() & /+ Qt:: +/qt.core.namespace.WindowType.Window)); }
333     pragma(inline, true) final bool isWindow() const
334     { return (cast(bool)(windowType() & /+ Qt:: +/qt.core.namespace.WindowType.Window)); }
335 
336     pragma(inline, true) final bool isModal() const
337     { return data.window_modality != /+ Qt:: +/qt.core.namespace.WindowModality.NonModal; }
338     final /+ Qt:: +/qt.core.namespace.WindowModality windowModality() const;
339     final void setWindowModality(/+ Qt:: +/qt.core.namespace.WindowModality windowModality);
340 
341     pragma(inline, true) final bool isEnabled() const
342     { return !testAttribute(/+ Qt:: +/qt.core.namespace.WidgetAttribute.WA_Disabled); }
343     final bool isEnabledTo(const(QWidget) ) const;
344 /+ #if QT_DEPRECATED_SINCE(5, 13) +/
345     /+ QT_DEPRECATED_X ("Use isEnabled() instead") +/
346         pragma(inline, true) final bool isEnabledToTLW() const
347     { return isEnabled(); }
348 /+ #endif +/
349 
350 public /+ Q_SLOTS +/:
351     @QSlot final void setEnabled(bool);
352     @QSlot final void setDisabled(bool);
353     @QSlot final void setWindowModified(bool);
354 
355     // Widget coordinates
356 
357 public:
358     final QRect frameGeometry() const;
359     pragma(inline, true) final ref const(QRect) geometry() const
360     { return data.crect; }
361     final QRect normalGeometry() const;
362 
363     final int x() const;
364     final int y() const;
365     final QPoint pos() const;
366     final QSize frameSize() const;
367     pragma(inline, true) final QSize size() const
368     { return data.crect.size(); }
369     pragma(inline, true) final int width() const
370     { return data.crect.width(); }
371     pragma(inline, true) final int height() const
372     { return data.crect.height(); }
373     pragma(inline, true) final QRect rect() const
374     { return QRect(0,0,data.crect.width(),data.crect.height()); }
375     final QRect childrenRect() const;
376     final QRegion childrenRegion() const;
377 
378     final QSize minimumSize() const;
379     final QSize maximumSize() const;
380     pragma(inline, true) final int minimumWidth() const
381     { return minimumSize().width(); }
382     pragma(inline, true) final int minimumHeight() const
383     { return minimumSize().height(); }
384     pragma(inline, true) final int maximumWidth() const
385     { return maximumSize().width(); }
386     pragma(inline, true) final int maximumHeight() const
387     { return maximumSize().height(); }
388     pragma(inline, true) final void setMinimumSize(ref const(QSize) s)
389     { setMinimumSize(s.width(),s.height()); }
390     final void setMinimumSize(int minw, int minh);
391     pragma(inline, true) final void setMaximumSize(ref const(QSize) s)
392     { setMaximumSize(s.width(),s.height()); }
393     final void setMaximumSize(int maxw, int maxh);
394     final void setMinimumWidth(int minw);
395     final void setMinimumHeight(int minh);
396     final void setMaximumWidth(int maxw);
397     final void setMaximumHeight(int maxh);
398 
399 /+ #ifdef Q_QDOC
400     void setupUi(QWidget *widget);
401 #endif +/
402 
403     final QSize sizeIncrement() const;
404     pragma(inline, true) final void setSizeIncrement(ref const(QSize) s)
405     { setSizeIncrement(s.width(),s.height()); }
406     final void setSizeIncrement(int w, int h);
407     final QSize baseSize() const;
408     pragma(inline, true) final void setBaseSize(ref const(QSize) s)
409     { setBaseSize(s.width(),s.height()); }
410     final void setBaseSize(int basew, int baseh);
411 
412     final void setFixedSize(ref const(QSize) );
413     final void setFixedSize(int w, int h);
414     final void setFixedWidth(int w);
415     final void setFixedHeight(int h);
416 
417     // Widget coordinate mapping
418 
419     final QPoint mapToGlobal(ref const(QPoint) ) const;
420     final QPoint mapFromGlobal(ref const(QPoint) ) const;
421     final QPoint mapToParent(ref const(QPoint) ) const;
422     final QPoint mapFromParent(ref const(QPoint) ) const;
423     final QPoint mapTo(const(QWidget) , ref const(QPoint) ) const;
424     final QPoint mapFrom(const(QWidget) , ref const(QPoint) ) const;
425 
426     final QWidget window() const;
427     final QWidget nativeParentWidget() const;
428     pragma(inline, true) final QWidget topLevelWidget() const { return window(); }
429 
430     // Widget appearance functions
431     final ref const(QPalette) palette() const;
432     final void setPalette(ref const(QPalette) );
433 
434     final void setBackgroundRole(QPalette.ColorRole);
435     final QPalette.ColorRole backgroundRole() const;
436 
437     final void setForegroundRole(QPalette.ColorRole);
438     final QPalette.ColorRole foregroundRole() const;
439 
440     pragma(inline, true) final ref const(QFont) font() const
441     { return data.fnt; }
442     final void setFont(ref const(QFont) );
443     pragma(inline, true) final QFontMetrics fontMetrics() const
444     { auto tmp = data.fnt; return QFontMetrics(tmp); }
445     pragma(inline, true) final QFontInfo fontInfo() const
446     { auto tmp = data.fnt; return QFontInfo(tmp); }
447 
448     version(QT_NO_CURSOR){}else
449     {
450         final QCursor cursor() const;
451         final void setCursor(ref const(QCursor) );
452         final void unsetCursor();
453     }
454 
455     pragma(inline, true) final void setMouseTracking(bool enable)
456     { setAttribute(/+ Qt:: +/qt.core.namespace.WidgetAttribute.WA_MouseTracking, enable); }
457     pragma(inline, true) final bool hasMouseTracking() const
458     { return testAttribute(/+ Qt:: +/qt.core.namespace.WidgetAttribute.WA_MouseTracking); }
459     pragma(inline, true) final bool underMouse() const
460     { return testAttribute(/+ Qt:: +/qt.core.namespace.WidgetAttribute.WA_UnderMouse); }
461 
462     pragma(inline, true) final void setTabletTracking(bool enable)
463     { setAttribute(/+ Qt:: +/qt.core.namespace.WidgetAttribute.WA_TabletTracking, enable); }
464     pragma(inline, true) final bool hasTabletTracking() const
465     { return testAttribute(/+ Qt:: +/qt.core.namespace.WidgetAttribute.WA_TabletTracking); }
466 
467     final void setMask(ref const(QBitmap) );
468     final void setMask(ref const(QRegion) );
469     final QRegion mask() const;
470     final void clearMask();
471 
472     final void render(QPaintDevice target, ref const(QPoint) targetOffset = globalInitVar!QPoint,
473                     ref const(QRegion) sourceRegion = globalInitVar!QRegion,
474                     RenderFlags renderFlags = RenderFlags(RenderFlag.DrawWindowBackground | RenderFlag.DrawChildren));
475 
476     final void render(QPainter* painter, ref const(QPoint) targetOffset = globalInitVar!QPoint,
477                     ref const(QRegion) sourceRegion = globalInitVar!QRegion,
478                     RenderFlags renderFlags = RenderFlags(RenderFlag.DrawWindowBackground | RenderFlag.DrawChildren));
479 
480     @QInvokable final QPixmap grab(ref const(QRect) rectangle /+ = QRect(QPoint(0, 0), QSize(-1, -1)) +/);
481 
482 /+ #if QT_CONFIG(graphicseffect) +/
483     final QGraphicsEffect* graphicsEffect() const;
484     final void setGraphicsEffect(QGraphicsEffect* effect);
485 /+ #endif // QT_CONFIG(graphicseffect)
486 
487 #ifndef QT_NO_GESTURES +/
488     version(QT_NO_GESTURES){}else
489     {
490         final void grabGesture(/+ Qt:: +/qt.core.namespace.GestureType type, /+ Qt:: +/qt.core.namespace.GestureFlags flags = /+ Qt:: +/qt.core.namespace.GestureFlags());
491         final void ungrabGesture(/+ Qt:: +/qt.core.namespace.GestureType type);
492     }
493 /+ #endif +/
494 
495 public /+ Q_SLOTS +/:
496     @QSlot final void setWindowTitle(ref const(QString) );
497     final void setWindowTitle(const QString s){setWindowTitle(s);}
498     version(QT_NO_STYLE_STYLESHEET){}else
499     {
500         @QSlot final void setStyleSheet(ref const(QString) styleSheet);
501     }
502 public:
503     version(QT_NO_STYLE_STYLESHEET){}else
504     {
505         final QString styleSheet() const;
506     }
507     final QString windowTitle() const;
508     final void setWindowIcon(ref const(QIcon) icon);
509     final QIcon windowIcon() const;
510     final void setWindowIconText(ref const(QString) );
511     final QString windowIconText() const;
512     final void setWindowRole(ref const(QString) );
513     final QString windowRole() const;
514     final void setWindowFilePath(ref const(QString) filePath);
515     final QString windowFilePath() const;
516 
517     final void setWindowOpacity(qreal level);
518     final qreal windowOpacity() const;
519 
520     final bool isWindowModified() const;
521 /+ #ifndef QT_NO_TOOLTIP +/
522     version(QT_NO_TOOLTIP){}else
523     {
524         final void setToolTip(ref const(QString) );
525         final QString toolTip() const;
526         final void setToolTipDuration(int msec);
527         final int toolTipDuration() const;
528     }
529 /+ #endif
530 #if QT_CONFIG(statustip) +/
531     final void setStatusTip(ref const(QString) );
532     final QString statusTip() const;
533 /+ #endif
534 #if QT_CONFIG(whatsthis) +/
535     final void setWhatsThis(ref const(QString) );
536     final QString whatsThis() const;
537 /+ #endif
538 #ifndef QT_NO_ACCESSIBILITY +/
539     version(QT_NO_ACCESSIBILITY){}else
540     {
541         final QString accessibleName() const;
542         final void setAccessibleName(ref const(QString) name);
543         final QString accessibleDescription() const;
544         final void setAccessibleDescription(ref const(QString) description);
545     }
546 /+ #endif +/
547 
548     final void setLayoutDirection(/+ Qt:: +/qt.core.namespace.LayoutDirection direction);
549     final /+ Qt:: +/qt.core.namespace.LayoutDirection layoutDirection() const;
550     final void unsetLayoutDirection();
551 
552     final void setLocale(ref const(QLocale) locale);
553     final QLocale locale() const;
554     final void unsetLocale();
555 
556     pragma(inline, true) final bool isRightToLeft() const { return layoutDirection() == /+ Qt:: +/qt.core.namespace.LayoutDirection.RightToLeft; }
557     pragma(inline, true) final bool isLeftToRight() const { return layoutDirection() == /+ Qt:: +/qt.core.namespace.LayoutDirection.LeftToRight; }
558 
559 public /+ Q_SLOTS +/:
560     pragma(inline, true) @QSlot final void setFocus() { setFocus(/+ Qt:: +/qt.core.namespace.FocusReason.OtherFocusReason); }
561 
562 public:
563     final bool isActiveWindow() const;
564     final void activateWindow();
565     final void clearFocus();
566 
567     final void setFocus(/+ Qt:: +/qt.core.namespace.FocusReason reason);
568     final /+ Qt:: +/qt.core.namespace.FocusPolicy focusPolicy() const;
569     final void setFocusPolicy(/+ Qt:: +/qt.core.namespace.FocusPolicy policy);
570     final bool hasFocus() const;
571     static void setTabOrder(QWidget , QWidget );
572     final void setFocusProxy(QWidget );
573     final QWidget focusProxy() const;
574     final /+ Qt:: +/qt.core.namespace.ContextMenuPolicy contextMenuPolicy() const;
575     final void setContextMenuPolicy(/+ Qt:: +/qt.core.namespace.ContextMenuPolicy policy);
576 
577     // Grab functions
578     final void grabMouse();
579     version(QT_NO_CURSOR){}else
580     {
581         final void grabMouse(ref const(QCursor) );
582     }
583     final void releaseMouse();
584     final void grabKeyboard();
585     final void releaseKeyboard();
586     version(QT_NO_SHORTCUT){}else
587     {
588         final int grabShortcut(ref const(QKeySequence) key, /+ Qt:: +/qt.core.namespace.ShortcutContext context = /+ Qt:: +/qt.core.namespace.ShortcutContext.WindowShortcut);
589         final void releaseShortcut(int id);
590         final void setShortcutEnabled(int id, bool enable = true);
591         final void setShortcutAutoRepeat(int id, bool enable = true);
592     }
593     static QWidget mouseGrabber();
594     static QWidget keyboardGrabber();
595 
596     // Update/refresh functions
597     pragma(inline, true) final bool updatesEnabled() const
598     { return !testAttribute(/+ Qt:: +/qt.core.namespace.WidgetAttribute.WA_UpdatesDisabled); }
599     final void setUpdatesEnabled(bool enable);
600 
601 /+ #if QT_CONFIG(graphicsview) +/
602     final QGraphicsProxyWidget* graphicsProxyWidget() const;
603 /+ #endif +/
604 
605 public /+ Q_SLOTS +/:
606     @QSlot final void update();
607     @QSlot final void repaint();
608 
609 public:
610     pragma(inline, true) final void update(int ax, int ay, int aw, int ah)
611     { auto tmp = QRect(ax, ay, aw, ah); update(tmp); }
612     final void update(ref const(QRect));
613     final void update(ref const(QRegion));
614 
615     final void repaint(int x, int y, int w, int h);
616     final void repaint(ref const(QRect) );
617     final void repaint(ref const(QRegion) );
618 
619 public /+ Q_SLOTS +/:
620     // Widget management functions
621 
622     /+ virtual +/ @QSlot void setVisible(bool visible);
623     @QSlot final void setHidden(bool hidden);
624     @QSlot final void show();
625     @QSlot final void hide();
626 
627     @QSlot final void showMinimized();
628     @QSlot final void showMaximized();
629     @QSlot final void showFullScreen();
630     @QSlot final void showNormal();
631 
632     @QSlot final bool close();
633     @QSlot final void raise();
634     @QSlot final void lower();
635 
636 public:
637     final void stackUnder(QWidget);
638     pragma(inline, true) final void move(int ax, int ay)
639     { auto tmp = QPoint(ax, ay); move(tmp); }
640     final void move(ref const(QPoint) );
641     final void move(const(QPoint) p)
642     {
643         move(p);
644     }
645 
646     pragma(inline, true) final void resize(int w, int h)
647     { auto tmp = QSize(w, h); resize(tmp); }
648     final void resize(ref const(QSize) );
649     pragma(inline, true) final void setGeometry(int ax, int ay, int aw, int ah)
650     { auto tmp = QRect(ax, ay, aw, ah); setGeometry(tmp); }
651     final void setGeometry(ref const(QRect) );
652     final QByteArray saveGeometry() const;
653     final bool restoreGeometry(ref const(QByteArray) geometry);
654     final void adjustSize();
655     pragma(inline, true) final bool isVisible() const
656     { return testAttribute(/+ Qt:: +/qt.core.namespace.WidgetAttribute.WA_WState_Visible); }
657     final bool isVisibleTo(const(QWidget) ) const;
658     pragma(inline, true) final bool isHidden() const
659     { return testAttribute(/+ Qt:: +/qt.core.namespace.WidgetAttribute.WA_WState_Hidden); }
660 
661     final bool isMinimized() const;
662     final bool isMaximized() const;
663     final bool isFullScreen() const;
664 
665     final /+ Qt:: +/qt.core.namespace.WindowStates windowState() const;
666     final void setWindowState(/+ Qt:: +/qt.core.namespace.WindowStates state);
667     final void overrideWindowState(/+ Qt:: +/qt.core.namespace.WindowStates state);
668 
669     /+ virtual +/ QSize sizeHint() const;
670     /+ virtual +/ QSize minimumSizeHint() const;
671 
672     final QSizePolicy sizePolicy() const;
673     final void setSizePolicy(QSizePolicy);
674 /+    pragma(inline, true) final void setSizePolicy(QSizePolicy.Policy hor, QSizePolicy.Policy ver)
675     { setSizePolicy(QSizePolicy(hor, ver)); }
676 +/
677     /+ virtual +/ int heightForWidth(int) const;
678     /+ virtual +/ bool hasHeightForWidth() const;
679 
680     final QRegion visibleRegion() const;
681 
682     final void setContentsMargins(int left, int top, int right, int bottom);
683     final void setContentsMargins(ref const(QMargins) margins);
684 /+ #if QT_DEPRECATED_SINCE(5, 14) +/
685     /+ QT_DEPRECATED_X("use contentsMargins()") +/
686         final void getContentsMargins(int* left, int* top, int* right, int* bottom) const;
687 /+ #endif +/
688     final QMargins contentsMargins() const;
689 
690     final QRect contentsRect() const;
691 
692 public:
693     final QLayout layout() const;
694     final void setLayout(QLayout );
695     final void updateGeometry();
696 
697     final void setParent(QWidget parent);
698     final void setParent(QWidget parent, /+ Qt:: +/qt.core.namespace.WindowFlags f);
699 
700     final void scroll(int dx, int dy);
701     final void scroll(int dx, int dy, ref const(QRect));
702 
703     // Misc. functions
704 
705     final QWidget focusWidget() const;
706     final QWidget nextInFocusChain() const;
707     final QWidget previousInFocusChain() const;
708 
709     // drag and drop
710     final bool acceptDrops() const;
711     final void setAcceptDrops(bool on);
712 
713     version(QT_NO_ACTION){}else
714     {
715         //actions
716         final void addAction(QAction action);
717     /+ #if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
718         void addActions(const QList<QAction*> &actions);
719         void insertActions(QAction *before, const QList<QAction*> &actions);
720     #else +/
721         final void addActions(QList!(QAction) actions);
722         final void insertActions(QAction before, QList!(QAction) actions);
723     /+ #endif +/
724         final void insertAction(QAction before, QAction action);
725         final void removeAction(QAction action);
726         final QList!(QAction) actions() const;
727     }
728 
729     pragma(inline, true) final QWidget parentWidget() const
730     { return static_cast!(QWidget)(QObject.parent()); }
731 
732     final void setWindowFlags(/+ Qt:: +/qt.core.namespace.WindowFlags type);
733     pragma(inline, true) final /+ Qt:: +/qt.core.namespace.WindowFlags windowFlags() const
734     { return data.window_flags; }
735     final void setWindowFlag(/+ Qt:: +/qt.core.namespace.WindowType, bool on = true);
736     final void overrideWindowFlags(/+ Qt:: +/qt.core.namespace.WindowFlags type);
737 
738     pragma(inline, true) final /+ Qt:: +/qt.core.namespace.WindowType windowType() const
739     { return static_cast!(/+ Qt:: +/qt.core.namespace.WindowType)(int((data.window_flags & /+ Qt:: +/qt.core.namespace.WindowType.WindowType_Mask))); }
740 
741     /+ static QWidget *find(WId); +/
742     pragma(inline, true) final QWidget childAt(int ax, int ay) const
743     { auto tmp = QPoint(ax, ay); return childAt(tmp); }
744     final QWidget childAt(ref const(QPoint) p) const;
745 
746     final void setAttribute(/+ Qt:: +/qt.core.namespace.WidgetAttribute, bool on = true);
747     pragma(inline, true) final bool testAttribute(/+ Qt:: +/qt.core.namespace.WidgetAttribute attribute) const
748     {
749         if (attribute < cast(int)(8*uint.sizeof))
750             return (data.widget_attributes & (1<<attribute)) != 0;
751         return testAttribute_helper(attribute);
752     }
753 
754     override QPaintEngine paintEngine() const;
755 
756     final void ensurePolished() const;
757 
758     final bool isAncestorOf(const(QWidget) child) const;
759 
760     version(QT_KEYPAD_NAVIGATION)
761     {
762         final bool hasEditFocus() const;
763         final void setEditFocus(bool on);
764     }
765 
766     final bool autoFillBackground() const;
767     final void setAutoFillBackground(bool enabled);
768 
769     final QBackingStore* backingStore() const;
770 
771     final QWindow* windowHandle() const;
772     final QScreen screen() const;
773 
774     static QWidget createWindowContainer(QWindow* window, QWidget parent=null, /+ Qt:: +/qt.core.namespace.WindowFlags flags=/+ Qt:: +/qt.core.namespace.WindowFlags());
775 
776     /+ friend class QDesktopScreenWidget; +/
777 
778 /+ Q_SIGNALS +/public:
779     @QSignal final void windowTitleChanged(ref const(QString) title);
780     @QSignal final void windowIconChanged(ref const(QIcon) icon);
781     @QSignal final void windowIconTextChanged(ref const(QString) iconText);
782     @QSignal final void customContextMenuRequested(ref const(QPoint) pos);
783 
784 protected:
785     // Event handlers
786     override bool event(QEvent event);
787     /+ virtual +/ void mousePressEvent(QMouseEvent event);
788     /+ virtual +/ void mouseReleaseEvent(QMouseEvent event);
789     /+ virtual +/ void mouseDoubleClickEvent(QMouseEvent event);
790     /+ virtual +/ void mouseMoveEvent(QMouseEvent event);
791 /+ #if QT_CONFIG(wheelevent) +/
792     /+ virtual +/ void wheelEvent(QWheelEvent event);
793 /+ #endif +/
794     /+ virtual +/ void keyPressEvent(QKeyEvent event);
795     /+ virtual +/ void keyReleaseEvent(QKeyEvent event);
796     /+ virtual +/ void focusInEvent(QFocusEvent event);
797     /+ virtual +/ void focusOutEvent(QFocusEvent event);
798     /+ virtual +/ void enterEvent(QEvent event);
799     /+ virtual +/ void leaveEvent(QEvent event);
800     /+ virtual +/ void paintEvent(QPaintEvent event);
801     /+ virtual +/ void moveEvent(QMoveEvent event);
802     /+ virtual +/ void resizeEvent(QResizeEvent event);
803     /+ virtual +/ void closeEvent(QCloseEvent event);
804 /+ #ifndef QT_NO_CONTEXTMENU +/
805     version(QT_NO_CONTEXTMENU){}else
806     {
807         /+ virtual +/ void contextMenuEvent(QContextMenuEvent event);
808     }
809 /+ #endif
810 #if QT_CONFIG(tabletevent) +/
811     /+ virtual +/ void tabletEvent(QTabletEvent event);
812 /+ #endif
813 #ifndef QT_NO_ACTION +/
814     version(QT_NO_ACTION){}else
815     {
816         /+ virtual +/ void actionEvent(QActionEvent event);
817     }
818 /+ #endif
819 
820 #if QT_CONFIG(draganddrop) +/
821     /+ virtual +/ void dragEnterEvent(QDragEnterEvent event);
822     /+ virtual +/ void dragMoveEvent(QDragMoveEvent event);
823     /+ virtual +/ void dragLeaveEvent(QDragLeaveEvent event);
824     /+ virtual +/ void dropEvent(QDropEvent event);
825 /+ #endif +/
826 
827     /+ virtual +/ void showEvent(QShowEvent event);
828     /+ virtual +/ void hideEvent(QHideEvent event);
829 
830 /+ #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
831     virtual bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result);
832 #else +/
833     /+ virtual +/ bool nativeEvent(ref const(QByteArray) eventType, void* message, cpp_long* result);
834 /+ #endif +/
835 
836     // Misc. protected functions
837     /+ virtual +/ void changeEvent(QEvent );
838 
839     override int metric(PaintDeviceMetric) const;
840     override void initPainter(QPainter* painter) const;
841     override QPaintDevice redirected(QPoint* offset) const;
842     override QPainter* sharedPainter() const;
843 
844     /+ virtual +/ void inputMethodEvent(QInputMethodEvent );
845 public:
846     /+ virtual +/ QVariant inputMethodQuery(/+ Qt:: +/qt.core.namespace.InputMethodQuery) const;
847 
848     final /+ Qt:: +/qt.core.namespace.InputMethodHints inputMethodHints() const;
849     final void setInputMethodHints(/+ Qt:: +/qt.core.namespace.InputMethodHints hints);
850 
851 protected /+ Q_SLOTS +/:
852     @QSlot final void updateMicroFocus();
853 protected:
854 
855     /+ void create(WId = 0, bool initializeWindow = true,
856                          bool destroyOldWindow = true); +/
857     final void destroy(bool destroyWindow = true,
858                      bool destroySubWindows = true);
859 
860     /+ friend class QDataWidgetMapperPrivate; +/ // for access to focusNextPrevChild
861     /+ virtual +/ bool focusNextPrevChild(bool next);
862     pragma(inline, true) final bool focusNextChild() { return focusNextPrevChild(true); }
863     pragma(inline, true) final bool focusPreviousChild() { return focusNextPrevChild(false); }
864 
865 protected:
866     this(ref QWidgetPrivate d, QWidget parent, /+ Qt:: +/qt.core.namespace.WindowFlags f);
867 private:
868     final void setBackingStore(QBackingStore* store);
869 
870     final bool testAttribute_helper(/+ Qt:: +/qt.core.namespace.WidgetAttribute) const;
871 
872     final QLayout takeLayout();
873 
874     /+ friend class QBackingStoreDevice; +/
875     /+ friend class QWidgetRepaintManager; +/
876     /+ friend class QApplication; +/
877     /+ friend class QApplicationPrivate; +/
878     /+ friend class QGuiApplication; +/
879     /+ friend class QGuiApplicationPrivate; +/
880     /+ friend class QBaseApplication; +/
881     /+ friend class QPainter; +/
882     /+ friend class QPainterPrivate; +/
883     /+ friend class QPixmap; +/ // for QPixmap::fill()
884     /+ friend class QFontMetrics; +/
885     /+ friend class QFontInfo; +/
886     /+ friend class QLayout; +/
887     /+ friend class QWidgetItem; +/
888     /+ friend class QWidgetItemV2; +/
889     /+ friend class QGLContext; +/
890     /+ friend class QGLWidget; +/
891     /+ friend class QGLWindowSurface; +/
892     /+ friend class QX11PaintEngine; +/
893     /+ friend class QWin32PaintEngine; +/
894     /+ friend class QShortcutPrivate; +/
895     /+ friend class QWindowSurface; +/
896     /+ friend class QGraphicsProxyWidget; +/
897     /+ friend class QGraphicsProxyWidgetPrivate; +/
898     /+ friend class QStyleSheetStyle; +/
899     /+ friend struct QWidgetExceptionCleaner; +/
900     /+ friend class QWidgetWindow; +/
901     /+ friend class QAccessibleWidget; +/
902     /+ friend class QAccessibleTable; +/
903     /+ friend class QAccessibleTabButton; +/
904     version(QT_NO_GESTURES){}else
905     {
906         /+ friend class QGestureManager; +/
907         /+ friend class QWinNativePanGestureRecognizer; +/
908     }
909     /+ friend class QWidgetEffectSourcePrivate; +/
910 
911     static if((versionIsSet!("OSX") || versionIsSet!("iOS") || versionIsSet!("TVOS") || versionIsSet!("WatchOS")))
912     {
913         /+ friend bool qt_mac_is_metal(const QWidget *w); +/
914     }
915     /+ friend Q_WIDGETS_EXPORT QWidgetData *qt_qwidget_data(QWidget *widget); +/
916     /+ friend Q_WIDGETS_EXPORT QWidgetPrivate *qt_widget_private(QWidget *widget); +/
917 
918 private:
919     /+ Q_DISABLE_COPY(QWidget) +/
920     /+ Q_PRIVATE_SLOT(d_func(), void _q_showIfNotHidden()) +/
921 
922     QWidgetData* data;
923 }
924 /+pragma(inline, true) QFlags!(QWidget.RenderFlags.enum_type) operator |(QWidget.RenderFlags.enum_type f1, QWidget.RenderFlags.enum_type f2)/+noexcept+/{return QFlags!(QWidget.RenderFlags.enum_type)(f1)|f2;}+/
925 /+pragma(inline, true) QFlags!(QWidget.RenderFlags.enum_type) operator |(QWidget.RenderFlags.enum_type f1, QFlags!(QWidget.RenderFlags.enum_type) f2)/+noexcept+/{return f2|f1;}+/
926 /+pragma(inline, true) QIncompatibleFlag operator |(QWidget.RenderFlags.enum_type f1, int f2)/+noexcept+/{return QIncompatibleFlag(int(f1)|f2);}+/
927 
928 /+ Q_DECLARE_OPERATORS_FOR_FLAGS(QWidget::RenderFlags)
929 #ifndef Q_QDOC
930 template <> inline QWidget *qobject_cast<QWidget*>(QObject *o)
931 {
932     if (!o || !o->isWidgetType()) return nullptr;
933     return static_cast<QWidget*>(o);
934 }
935 template <> inline const QWidget *qobject_cast<const QWidget*>(const QObject *o)
936 {
937     if (!o || !o->isWidgetType()) return nullptr;
938     return static_cast<const QWidget*>(o);
939 }
940 #endif // !Q_QDOC
941 
942 #if QT_DEPRECATED_SINCE(5, 13)
943 #endif
944 
945 
946 #define QWIDGETSIZE_MAX ((1<<24)-1)
947 
948 #ifndef QT_NO_DEBUG_STREAM
949 Q_WIDGETS_EXPORT QDebug operator<<(QDebug, const QWidget *);
950 #endif +/
951