#ifndef PQACTION_H
#define PQACTION_H

#include <QAction>
#include "classes/pqwidget.h"

class PQAction;
class PQAction : public QAction {
    Q_OBJECT
    PQ_OBJECT_EX(QAction)

    Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable)
    Q_PROPERTY(bool checked READ isChecked WRITE setChecked)
    Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
    Q_PROPERTY(bool visible READ isVisible WRITE setVisible)

public:
    Q_INVOKABLE explicit PQAction(QWidget *parent = 0);
    virtual ~PQAction();

    Q_INVOKABLE bool isCheckable();
    Q_INVOKABLE bool isChecked();
    Q_INVOKABLE bool isEnabled();
    Q_INVOKABLE bool isVisible();

public Q_SLOTS:
    Q_INVOKABLE void setCheckable(bool checkable);
    Q_INVOKABLE void setChecked(bool checked);
    Q_INVOKABLE void setEnabled(bool enabled);
    Q_INVOKABLE void setVisible(bool visible);
    Q_INVOKABLE void toggle();
    Q_INVOKABLE void trigger();

    void changed_pslot();
    void hovered_pslot();
    void toggled_pslot(bool checked);
    void triggered_pslot(bool checked);
    void triggered_pslot();

    PQ_ON_SIGNAL_DECL_START {
        PQ_ON_SIGNAL(changed_pslot());
        PQ_ON_SIGNAL(hovered_pslot());
        PQ_ON_SIGNAL(toggled_pslot(bool));
        PQ_ON_SIGNAL(triggered_pslot(bool));
    } PQ_ON_SIGNAL_DECL_END
};

Q_DECLARE_METATYPE(QAction*)
Q_DECLARE_METATYPE(PQAction*)

#endif // PQACTION_H
