/*
 * This file is part of smolbote. It's copyrighted by the contributors recorded
 * in the version control history of the file, available from its original
 * location: git://neueland.iserlohn-fortress.net/smolbote.git
 *
 * SPDX-License-Identifier: GPL-3.0
 */

#ifndef NAVIGATIONBUTTON_H
#define NAVIGATIONBUTTON_H

#include <QToolButton>
#include <webengine/webview.h>

class QMenu;

class NavigationButton : public QToolButton
{
    Q_OBJECT
public:

    enum Type {
        BackButton,
        ForwardButton,
        ReloadButton,
        StopButton
    };

    explicit NavigationButton(Type type, QWidget *parent = nullptr);

    void setView(WebView *view);

signals:

private slots:
    void updateOnLoadStarted();
    void updateOnLoadFinished();
    void doAction();
    void prepareMenu();

private:
    Type m_type;
    QMenu *menu;
    WebView *m_view;

    QMetaObject::Connection loadStartedConnection, loadFinishedConnection;
};

#endif // NAVIGATIONBUTTON_H