//------------------------------------------------------------------------------------
// irr::gui::IGUISkin wrappers
// do not delete a pointer to this
//------------------------------------------------------------------------------------

extern "C" 
{
	s32 IrrGUI_IGUISkin_getSize(IGUISkin* skin,EGUI_DEFAULT_SIZE which)
	{
		if (skin)
			return skin->getSize(which);
		else return 0;
	}
	
	void IrrGUI_IGUISkin_setSize(IGUISkin* skin,EGUI_DEFAULT_SIZE which, s32 size)
	{
		if (skin)
			skin->setSize(which,size);
	}
	
	SColor* IrrGUI_IGUISkin_getColor(IGUISkin* skin,EGUI_DEFAULT_COLOR which)
	{
		if (skin)
			return new SColor(skin->getColor(which));
		else return 0;
	}
	
	void IrrGUI_IGUISkin_setColor(IGUISkin* skin,EGUI_DEFAULT_COLOR which,SColor* newColor)
	{
		if (skin)
			skin->setColor(which,*newColor);
	}
			
	const c8* IrrGUI_IGUISkin_getDefaultText(IGUISkin* skin,EGUI_DEFAULT_TEXT which)
	{
		if (skin) {
			stringc* text=new stringc(skin->getDefaultText(which));
			return text->c_str();
		} else return 0;
	}
	
	void IrrGUI_IGUISkin_setDefaultText(IGUISkin* skin,EGUI_DEFAULT_TEXT which, const c8* newText)
	{
		stringw w_text = newText;
		if (skin)
			skin->setDefaultText(which,w_text.c_str());
	}
	
	void IrrGUI_IGUISkin_draw3DButtonPaneStandard(IGUISkin* skin,IGUIElement* element,const core::rect<s32>* rect,const core::rect<s32>* clip=0)
	{
		if (skin)
			skin->draw3DButtonPaneStandard(element,*rect,clip);
	}
	
	void IrrGUI_IGUISkin_draw3DButtonPanePressed(IGUISkin* skin,IGUIElement* element, 
				const rect<s32>* rect,
				const rect<s32>* clip=0)
	{
		if (skin)
			skin->draw3DButtonPanePressed(element,*rect,clip);
	}
	
	void IrrGUI_IGUISkin_draw3DSunkenPane(IGUISkin* skin,IGUIElement* element,
				video::SColor* bgcolor, bool flat, bool fillBackGround,
				const core::rect<s32>* rect,
				const core::rect<s32>* clip=0)
	{
		if (skin)
			skin->draw3DSunkenPane(element,*bgcolor,flat,fillBackGround,*rect,clip);
	}
	
	// must delete return value
	rect<s32>* IrrGUI_IGUISkin_draw3DWindowBackground(IGUISkin* skin,IGUIElement* element,
				bool drawTitleBar, SColor* titleBarColor,
				const rect<s32>* rect,
				const rect<s32>* clip = 0, rect<s32>* checkClientArea = 0)
	{
		if (skin)
			return new core::rect<s32>(skin->draw3DWindowBackground(element,drawTitleBar,*titleBarColor,*rect, clip, checkClientArea));
		else return 0;
	}
	
	void IrrGUI_IGUISkin_draw3DMenuPane(IGUISkin* skin,IGUIElement* element,
				const rect<s32>* rect,
				const rect<s32>* clip=0)
	{
		if (skin)
			skin->draw3DMenuPane(element,*rect,clip);
	}
	
	void IrrGUI_IGUISkin_draw3DToolBar(IGUISkin* skin,IGUIElement* element,
				const core::rect<s32>* rect,
				const core::rect<s32>* clip=0)
	{
		if (skin)
			skin->draw3DToolBar(element,*rect,clip);
	}
		
	// do not delete
	IGUISpriteBank* IrrGUI_IGUISkin_getSpriteBank(IGUISkin* skin)
	{
		if (skin)
			return skin->getSpriteBank();
		else return 0;
	}
	
	void IrrGUI_IGUISkin_setSpriteBank(IGUISkin* skin,IGUISpriteBank* bank)
	{
		if (skin)
			skin->setSpriteBank(bank);
	}
	
	u32 IrrGUI_IGUISkin_getIcon(IGUISkin* skin,EGUI_DEFAULT_ICON icon)
	{
		if (skin)
			return skin->getIcon(icon);
		else return 0;
	}
	
	void IrrGUI_IGUISkin_setIcon(IGUISkin* skin,EGUI_DEFAULT_ICON icon, u32 index)
	{
		if (skin)
			skin->setIcon(icon,index);
	}
	
	s32 IrrGUI_IGUISkin_getType(IGUISkin* skin)
	{
		if (skin)
			return skin->getType();
		else return -1;
	}
	
	void IrrGUI_IGUISkin_drawIcon(IGUISkin* skin,IGUIElement* element, EGUI_DEFAULT_ICON icon,
		position2di* position, u32 starttime=0, u32 currenttime=0, 
		bool loop=false, recti* clip=0)
	{
		if (skin)
			skin->drawIcon(element,icon,*position,starttime,currenttime,loop,clip);
	}

	// do not delete
	IGUIFont* IrrGUI_IGUISkin_getFont(IGUISkin* skin,EGUI_DEFAULT_FONT which=EGDF_DEFAULT)
	{
		if (skin)
			return skin->getFont(which);
		else return 0;
	}

	void IrrGUI_IGUISkin_setFont(IGUISkin* skin,IGUIFont* font, EGUI_DEFAULT_FONT which=EGDF_DEFAULT)
	{
		if (skin)
			skin->setFont(font,which);
	}

	void IrrGUI_IGUISkin_draw2DRectangle(IGUISkin* skin, IGUIElement* element, SColor* color, rect<s32>* pos, rect<s32>* clip = 0)
	{
		if (skin)
			skin->draw2DRectangle(element, *color, *pos, clip);
	}
	
	void IrrGUI_IGUISkin_draw3DTabButton(IGUISkin* skin, IGUIElement* element, bool active, const core::rect<s32>* rect, const core::rect<s32>* clip=0, gui::EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT)
	{
		if (skin)
			skin->draw3DTabButton(element, active, *rect, clip, alignment);
	}

	void IrrGUI_IGUISkin_draw3DTabBody(IGUISkin* skin, IGUIElement* element, bool border, bool background, const core::rect<s32>* rect, const core::rect<s32>* clip=0, s32 tabHeight=-1, gui::EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT )
	{
		if (skin)
			skin->draw3DTabBody(element, border, background, *rect, clip, tabHeight, alignment); 
	}
}