#ifndef PQCOMBOBOX_H
#define PQCOMBOBOX_H

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

class PQComboBox;
class PQComboBox : public QComboBox {
    Q_OBJECT
    PQ_WIDGET_EX(QComboBox)

    Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex)
    Q_PROPERTY(QString currentText READ currentText WRITE setCurrentText)
    Q_PROPERTY(bool editable READ isEditable WRITE setEditable)
    Q_PROPERTY(bool duplicatesEnabled READ duplicatesEnabled WRITE setDuplicatesEnabled)

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

    Q_INVOKABLE int currentIndex();
    Q_INVOKABLE int count();
    Q_INVOKABLE QString currentText();
    Q_INVOKABLE bool isEditable();
    Q_INVOKABLE bool duplicatesEnabled();
    Q_INVOKABLE QString itemText(int index);
    Q_INVOKABLE int itemIndex(const QString &text);

public Q_SLOTS:
    Q_INVOKABLE void setCurrentIndex(int index);
    Q_INVOKABLE void setCurrentText(const QString &text);
    Q_INVOKABLE void addItem(QString text, QString iconPath);
    Q_INVOKABLE void addItem(QString text);
    Q_INVOKABLE void setEditable(bool b);
    Q_INVOKABLE void setDuplicatesEnabled(bool b);
    Q_INVOKABLE void removeItem(int index);
    Q_INVOKABLE void setItemText(int index, QString text);
    Q_INVOKABLE void setItemIcon(int index, QString iconPath);
    Q_INVOKABLE void setIconSize(int w, int h);
    Q_INVOKABLE void clear();

    void activated_pslot(int index);
    void activated_pslot(const QString &text);
    void currentIndexChanged_pslot(int index);
    void currentIndexChanged_pslot(const QString &text);
    void currentTextChanged_pslot(const QString &text);
    void editTextChanged_pslot(const QString &text);
    void highlighted_pslot(int index);
    void highlighted_pslot(const QString &text);

   // void onCurrentIndexChanged();

    PQ_ON_SIGNAL_DECL_START
        PQ_ON_SIGNAL(activated_pslot(int));
        PQ_ON_SIGNAL(currentIndexChanged_pslot(int));
        PQ_ON_SIGNAL(currentTextChanged_pslot(string));
        PQ_ON_SIGNAL(editTextChanged_pslot(string));
        PQ_ON_SIGNAL(highlighted_pslot(int));
        PQWIDGET_ON_SIGNALS();
    PQ_ON_SIGNAL_DECL_END
};

#endif // PQCOMBOBOX_H
