// 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 QOHOSWINDOWUTILS_H
#define QOHOSWINDOWUTILS_H

#include <QtGui/qcolor.h>
#include <QtGui/qevent.h>
#include <QtGui/qscreen.h>
#include <QtGui/qwindow.h>
#include <QtOhosExtras/qtohosextrasglobal.h>
#include <QtWidgets/qwidget.h>

QT_BEGIN_NAMESPACE

namespace QtOhosExtras {

Q_NAMESPACE

enum class CloseEventRootCause
{
    InternalClose,
    AbilityClose,
    WindowStageClose,
};
Q_ENUM_NS(CloseEventRootCause)

enum class WindowGeometryPersistenceHint
{
    Disabled,
    Enabled,
    FollowSystemSetting,
};
Q_ENUM_NS(WindowGeometryPersistenceHint)

Q_OHOS_EXTRAS_EXPORT CloseEventRootCause getCloseEventRootCause(QCloseEvent *closeEvent);

Q_OHOS_EXTRAS_EXPORT void setShowWindowAsFloatWindowHint(QWindow *window, bool showAsFloatWindow);
Q_OHOS_EXTRAS_EXPORT void setShowWindowAsFloatWindowHint(QWidget *widget, bool showAsFloatWindow);
Q_OHOS_EXTRAS_EXPORT void setMainWindowGeometryPersistenceHint(WindowGeometryPersistenceHint geometryPersistenceHint);

Q_OHOS_EXTRAS_EXPORT void setWindowPrivacyMode(QWindow *window, bool privacyModeEnabled);

Q_OHOS_EXTRAS_EXPORT void setSurfaceBackgroundColor(QWindow *window, const QColor &color);
Q_OHOS_EXTRAS_EXPORT void setSurfaceBackgroundColor(QWidget *widget, const QColor &color);

Q_OHOS_EXTRAS_EXPORT void setWindowCornerRadius(QWindow *window, double radius);
Q_OHOS_EXTRAS_EXPORT void setWindowCornerRadius(QWidget *widget, double radius);

Q_OHOS_EXTRAS_EXPORT void setWindowKeepScreenOn(QWindow *window, bool keepScreenOn);
Q_OHOS_EXTRAS_EXPORT void setWindowKeepScreenOn(QWidget *widget, bool keepScreenOn);

Q_OHOS_EXTRAS_EXPORT void setWindowDragResizable(QWindow *window, bool dragResizable);
Q_OHOS_EXTRAS_EXPORT void setWindowDragResizable(QWidget *widget, bool dragResizable);

Q_OHOS_EXTRAS_EXPORT QSharedPointer<double> tryGetNativeWindowId(QWindow *window);

Q_OHOS_EXTRAS_EXPORT QSharedPointer<double> tryGetScreenDisplayId(QScreen *screen);

Q_OHOS_EXTRAS_EXPORT void setBundledAbilityAndQWindowBindingKeyForQWindow(
    QWindow *window, const QString &qAbilityQWindowBindingKey);

extern Q_OHOS_EXTRAS_EXPORT const QMetaObject staticMetaObject;

}

QT_END_NAMESPACE

#endif // QOHOSWINDOWUTILS_H
