#include "tk_scrollbar.h"

const Ptr<TkOptionDef> TkScrollBar::OPT_ACTIVEBACKGROUND=new TkOptionDef("activebackground",TkColorOption::type);
const Ptr<TkOptionDef> TkScrollBar::OPT_ACTIVERELIEF;
const Ptr<TkOptionDef> TkScrollBar::OPT_BACKGROUND=new TkOptionDef("background",TkColorOption::type);
const Ptr<TkOptionDef> TkScrollBar::OPT_BORDERWIDTH=new TkOptionDef("borderwidth",TkIntOption::type);
const Ptr<TkOptionDef> TkScrollBar::OPT_COMMAND=new TkOptionDef("command",TkStringOption::type,false);
const Ptr<TkOptionDef> TkScrollBar::OPT_CURSOR;
const Ptr<TkOptionDef> TkScrollBar::OPT_ELEMENTBORDERWIDTH;
const Ptr<TkOptionDef> TkScrollBar::OPT_HIGHLIGHTBACKGROUND=new TkOptionDef("highlightbackground",TkColorOption::type);
const Ptr<TkOptionDef> TkScrollBar::OPT_HIGHLIGHTCOLOR=new TkOptionDef("highlightcolor",TkColorOption::type);
const Ptr<TkOptionDef> TkScrollBar::OPT_HIGHLIGHTTHICKNESS;
const Ptr<TkOptionDef> TkScrollBar::OPT_JUMP;
const Ptr<TkOptionDef> TkScrollBar::OPT_ORIENT=new TkOptionDef("orient",TkOrientOption::type);
const Ptr<TkOptionDef> TkScrollBar::OPT_RELIEF=new TkOptionDef("relief",TkReliefOption::type);
const Ptr<TkOptionDef> TkScrollBar::OPT_REPEATDELAY;
const Ptr<TkOptionDef> TkScrollBar::OPT_REPEATINTERVAL;
const Ptr<TkOptionDef> TkScrollBar::OPT_TAKEFOCUS;
const Ptr<TkOptionDef> TkScrollBar::OPT_TROUGHTCOLOR;
const Ptr<TkOptionDef> TkScrollBar::OPT_WIDTH=new TkOptionDef("width",TkIntOption::type);

const Ptr<TkOptionDef> TkScrollBar::optAll[]=
{
	TkScrollBar::OPT_ACTIVEBACKGROUND,
	TkScrollBar::OPT_ACTIVERELIEF,
	TkScrollBar::OPT_BACKGROUND,
	TkScrollBar::OPT_BORDERWIDTH,
	TkScrollBar::OPT_COMMAND,
	TkScrollBar::OPT_CURSOR,
	TkScrollBar::OPT_ELEMENTBORDERWIDTH,
	TkScrollBar::OPT_HIGHLIGHTBACKGROUND,
	TkScrollBar::OPT_HIGHLIGHTCOLOR,
	TkScrollBar::OPT_HIGHLIGHTTHICKNESS,
	TkScrollBar::OPT_JUMP,
	TkScrollBar::OPT_RELIEF,
	TkScrollBar::OPT_REPEATDELAY,
	TkScrollBar::OPT_REPEATINTERVAL,
	TkScrollBar::OPT_TAKEFOCUS,
	TkScrollBar::OPT_TROUGHTCOLOR,
	TkScrollBar::OPT_WIDTH
};

const char* TkScrollBar::type="TkScrollBar";
const char* TkScrollBar::tkClass="scrollbar";

const Ptr<TkOptionDef>* TkScrollBar::getOptionAll() const
{
	return TkScrollBar::optAll;
}

const char* TkScrollBar::getType() const
{
	return TkScrollBar::type;
}

const char* TkScrollBar::getTkClass() const
{
	return TkScrollBar::tkClass;
}

void TkScrollBar::doSerialize(TiXmlElement& element) const
{
	TkBase::doSerialize(element);
}

void TkScrollBar::doDeserialize(const TiXmlElement& element)
{
	TkBase::doDeserialize(element);
}

TObject* TkScrollBar::clone()
{
	TkBase* obj=new TkScrollBar(interp);

	baseClone(obj);

	return obj;
}

TkScrollBar::TkScrollBar(Ptr<TclInterp>& interp):TkBase(interp)
{
}

TkScrollBar::TkScrollBar(Ptr<TclInterp>& interp,TkOrientOption::opts orient):TkBase(interp)
{
	setOption(TkScrollBar::OPT_ORIENT,new TkOrientOption(orient));
}

void TkScrollBar::setBackgroundColor(TkColorOption* color)
{
	setOption(OPT_BACKGROUND,color);
}

Ptr<TkColorOption>& TkScrollBar::getBackgroundColor() const
{
	TkColorOption* colorOption=new TkColorOption();
	
	colorOption->fromObject(getOption(OPT_BACKGROUND));
	return *(new Ptr<TkColorOption>(colorOption));
}


