QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskSubWindow.h
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#ifndef QSK_SUB_WINDOW_H
7#define QSK_SUB_WINDOW_H
8
9#include "QskPopup.h"
10
11class QskGraphic;
12class QskTextOptions;
13class QUrl;
14
15class QSK_EXPORT QskSubWindow : public QskPopup
16{
17 Q_OBJECT
18
19 Q_PROPERTY( Decorations decorations READ decorations
20 WRITE setDecorations RESET resetDecorations NOTIFY decorationsChanged )
21
22 Q_PROPERTY( QString windowTitle READ windowTitle
23 WRITE setWindowTitle NOTIFY windowTitleChanged )
24
25 Q_PROPERTY( QskTextOptions windowTitleTextOptions READ windowTitleTextOptions
26 WRITE setWindowTitleTextOptions NOTIFY windowTitleTextOptionsChanged )
27
28 Q_PROPERTY( QUrl windowIconSource READ windowIconSource
29 WRITE setWindowIconSource NOTIFY windowIconSourceChanged )
30
31 Q_PROPERTY( QskGraphic windowIcon READ windowIcon
32 WRITE setWindowIcon NOTIFY windowIconChanged FINAL )
33
34 using Inherited = QskPopup;
35
36 public:
37 enum Decoration
38 {
39 NoDecoration = 0,
40
41 TitleBar = 1 << 0,
42
43 Title = 1 << 1,
44 Symbol = 1 << 2
45
46#if 0
47 MinimizeButton = 1 << 3,
48 MaximizeButton = 1 << 4,
49 CloseButton = 1 << 5
50#endif
51 };
52
53 Q_ENUM( Decoration )
54 Q_DECLARE_FLAGS( Decorations, Decoration )
55
56 QSK_SUBCONTROLS( Panel, TitleBarPanel, TitleBarSymbol, TitleBarText )
57
58 QskSubWindow( QQuickItem* parent = nullptr );
59 ~QskSubWindow() override;
60
61 void setDecorations( Decorations );
62 void resetDecorations();
63 Decorations decorations() const;
64
65 void setDecoration( Decoration, bool on = true );
66 bool hasDecoration( Decoration ) const;
67
68 void setWindowTitleTextOptions( const QskTextOptions& );
69 QskTextOptions windowTitleTextOptions() const;
70
71 void setWindowTitle( const QString& );
72 QString windowTitle() const;
73
74 void setWindowIconSource( const QString& );
75 void setWindowIconSource( const QUrl& );
76 QUrl windowIconSource() const;
77
78 void setWindowIcon( const QskGraphic& );
79 QskGraphic windowIcon() const;
80
81 bool hasWindowIcon() const;
82
83 QRectF titleBarRect() const;
84
85 QRectF layoutRectForSize( const QSizeF& ) const override;
86 QskAspect fadingAspect() const override;
87
88 Q_SIGNALS:
89 void decorationsChanged( Decorations );
90 void windowTitleChanged();
91 void windowTitleTextOptionsChanged();
92 void windowIconChanged();
93 void windowIconSourceChanged();
94
95 protected:
96 bool event( QEvent* ) override;
97
98 void updateLayout() override;
99 void updateResources() override;
100
101 QSizeF layoutSizeHint( Qt::SizeHint, const QSizeF& ) const override;
102
103 void itemChange( QQuickItem::ItemChange,
104 const QQuickItem::ItemChangeData& ) override;
105
106 private:
107 class PrivateData;
108 std::unique_ptr< PrivateData > m_data;
109};
110
111Q_DECLARE_OPERATORS_FOR_FLAGS( QskSubWindow::Decorations )
112Q_DECLARE_METATYPE( QskSubWindow::Decorations )
113
114#endif
Lookup key for a QskSkinHintTable.
Definition QskAspect.h:15
virtual QRectF layoutRectForSize(const QSizeF &) const
A paint device for scalable graphics.
Definition QskGraphic.h:28