qskinny/src/controls/QskSubWindow.h

109 lines
2.9 KiB
C
Raw Normal View History

2017-07-21 18:21:34 +02:00
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
2023-04-06 09:23:37 +02:00
* SPDX-License-Identifier: BSD-3-Clause
2017-07-21 18:21:34 +02:00
*****************************************************************************/
#ifndef QSK_SUB_WINDOW_H
2022-03-20 13:11:34 +01:00
#define QSK_SUB_WINDOW_H
2017-07-21 18:21:34 +02:00
#include "QskPopup.h"
2018-10-29 20:11:48 +01:00
class QskGraphic;
class QskTextOptions;
class QUrl;
2017-07-21 18:21:34 +02:00
class QSK_EXPORT QskSubWindow : public QskPopup
{
Q_OBJECT
2021-04-28 09:32:49 +02:00
Q_PROPERTY( Decorations decorations READ decorations
WRITE setDecorations RESET resetDecorations NOTIFY decorationsChanged )
2017-07-21 18:21:34 +02:00
2018-10-29 20:11:48 +01:00
Q_PROPERTY( QString windowTitle READ windowTitle
WRITE setWindowTitle NOTIFY windowTitleChanged )
Q_PROPERTY( QskTextOptions windowTitleTextOptions READ windowTitleTextOptions
WRITE setWindowTitleTextOptions NOTIFY windowTitleTextOptionsChanged )
Q_PROPERTY( QUrl windowIconSource READ windowIconSource
WRITE setWindowIconSource NOTIFY windowIconSourceChanged )
Q_PROPERTY( QskGraphic windowIcon READ windowIcon
WRITE setWindowIcon NOTIFY windowIconChanged FINAL )
2018-08-03 08:15:28 +02:00
2017-07-21 18:21:34 +02:00
using Inherited = QskPopup;
2018-08-03 08:15:28 +02:00
public:
2021-04-28 09:32:49 +02:00
enum Decoration
2017-07-21 18:21:34 +02:00
{
2021-04-28 09:32:49 +02:00
NoDecoration = 0,
TitleBar = 1 << 0,
Title = 1 << 1,
Symbol = 1 << 2
#if 0
MinimizeButton = 1 << 3,
MaximizeButton = 1 << 4,
CloseButton = 1 << 5
#endif
2017-07-21 18:21:34 +02:00
};
2021-04-28 09:32:49 +02:00
Q_ENUM( Decoration )
Q_DECLARE_FLAGS( Decorations, Decoration )
2017-07-21 18:21:34 +02:00
2021-04-28 09:32:49 +02:00
QSK_SUBCONTROLS( Panel, TitleBarPanel, TitleBarSymbol, TitleBarText )
2017-07-21 18:21:34 +02:00
QskSubWindow( QQuickItem* parent = nullptr );
2018-07-31 17:32:25 +02:00
~QskSubWindow() override;
2017-07-21 18:21:34 +02:00
2021-04-28 09:32:49 +02:00
void setDecorations( Decorations );
void resetDecorations();
Decorations decorations() const;
void setDecoration( Decoration, bool on = true );
bool hasDecoration( Decoration ) const;
2018-10-29 20:11:48 +01:00
void setWindowTitleTextOptions( const QskTextOptions& );
QskTextOptions windowTitleTextOptions() const;
2017-07-21 18:21:34 +02:00
2018-10-29 20:11:48 +01:00
void setWindowTitle( const QString& );
QString windowTitle() const;
2017-07-21 18:21:34 +02:00
2018-11-05 13:50:41 +01:00
void setWindowIconSource( const QString& );
2018-10-29 20:11:48 +01:00
void setWindowIconSource( const QUrl& );
QUrl windowIconSource() const;
2017-07-21 18:21:34 +02:00
2018-10-29 20:11:48 +01:00
void setWindowIcon( const QskGraphic& );
QskGraphic windowIcon() const;
bool hasWindowIcon() const;
2017-07-21 18:21:34 +02:00
QRectF titleBarRect() const;
QRectF layoutRectForSize( const QSizeF& ) const override;
2017-07-21 18:21:34 +02:00
2018-08-03 08:15:28 +02:00
Q_SIGNALS:
2021-04-28 09:32:49 +02:00
void decorationsChanged( Decorations );
2018-10-29 20:11:48 +01:00
void windowTitleChanged();
void windowTitleTextOptionsChanged();
void windowIconChanged();
void windowIconSourceChanged();
2017-07-21 18:21:34 +02:00
2018-08-03 08:15:28 +02:00
protected:
2018-07-31 17:32:25 +02:00
bool event( QEvent* ) override;
2018-10-29 20:11:48 +01:00
void updateLayout() override;
QSizeF layoutSizeHint( Qt::SizeHint, const QSizeF& ) const override;
2019-09-05 15:16:33 +02:00
2018-07-31 17:32:25 +02:00
void itemChange( QQuickItem::ItemChange,
2017-07-21 18:21:34 +02:00
const QQuickItem::ItemChangeData& ) override;
2018-08-03 08:15:28 +02:00
private:
2017-07-21 18:21:34 +02:00
class PrivateData;
std::unique_ptr< PrivateData > m_data;
};
#endif