summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowswindowclassdescription.h
blob: f0019f8f3c206e4fc071ae07188b53f80df8208d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef QWINDOWSWINDOWCLASSDESCRIPTION_H
#define QWINDOWSWINDOWCLASSDESCRIPTION_H

#include "qtwindowsglobal.h"

#include <QtCore/qstring.h>

QT_BEGIN_NAMESPACE

class QWindow;

struct QWindowsWindowClassDescription
{
    enum class WindowStyleOption
    {
        None = 0x00,
        GLSurface = 0x01,
        DropShadow = 0x02
    };
    Q_DECLARE_FLAGS(WindowStyleOptions, WindowStyleOption)

    static QWindowsWindowClassDescription fromName(QString name, WNDPROC procedure);
    static QWindowsWindowClassDescription fromWindow(const QWindow *window, WNDPROC procedure);

    QString name;
    WNDPROC procedure{ DefWindowProc };
    unsigned int style{ 0 };
    HBRUSH brush{ nullptr };
    bool hasIcon{ false };
    bool shouldAddPrefix{ true };

private:
    static QString classNameSuffix(Qt::WindowFlags type, unsigned int style, bool hasIcon);
    static bool computeHasIcon(Qt::WindowFlags flags, Qt::WindowFlags type);
    static unsigned int computeWindowStyles(Qt::WindowFlags flags, Qt::WindowFlags type, WindowStyleOptions options);

    friend QDebug operator<<(QDebug dbg, const QWindowsWindowClassDescription &description);
};

Q_DECLARE_OPERATORS_FOR_FLAGS(QWindowsWindowClassDescription::WindowStyleOptions)

QT_END_NAMESPACE

#endif // QWINDOWSWINDOWCLASSDESCRIPTION_H