/* 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 "raul/SharedPtr.hpp" #include "raul/WeakPtr.hpp" #include "ganv/Canvas.hpp" using namespace Ganv; class MachinaGUI; class NodeView; namespace Machina { namespace Client { class ClientObject; } } class MachinaCanvas : public Canvas { public: MachinaCanvas(MachinaGUI* app, int width, int height); //void build(SharedPtr machine, bool show_labels); //void update_edges(); void on_new_object(SharedPtr object); void on_erase_object(SharedPtr object); MachinaGUI* app() { return _app; } protected: bool on_event(GdkEvent* event); bool node_clicked(WeakPtr item, GdkEventButton* ev); private: //SharedPtr create_node_view(SharedPtr node); void action_create_node(double x, double y); void action_connect(SharedPtr port1, SharedPtr port2); void action_disconnect(SharedPtr port1, SharedPtr port2); MachinaGUI* _app; WeakPtr _last_clicked; }; #endif // MACHINA_CANVAS_HPP_HPP