#ifndef LIST_H_INCLUDED
#define LIST_H_INCLUDED

#include "widget.h"
#include "scrollBar.h"
#include "label.h"
#include <vector>

class listBox : public widget
{
private:
    static int cnt; // Objektumszámláló
    const unsigned int itemHeight = 20;

    // Lenyomva tartott billentyű a folyamatos görgetéshez
    char keyDown;

    // Hogy ne azonnal kezdjen el görgetni
    bool wait;
    const unsigned int waitInterval = 500;
    unsigned int waitCounter;

protected:
    std::vector<label*> items;
    scrollBar *myScrollBar;
    unsigned int listIndex;

public:

    /// ---- Konstruktor ----
    listBox(int x0, int y0, unsigned int width0, unsigned int height0, std::vector<std::string> items0);

    /// ---- Destruktor ----
    ~listBox();

    /// ---- Események ----
    virtual void onClick(int posX, int posY, char button);
    virtual void onMouseUp(int posX, int posY, char button);
    virtual void onMouseMove(int posX, int posY);
    virtual void onKeyPress(char keyCode);
    virtual void onKeyUp(char keyCode);
    virtual void onTick();

    /// ---- Get/Set ----
    void addItem(std::string newItem);
    std::string getItem(unsigned int i);
    int getCount();
    bool setIndex(unsigned int newValue);
    int getIndex();

    /// ---- Kirajzolás ----
    virtual void draw() const;
};

#endif // LIST_H_INCLUDED
