#ifndef __USER_SELECT_VIEW_H__
#define __USER_SELECT_VIEW_H__

#include <gtkmm.h>
#include <array>
#include "UserItem.h"

#define USER_ITEMS_PER_PAGE_MAX (3)

class UserSelectView : public Gtk::Box {
public:
    UserSelectView();
    ~UserSelectView();

    void prePage();
    void nextPage();

    void selectUserByNum(int userNum);

    sigc::signal<void, Glib::ustring> signalUserItemPress();

    void resetFocus();

protected:
    void on_show();

private:
    void loadUsers();
    void onUserPress(Glib::ustring userName);
    void onLeftClicked();
    void onRightClicked();
    bool autoSelectUser();

private:
    Gtk::Box m_mainLyt;
    Gtk::Box m_dirLeftContent;
    Gtk::Box m_dirRightContent;

    Gtk::Box m_userArea;

    Gtk::Image m_dirLeftImg;
    Gtk::Image m_dirRightImg;

    Gtk::Button m_dirLeft;
    Gtk::Button m_dirRight;

    int m_curFirstItemIndex;
    sigc::signal<void, Glib::ustring> m_pressSignal;
    std::array<UserItem*, USER_ITEMS_PER_PAGE_MAX> m_userItemPerPage;

    std::vector<Glib::ustring> m_userlist;

    double m_scaleX;
    double m_scaleY;

    sigc::connection m_sigLeftBtnPressIter;
    sigc::connection m_sigRightBtnPressIter;
    sigc::connection m_sigUserItemPressIter;
};

#endif // __USER_SELECT_VIEW_H__