#pragma once
#include "Device.h"

#ifdef GUI_GTK

namespace gui {

	/**
	 * Generic Cairo device. Used to coordinate ID creation for the 2D part (i.e. one ID for the
	 * entire system).
	 *
	 * We inherit from GLDevice to allow OpenGL-based 3D rendering, but override the 2D rendering
	 * part entirely.
	 */
	class CairoDevice : public GLDevice {
	public:
		// Create.
		CairoDevice(Engine &e);

		// Create a text manager.
		virtual TextMgr *createTextMgr();

		// Override the createSurface and pass 2D surfaces on to 'createCairoSurface'.
		virtual Surface *createSurface(Handle window, SurfaceType type);

	protected:
		// Create a cairo surface.
		virtual Surface *createCairoSurface(Handle window) = 0;

		// Override so we're not abstract.
		virtual Surface2D *createSurface2D(GtkWidget *widget, Context *context);

		// Get the ID.
		Nat id();

	private:
		// Our ID.
		Nat myId;
	};

	/**
	 * Cairo software device.
	 */
	class CairoSwDevice : public CairoDevice {
	public:
		// Create.
		CairoSwDevice(Engine &e);

	protected:
		// Create a surface.
		virtual Surface *createCairoSurface(Handle window);
	};


	/**
	 * Cairo device that uses whatever Gtk+ suggests (Usually an XLib surface).
	 */
	class CairoGtkDevice : public CairoDevice {
	public:
		// Create.
		CairoGtkDevice(Engine &e);

	protected:
		// Create a surface.
		virtual Surface *createCairoSurface(Handle window);
	};


}

#endif
