Blame c++/vector/activearea.h

Ivan Mahonin 2fb9fd
#ifndef ACTIVEAREA_H
Ivan Mahonin 2fb9fd
#define ACTIVEAREA_H
Ivan Mahonin 2fb9fd
Ivan Mahonin 2fb9fd
Ivan Mahonin 2fb9fd
#include <list>
Ivan Mahonin 2fb9fd
Ivan Mahonin 2fb9fd
#include <gtkmm/drawingarea.h>
Ivan Mahonin 2fb9fd
Ivan Mahonin 2fb9fd
#include "activepoint.h"
Ivan Mahonin 2fb9fd
#include "context.h"
Ivan Mahonin 2fb9fd
Ivan Mahonin 2fb9fd
Ivan Mahonin 2fb9fd
class ActiveArea: public Gtk::DrawingArea {
Ivan Mahonin 2fb9fd
public:
Ivan Mahonin 2fb9fd
	typedef std::list<ActivePoint::Handle> PointList;
Ivan Mahonin 2fb9fd
Ivan Mahonin 2fb9fd
private:
Ivan Mahonin 2fb9fd
	PointList points;
Ivan Mahonin 2fb9fd
	ActivePoint::Handle hover_point;
Ivan Mahonin 2fb9fd
	ActivePoint::Handle drag_point;
Ivan Mahonin 2fb9fd
	Vector drag_offset;
Ivan Mahonin 2fb9fd
Ivan Mahonin 145120
public:
Ivan Mahonin 145120
	ActiveArea();
Ivan Mahonin 145120
Ivan Mahonin 2fb9fd
	const PointList& get_points() const { return points; }
Ivan Mahonin 2fb9fd
	bool is_point_added(const ActivePoint::Handle &point) const;
Ivan Mahonin 2fb9fd
	void add_point(const ActivePoint::Handle &point);
Ivan Mahonin 2fb9fd
	void remove_point(const ActivePoint::Handle &point);
Ivan Mahonin 2fb9fd
	void bring_to_front(const ActivePoint::Handle &point);
Ivan Mahonin 2fb9fd
Ivan Mahonin 2fb9fd
	ActivePoint::Handle get_point_at(const Vector &position) const;
Ivan Mahonin 2fb9fd
Ivan Mahonin 145120
protected:
Ivan Mahonin 6b4ca4
	virtual void on_point_move(const ActivePoint::Handle &point, const Vector &oldposition, const Vector &newposition);
Ivan Mahonin 2fb9fd
	virtual void on_draw(const Context &context);
Ivan Mahonin 2fb9fd
	virtual void on_draw_content(const Context &context);
Ivan Mahonin 2fb9fd
Ivan Mahonin 2fb9fd
	bool on_draw(const Cairo::RefPtr<Cairo::Context> &context) override;
Ivan Mahonin 2fb9fd
	bool on_button_press_event(GdkEventButton* event) override;
Ivan Mahonin 2fb9fd
	bool on_button_release_event(GdkEventButton* event) override;
Ivan Mahonin 2fb9fd
	bool on_motion_notify_event(GdkEventMotion* event) override;
Ivan Mahonin 2fb9fd
};
Ivan Mahonin 2fb9fd
Ivan Mahonin 2fb9fd
Ivan Mahonin 2fb9fd
#endif