/*
   SPDX-FileCopyrightText: 2015-2026 Laurent Montel <montel@kde.org>

   SPDX-License-Identifier: LGPL-2.0-or-later
*/

#pragma once

#include "webengineviewer_export.h"
#include <KActionMenu>
class KActionCollection;
namespace WebEngineViewer
{
class ZoomActionMenuPrivate;
/*!
 * \class WebEngineViewer::ZoomActionMenu
 * \inmodule WebEngineViewer
 * \inheaderfile WebEngineViewer/ZoomActionMenu
 *
 * \brief The ZoomActionMenu class
 * \author Laurent Montel <montel@kde.org>
 */
class WEBENGINEVIEWER_EXPORT ZoomActionMenu : public KActionMenu
{
    Q_OBJECT
public:
    /*! Constructs a ZoomActionMenu object. */
    explicit ZoomActionMenu(QObject *parent = nullptr);
    /*! Destroys the ZoomActionMenu object. */
    ~ZoomActionMenu() override;

    /*! Creates zoom actions. */
    void createZoomActions();

    /*! Returns the zoom in action. */
    [[nodiscard]] QAction *zoomInAction() const;

    /*! Returns the zoom out action. */
    [[nodiscard]] QAction *zoomOutAction() const;

    /*! Returns the zoom reset action. */
    [[nodiscard]] QAction *zoomResetAction() const;

    /*! Sets the action collection. */
    void setActionCollection(KActionCollection *ac);

    /*! Sets the zoom factor. */
    void setZoomFactor(qreal zoomFactor);
    /*! Returns the current zoom factor. */
    [[nodiscard]] qreal zoomFactor() const;

    /*! Sets the web viewer zoom factor. */
    void setWebViewerZoomFactor(qreal zoomFactor);

Q_SIGNALS:
    /*! Emitted when the zoom factor changes. */
    void zoomChanged(qreal value);

public:
    /*! Zooms in. */
    void slotZoomIn();
    /*! Zooms out. */
    void slotZoomOut();
    /*! Resets the zoom. */
    void slotZoomReset();

private:
    std::unique_ptr<ZoomActionMenuPrivate> const d;
};
}
