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
FlowCanvas::Ellipse::connection_point_vector
virtual Gnome::Art::Point connection_point_vector(double dx, double dy)
FlowCanvas::Ellipse::Ellipse
Ellipse(boost::shared_ptr< Canvas > canvas, const std::string &name, double x, double y, double x_radius, double y_radius, bool show_title=true)
FlowCanvas::Ellipse::load_location
virtual void load_location()
Definition: Ellipse.hpp:71
FlowCanvas::Ellipse::src_connection_point
Gnome::Art::Point src_connection_point()
Definition: Ellipse.hpp:54
FlowCanvas::Ellipse::add_connection
void add_connection(boost::shared_ptr< Connection > c)
FlowCanvas::Ellipse::_title_visible
bool _title_visible
Definition: Ellipse.hpp:95
Connectable.hpp
FlowCanvas::Ellipse::point_is_within
bool point_is_within(double x, double y)
FlowCanvas::Ellipse::dst_connection_point
virtual Gnome::Art::Point dst_connection_point(const Gnome::Art::Point &src)
FlowCanvas::Ellipse::set_name
virtual void set_name(const std::string &n)
FlowCanvas::Ellipse::move_to
virtual void move_to(double x, double y)
FlowCanvas::Ellipse::border_width
double border_width() const
Definition: Ellipse.hpp:80
FlowCanvas::Ellipse::set_border_color
void set_border_color(uint32_t c)
FlowCanvas::Ellipse::move
virtual void move(double dx, double dy)
FlowCanvas::Ellipse::is_within
bool is_within(const Gnome::Canvas::Rect &rect)
FlowCanvas::Item::name
const std::string & name() const
Definition: Item.hpp:93
FlowCanvas::Ellipse::_border_width
double _border_width
Definition: Ellipse.hpp:94
FlowCanvas::Item
An item on a Canvas.
Definition: Item.hpp:44
FlowCanvas::Ellipse::zoom
void zoom(double z)
FlowCanvas::Ellipse::_label
Gnome::Canvas::Text * _label
Definition: Ellipse.hpp:98
FlowCanvas::Ellipse::select_tick
void select_tick()
FlowCanvas::Connectable
An object a Connection can connect to.
Definition: Connectable.hpp:32
FlowCanvas::Ellipse
A (possibly named) circular Item which is Connectable.
Definition: Ellipse.hpp:42
FlowCanvas::Ellipse::set_height
void set_height(double h)
FlowCanvas::Ellipse::~Ellipse
virtual ~Ellipse()
FlowCanvas::Ellipse::set_width
void set_width(double w)
FlowCanvas::Ellipse::set_selected
void set_selected(bool b)
FlowCanvas::Ellipse::set_default_base_color
void set_default_base_color()
FlowCanvas::Ellipse::resize
void resize()
FlowCanvas
FlowCanvas namespace, everything is defined under this.
Definition: Canvas.hpp:38
FlowCanvas::Ellipse::set_border_width
void set_border_width(double w)
FlowCanvas::Ellipse::set_base_color
void set_base_color(uint32_t c)
FlowCanvas::Ellipse::store_location
virtual void store_location()
Definition: Ellipse.hpp:72
FlowCanvas::Ellipse::_ellipse
Gnome::Canvas::Ellipse _ellipse
Definition: Ellipse.hpp:97
Item.hpp
FlowCanvas::Ellipse::set_highlighted
void set_highlighted(bool b)
FlowCanvas::Item::canvas
boost::weak_ptr< Canvas > canvas() const
Definition: Item.hpp:64