Blame c++/perspective/src/view.h

fdabb2
#ifndef VIEW_H
fdabb2
#define VIEW_H
fdabb2
fdabb2
fdabb2
#include <vector></vector>
fdabb2
fdabb2
#include <gtkmm drawingarea.h=""></gtkmm>
fdabb2
fdabb2
#include "common.h"
fdabb2
#include "surface.h"
fdabb2
#include "matrix.h"
fdabb2
fdabb2
fdabb2
class View: public Gtk::DrawingArea {
fdabb2
public:
fdabb2
	class Point: public Shared {
fdabb2
	public:
fdabb2
		Vector2 position;
fdabb2
		Real radius;
fdabb2
		Color color;
fdabb2
		bool selected;
fdabb2
		
fdabb2
		Point(): radius(5.0), color(1, 1, 0, 1), selected() { }
fdabb2
		
fdabb2
		sigc::signal<void> signal_motion;</void>
fdabb2
		sigc::signal<void> signal_changed;</void>
fdabb2
		
fdabb2
		void motion() { signal_motion(); }
fdabb2
		void changed() { motion(); signal_changed(); }
fdabb2
fdabb2
		virtual void draw(
fdabb2
			const Cairo::RefPtr<cairo::context>& context,</cairo::context>
fdabb2
			View &view );
fdabb2
	};
fdabb2
fdabb2
	class Layer: public Shared {
fdabb2
	public:
fdabb2
		virtual void draw(
fdabb2
			const Cairo::RefPtr<cairo::context>& context,</cairo::context>
fdabb2
			View &view );
fdabb2
	};
fdabb2
	
fdabb2
	typedef RefPtr<point> PointPtr;</point>
fdabb2
	typedef RefPtr<layer> LayerPtr;</layer>
fdabb2
	typedef std::vector<pointptr> PointList;</pointptr>
fdabb2
	typedef std::vector<layerptr> LayerList;</layerptr>
fdabb2
fdabb2
public:
fdabb2
	Matrix transform;
fdabb2
	
fdabb2
	LayerList layers;
fdabb2
	PointList own_points;
fdabb2
	PointList foreign_points;
fdabb2
fdabb2
private:
fdabb2
	bool dragging;
fdabb2
	PointPtr selected_point;
fdabb2
	Vector2 selected_point_offset;
fdabb2
fdabb2
public:
fdabb2
	View();
fdabb2
	virtual ~View();
fdabb2
	
fdabb2
protected:
fdabb2
	bool on_draw(const Cairo::RefPtr<cairo::context>& context) override;</cairo::context>
fdabb2
	bool on_motion_notify_event(GdkEventMotion *event) override;
fdabb2
	bool on_button_press_event(GdkEventButton *event) override;
fdabb2
	bool on_button_release_event(GdkEventButton *event) override;
fdabb2
};
fdabb2
fdabb2
fdabb2
#endif