/* This file is part of Machina. * Copyright 2007-2011 David Robillard * * Machina is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Machina is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Machina. If not, see . */ #ifndef MACHINA_CANVAS_HPP_HPP #define MACHINA_CANVAS_HPP_HPP #include #include "ganv/Canvas.hpp" #include "machina/types.hpp" using namespace Ganv; namespace machina { namespace client { class ClientObject; } namespace gui { class MachinaGUI; class NodeView; class MachinaCanvas : public Canvas { public: MachinaCanvas(MachinaGUI* app, int width, int height); void on_new_object(SPtr object); void on_erase_object(SPtr object); MachinaGUI* app() { return _app; } protected: bool on_event(GdkEvent* event); bool node_clicked(NodeView* node, GdkEventButton* ev); private: void action_create_node(double x, double y); void action_connect(NodeView* tail, NodeView* head); void action_disconnect(NodeView* tail, NodeView* head); MachinaGUI* _app; NodeView* _last_clicked; }; } // namespace machina } // namespace gui #endif // MACHINA_CANVAS_HPP_HPP