//------------------------------------------------------------------------------------
// irr::gui::IGUIListBox wrappers
// do not delete a pointer to this
//------------------------------------------------------------------------------------
extern "C" 
{

	u32 IrrGUI_IGUIListBox_addItem(IGUIListBox* lb,const wchar_t* text)
	{
		if (lb)
			return lb->addItem(text);
		else
			return 0;
	}
	
	u32 IrrGUI_IGUIListBox_addItemWithIcon(IGUIListBox* lb,const wchar_t* text,s32 icon)
	{
		if (lb)
			return lb->addItem(text,icon);
		else
			return 0;
	}
	
	void IrrGUI_IGUIListBox_clear(IGUIListBox* lb)
	{
		if (lb)
			lb->clear();
	}
	
	u32 IrrGUI_IGUIListBox_getItemCount(IGUIListBox* lb)
	{
		if (lb)
			return lb->getItemCount();
		else return 0;
	}
	
	const wchar_t* IrrGUI_IGUIListBox_getListItem(IGUIListBox* lb,u32 idx)
	{
		if (lb) {
			return lb->getListItem(idx);
		} else return L"";
	}
	
	s32 IrrGUI_IGUIListBox_getSelected(IGUIListBox* lb)
	{
		if (lb)
			return lb->getSelected();
		else return -1;
	}
		
	void IrrGUI_IGUIListBox_setSelected(IGUIListBox* lb,s32 index)
	{
		if (lb)
			lb->setSelected(index);
	}

	void IrrGUI_IGUIListBox_setSelectedByText(IGUIListBox* lb, const c8* text)
	{
		if (lb)
			lb->setSelected(stringw(text).c_str());
	}
	
	void IrrGUI_IGUIListBox_removeItem(IGUIListBox* lb,u32 index)
	{
		if (lb)
			lb->removeItem(index);
	}
	
	void IrrGUI_IGUIListBox_setSpriteBank(IGUIListBox* lb,IGUISpriteBank* bank)
	{
		if (lb)
			lb->setSpriteBank(bank);
	}
	
	s32 IrrGUI_IGUIListBox_getIcon(IGUIListBox* lb,u32 id)
	{
		if (lb)
			return lb->getIcon(id);
		else return -1;
	}

	void IrrGUI_IGUIListBox_setAutoScrollEnabled(IGUIListBox* lb,bool scroll)
	{
		if (lb) {
			lb->setAutoScrollEnabled(scroll);
		}
	}

	bool IrrGUI_IGUIListBox_isAutoScrollEnabled(IGUIListBox* lb)
	{
		if (lb) {
			return lb->isAutoScrollEnabled();
		} else return false;
	}

	void IrrGUI_IGUIListBox_setItemOverrideColor(IGUIListBox* lb,u32 index, SColor* color)
	{
		if (lb) {
			lb->setItemOverrideColor(index, *color);
		}
	}

	void IrrGUI_IGUIListBox_setItemOverrideColorByType(IGUIListBox* lb,u32 index, EGUI_LISTBOX_COLOR colorType, SColor* color)
	{
		if (lb) {
			lb->setItemOverrideColor(index, colorType, *color);
		}
	}

	void IrrGUI_IGUIListBox_clearItemOverrideColor(IGUIListBox* lb,u32 index)
	{
		if (lb) {
			lb->clearItemOverrideColor(index);
		}
	}

	void IrrGUI_IGUIListBox_clearItemOverrideColorByType(IGUIListBox* lb,u32 index, EGUI_LISTBOX_COLOR colorType)
	{
		if (lb) {
			lb->clearItemOverrideColor(index, colorType);
		}
	}

	bool IrrGUI_IGUIListBox_hasItemOverrideColor(IGUIListBox* lb,u32 index, EGUI_LISTBOX_COLOR colorType)
	{
		if (lb) {
			return lb->hasItemOverrideColor(index, colorType);
		} else return false;
	}

	// must delete
	SColor* IrrGUI_IGUIListBox_getItemOverrideColor(IGUIListBox* lb,u32 index, EGUI_LISTBOX_COLOR colorType)
	{
		if (lb) {
			return new SColor(lb->getItemOverrideColor(index, colorType));
		} else return 0;
	}

	// must delete
	SColor* IrrGUI_IGUIListBox_getItemDefaultColor(IGUIListBox* lb,EGUI_LISTBOX_COLOR colorType)
	{
		if (lb) {
			return new SColor(lb->getItemDefaultColor(colorType));
		} else return 0;
	}

	void IrrGUI_IGUIListBox_setItem(IGUIListBox* lb,u32 index, const wchar_t* text, s32 icon)
	{
		if (lb) {
			lb->setItem(index, text, icon);
		}
	}

	s32 IrrGUI_IGUIListBox_insertItem(IGUIListBox* lb,u32 index, const wchar_t* text, s32 icon)
	{
		if (lb) {
			return lb->insertItem(index, text, icon);
		} else return -1;
	}

	void IrrGUI_IGUIListBox_swapItems(IGUIListBox* lb,u32 index1, u32 index2)
	{
		if (lb) {
			lb->swapItems(index1, index2);
		}
	}

	void IrrGUI_IGUIListBox_setItemHeight(IGUIListBox* lb, s32 height) {
		if (lb)
			lb->setItemHeight(height);
	}

	void IrrGUI_IGUIListBox_setDrawBackground(IGUIListBox* lb, bool draw) {
		if (lb)
			lb->setDrawBackground(draw);
	}

}