/*!
	@file
	@author		Albert Semenov
	@date		01/2009
	@module
*/
#pragma once

#include <MyGUI.h>

#include "../Utility.h"
#include "../BaseWidget.h"

#include "MyGUI_Managed_MarshalingWidget.h"
#include "MyGUI_Managed_IncludeWidgets.h"

namespace MyGUI
{
	namespace Managed
	{

		public ref class GuiFactory abstract
		{

		protected:
			GuiFactory() { }

			Widget^ CreateWidget(BaseWidget^ _parent, MyGUI::WidgetStyle _style, const std::string& _type, const std::string& _skin, const MyGUI::IntCoord& _coord, MyGUI::Align _align, const std::string& _layer, const std::string& _name)
			{
				std::string type = _type;
				if (type == "Sheet") type = "TabItem";
				return (Widget^)mCreators[ string_utility::utf8_to_managed(type) ] ( _parent, _style, _skin, _coord, _align, _layer, _name );
			}

		private:
			delegate BaseWidget^ HandleCreator(BaseWidget^ _parent, MyGUI::WidgetStyle _style, const std::string& _skin, const MyGUI::IntCoord& _coord, MyGUI::Align _align, const std::string& _layer, const std::string& _name);
			static System::Collections::Generic::Dictionary<System::String^, HandleCreator^>^ mCreators = gcnew System::Collections::Generic::Dictionary<System::String^, HandleCreator^>();

			static GuiFactory()
			{

				//InsertPoint

			}

		};

	} // namespace Managed
} // namespace MyGUI
