#ifndef INCLUDED_PANELS_PANEL
#define INCLUDED_PANELS_PANEL

#include "PositionHandler.h"
#include "SizeHandler.h"
#include "VisibilityHandler.h"

#include <memory>
#include <functional>

//////////////////////////////////////////////////////////////
namespace Dubious {
namespace Panels {

class Panel;
typedef std::shared_ptr<Panel> PanelPtr;
typedef std::vector<PanelPtr> PanelPtrVector;

class Panel
	: public PositionHandler
	, public SizeHandler
	, public VisibilityHandler
{
public:
	static PanelPtr Create();
	static PanelPtr Create( PanelPtr pParent );

	~Panel();

	void				Draw();
	std::function<void ()>& OnDraw() { return m_OnDraw; }

	bool				Contains( const Math::Point& P ) const;
	const PanelPtrVector& Children() const { return m_Children; }

private:
	Panel();
	Panel( PanelPtr pParent );
	Panel( const Panel& );
	Panel& operator=( const Panel& );

	std::function<void ()> m_OnDraw;

	PanelPtrVector		m_Children;
};

}
}

#endif
