If you have comments or questions concerning this source file, discuss them in the forum.
/*
Copyright (c) 2002 Nicolai Haehnle

See the license.txt for details. If that file was not included in the
source distributions, please email <prefect@rtts.org>
*/
// gui_listbox.h

#ifndef GUI_LISTBOX_H
#define GUI_LISTBOX_H

#include "gui_panel.h"

/*
The listbox provides a list of strings to pick from
*/

class GListBox : public GPanel {
public:
    int     m_iNumItems;
    char    **m_pItems;
    int     m_iSelection;

    HFont   *m_pFont;

    byte    m_selectedcolor[4];

public:
    GListBox(GPanel *pParent, int x, int y, int w, int h);
    virtual ~GListBox();

    LSignal SelectChanged;

    void AddString(const char *sz);

    const char *GetSelection();
    int GetSelectionId() { return m_iSelection; }

    void SelectMove(int d);
    void SetSelection(int id);

    inline void SetSelectedColor(int r, int g, int b, int a = 255) {
        m_selectedcolor[0] = r; m_selectedcolor[1] = g; m_selectedcolor[2] = b;
        m_selectedcolor[3] = a;
    }

public:
    virtual void Draw();

    virtual bool Key(int code, char c, bool down);
    virtual bool MouseButton(int btn, int x, int y, bool down);
};

#endif // GUI_LISTBOX_H