#ifndef WPICTURELIST_H
#define WPICTURELIST_H

#include <QWidget>
#include "wPictureItem.h"
#include "widgetViewPhoto.h"

QT_BEGIN_NAMESPACE
class QDragEnterEvent;
class QDropEvent;
class QMimeData;

namespace Ui {
class wPictureList;
}
QT_END_NAMESPACE


class wPictureList : public QWidget
{
    Q_OBJECT
signals:
    void picChange();
public:
    explicit wPictureList(int nItemWidth, int nItemSpace, QWidget *parent = nullptr);
    ~wPictureList();

	int setUI(const int nLeft, const int nTop, const int nWidth);
    void setColNum(int nColNum);
    void AddPic(QString sUrl);
	void clearPic();
    void rePos(QPoint startPt, QPoint endPt);
    int itemCount() const;
    QString getFileUrls();
protected:
    void dragEnterEvent(QDragEnterEvent *event) override;
    void dragMoveEvent(QDragMoveEvent *event) override;
    void dropEvent(QDropEvent *event) override;
    void dragLeaveEvent(QDragLeaveEvent*) override;
    void mousePressEvent(QMouseEvent *event) override;
private:
    Ui::wPictureList *ui;

    int m_nColNum;
    int m_nItemWidth;
    int m_nItemSpace;
    std::list<wPictureItem*> m_vPicList;
    std::shared_ptr<widgetViewPhoto> m_pViewPhoto;

    bool m_isDragout;
    QString m_dargItemstr;
    QPoint m_pos;

};

#endif // WPICTURELIST_H
