• Main Page
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List

flowcanvas/Ellipse.hpp

Go to the documentation of this file.
00001 /* This file is part of FlowCanvas.
00002  * Copyright (C) 2007-2009 David Robillard <http://drobilla.net>
00003  *
00004  * FlowCanvas is free software; you can redistribute it and/or modify it under the
00005  * terms of the GNU General Public License as published by the Free Software
00006  * Foundation; either version 2 of the License, or (at your option) any later
00007  * version.
00008  *
00009  * FlowCanvas is distributed in the hope that it will be useful, but WITHOUT ANY
00010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for details.
00012  *
00013  * You should have received a copy of the GNU General Public License along
00014  * with this program; if not, write to the Free Software Foundation, Inc.,
00015  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
00016  */
00017 
00018 #ifndef FLOWCANVAS_ELLIPSE_HPP
00019 #define FLOWCANVAS_ELLIPSE_HPP
00020 
00021 #include <string>
00022 #include <map>
00023 #include <algorithm>
00024 #include <boost/shared_ptr.hpp>
00025 #include <libgnomecanvasmm.h>
00026 #include "flowcanvas/Connectable.hpp"
00027 #include "flowcanvas/Item.hpp"
00028 
00029 namespace FlowCanvas {
00030 
00031 class Canvas;
00032 
00033 
00041 class Ellipse : public Item, public Connectable
00042 {
00043 public:
00044     Ellipse(boost::shared_ptr<Canvas> canvas,
00045             const std::string&        name,
00046             double                    x,
00047             double                    y,
00048             double                    x_radius,
00049             double                    y_radius,
00050             bool                      show_title = true);
00051 
00052     virtual ~Ellipse();
00053 
00054     Gnome::Art::Point src_connection_point() {
00055         return Gnome::Art::Point(property_x(), property_y());
00056     }
00057 
00058     virtual Gnome::Art::Point dst_connection_point(const Gnome::Art::Point& src);
00059     virtual Gnome::Art::Point connection_point_vector(double dx, double dy);
00060 
00061     void add_connection(boost::shared_ptr<Connection> c);
00062 
00063     bool point_is_within(double x, double y);
00064 
00065     void zoom(double z);
00066     void resize();
00067 
00068     virtual void move(double dx, double dy);
00069     virtual void move_to(double x, double y);
00070 
00071     virtual void load_location()  {}
00072     virtual void store_location() {}
00073 
00074     virtual void set_name(const std::string& n);
00075 
00076     void set_width(double w);
00077 
00078     void set_height(double h);
00079 
00080     double border_width() const { return _border_width; }
00081     void   set_border_width(double w);
00082 
00083     void select_tick();
00084     void set_selected(bool b);
00085 
00086     void set_highlighted(bool b);
00087     void set_border_color(uint32_t c);
00088     void set_base_color(uint32_t c);
00089     void set_default_base_color();
00090 
00091 protected:
00092     bool is_within(const Gnome::Canvas::Rect& rect);
00093 
00094     double _border_width;
00095     bool   _title_visible;
00096 
00097     Gnome::Canvas::Ellipse _ellipse;
00098     Gnome::Canvas::Text*   _label;
00099 };
00100 
00101 
00102 } // namespace FlowCanvas
00103 
00104 #endif // FLOWCANVAS_ELLIPSE_HPP

Generated on Tue Jan 11 2011 19:26:04 for FlowCanvas by  doxygen 1.7.1