#pragma once

#include "../Base.h"
#include "../Font.h"
#include <Widgets/Slider/SliderBlueprint.h>
#include "Placeholder.h"

namespace gorgon { namespace widgets {

	class SliderElement;

	SliderElement *LoadSliderElement(Base *parent, File &file, std::istream &in, int Size);

	class SliderElement : public gge::widgets::slider::Blueprint::Element, public Base {
		friend SliderElement *LoadSliderElement(gorgon::Base *parent, File &file, std::istream &in, int Size);
	public:
		typedef gge::widgets::slider::Blueprint::Element parenttype;

		SliderElement() {
			ValueFont=NULL;
			TextPlace=NULL;
			ValuePlace=NULL;
			Ruler=NULL;
			Indicator=NULL;
			RulerOverlay=NULL;
			Tickmark=NULL;
			TickmarkBorder=NULL;
			TickmarkPlace=NULL;
		}

		virtual GID::Type GetGID() const {
			return parenttype::GetGID();
		}

		virtual void Save(std::ostream &out);

		virtual void Prepare(gge::GGEMain &main, File &file);

		using gorgon::Base::Subitems;

		virtual ~SliderElement() {
			if(font.guid_theme==gge::utils::SGuid::Empty)
				Font=NULL;
			if(valuefont.guid_theme==gge::utils::SGuid::Empty)
				ValueFont=NULL;
		}

	protected:
		FontInitiator font, valuefont;
	};


	class SliderGroup;

	SliderGroup *LoadSliderGroup(Base *parent, File &file, std::istream &in, int Size);

	class SliderGroup : public gge::widgets::slider::Blueprint::Group, public Base {
		friend SliderGroup *LoadSliderGroup(gorgon::Base *parent, File &file, std::istream &in, int Size);
	public:
		typedef gge::widgets::slider::Blueprint::Group parenttype;

		virtual GID::Type GetGID() const {
			return parenttype::GetGID();
		}

		virtual void Save(std::ostream &out);

		virtual void Prepare(gge::GGEMain &main, File &file);

		using gorgon::Base::Subitems;

		void Update() { updatemapping(); }

	protected:
	};


	class Slider;

	Slider *LoadSlider(Base *parent, File &file, std::istream &in, int Size);

	class Slider : public gge::widgets::slider::Blueprint, public Base {
		friend 	Slider *LoadSlider(gorgon::Base *parent, File &file, std::istream &in, int Size);
	public:
		Slider() {
		}

		typedef gge::widgets::slider::Blueprint parenttype;

		virtual GID::Type GetGID() const {
			return parenttype::GetGID();
		}

		virtual void Save(std::ostream &out);

		virtual void Prepare(gge::GGEMain &main, File &file);

		using gorgon::Base::Subitems;
	};

}}
