#ifndef __C_GUI_COMBO_BOX_H_INCLUDED__
#define __C_GUI_COMBO_BOX_H_INCLUDED__
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_WITH_GUI_
#include "IGUIComboBox.h"
#include "IGUIStaticText.h"
#include "irrString.h"
#include "irrArray.h"
namespace irr
{
namespace gui
{
class IGUIButton;
class IGUIListBox;
class CGUIComboBox : public IGUIComboBox
{
public:
CGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle);
virtual u32 getItemCount() const;
virtual const wchar_t* getItem(u32 idx) const;
virtual u32 getItemData(u32 idx) const;
virtual s32 getIndexForItemData( u32 data ) const;
virtual u32 addItem(const wchar_t* text, u32 data);
virtual void removeItem(u32 id);
virtual void clear();
virtual const wchar_t* getText() const;
virtual s32 getSelected() const;
virtual void setSelected(s32 idx);
virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical);
virtual bool OnEvent(const SEvent& event);
virtual void draw();
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
private:
void openCloseMenu();
void sendSelectionChangedEvent();
IGUIButton* ListButton;
IGUIStaticText* SelectedText;
IGUIListBox* ListBox;
IGUIElement *LastFocus;
struct SComboData
{
SComboData ( const wchar_t * text, u32 data )
: Name (text), Data ( data ) {}
core::stringw Name;
u32 Data;
};
core::array< SComboData > Items;
s32 Selected;
EGUI_ALIGNMENT HAlign, VAlign;
bool HasFocus;
};
}
}
#endif
#endif