FlowCanvas  0.7.1
Ellipse.hpp
Go to the documentation of this file.
1 /* This file is part of FlowCanvas.
2  * Copyright (C) 2007-2009 David Robillard <http://drobilla.net>
3  *
4  * FlowCanvas is free software; you can redistribute it and/or modify it under the
5  * terms of the GNU General Public License as published by the Free Software
6  * Foundation; either version 2 of the License, or (at your option) any later
7  * version.
8  *
9  * FlowCanvas is distributed in the hope that it will be useful, but WITHOUT ANY
10  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
16  */
17 
18 #ifndef FLOWCANVAS_ELLIPSE_HPP
19 #define FLOWCANVAS_ELLIPSE_HPP
20 
21 #include <string>
22 #include <map>
23 #include <algorithm>
24 #include <boost/shared_ptr.hpp>
25 #include <libgnomecanvasmm.h>
27 #include "flowcanvas/Item.hpp"
28 
29 namespace FlowCanvas {
30 
31 class Canvas;
32 
33 
41 class Ellipse : public Item, public Connectable
42 {
43 public:
44  Ellipse(boost::shared_ptr<Canvas> canvas,
45  const std::string& name,
46  double x,
47  double y,
48  double x_radius,
49  double y_radius,
50  bool show_title = true);
51 
52  virtual ~Ellipse();
53 
54  Gnome::Art::Point src_connection_point() {
55  return Gnome::Art::Point(property_x(), property_y());
56  }
57 
58  virtual Gnome::Art::Point dst_connection_point(const Gnome::Art::Point& src);
59  virtual Gnome::Art::Point connection_point_vector(double dx, double dy);
60 
61  void add_connection(boost::shared_ptr<Connection> c);
62 
63  bool point_is_within(double x, double y);
64 
65  void zoom(double z);
66  void resize();
67 
68  virtual void move(double dx, double dy);
69  virtual void move_to(double x, double y);
70 
71  virtual void load_location() {}
72  virtual void store_location() {}
73 
74  virtual void set_name(const std::string& n);
75 
76  void set_width(double w);
77 
78  void set_height(double h);
79 
80  double border_width() const { return _border_width; }
81  void set_border_width(double w);
82 
83  void select_tick();
84  void set_selected(bool b);
85 
86  void set_highlighted(bool b);
87  void set_border_color(uint32_t c);
88  void set_base_color(uint32_t c);
90 
91 protected:
92  bool is_within(const Gnome::Canvas::Rect& rect);
93 
94  double _border_width;
96 
97  Gnome::Canvas::Ellipse _ellipse;
98  Gnome::Canvas::Text* _label;
99 };
100 
101 
102 } // namespace FlowCanvas
103 
104 #endif // FLOWCANVAS_ELLIPSE_HPP
An object a Connection can connect to.
Definition: Connectable.hpp:32
A (possibly named) circular Item which is Connectable.
Definition: Ellipse.hpp:42
bool is_within(const Gnome::Canvas::Rect &rect)
Gnome::Canvas::Text * _label
Definition: Ellipse.hpp:98
void set_selected(bool b)
void set_base_color(uint32_t c)
void zoom(double z)
double border_width() const
Definition: Ellipse.hpp:80
virtual void store_location()
Definition: Ellipse.hpp:72
virtual void move(double dx, double dy)
void set_width(double w)
virtual void load_location()
Definition: Ellipse.hpp:71
void set_height(double h)
virtual void move_to(double x, double y)
void set_border_color(uint32_t c)
double _border_width
Definition: Ellipse.hpp:94
virtual Gnome::Art::Point connection_point_vector(double dx, double dy)
Gnome::Canvas::Ellipse _ellipse
Definition: Ellipse.hpp:97
Gnome::Art::Point src_connection_point()
Definition: Ellipse.hpp:54
virtual Gnome::Art::Point dst_connection_point(const Gnome::Art::Point &src)
void add_connection(boost::shared_ptr< Connection > c)
void set_default_base_color()
virtual void set_name(const std::string &n)
void set_border_width(double w)
bool _title_visible
Definition: Ellipse.hpp:95
bool point_is_within(double x, double y)
Ellipse(boost::shared_ptr< Canvas > canvas, const std::string &name, double x, double y, double x_radius, double y_radius, bool show_title=true)
void set_highlighted(bool b)
An item on a Canvas.
Definition: Item.hpp:44
boost::weak_ptr< Canvas > canvas() const
Definition: Item.hpp:64
const std::string & name() const
Definition: Item.hpp:93
FlowCanvas namespace, everything is defined under this.
Definition: Canvas.hpp:38