Code

a432b68db652cd4ba594b6e1b75be9062b931c79
[inkscape.git] / src / ui / tool / selectable-control-point.h
1 /** @file
2  * Desktop-bound selectable control object
3  */
4 /* Authors:
5  *   Krzysztof KosiƄski <tweenk.pl@gmail.com>
6  *
7  * Copyright (C) 2009 Authors
8  * Released under GNU GPL, read the file 'COPYING' for more information
9  */
11 #ifndef SEEN_UI_TOOL_SELECTABLE_CONTROL_POINT_H
12 #define SEEN_UI_TOOL_SELECTABLE_CONTROL_POINT_H
14 #include <boost/enable_shared_from_this.hpp>
15 #include "ui/tool/control-point.h"
17 namespace Inkscape {
18 namespace UI {
20 class ControlPointSelection;
22 class SelectableControlPoint : public ControlPoint {
23 public:
24     struct ColorSet {
25         ControlPoint::ColorSet cpset;
26         ColorEntry selected_normal;
27         ColorEntry selected_mouseover;
28         ColorEntry selected_clicked;
29     };
31     ~SelectableControlPoint();
32     bool selected() const;
33     void updateState() const { const_cast<SelectableControlPoint*>(this)->_setState(_state); }
34     virtual Geom::Rect bounds() {
35         return Geom::Rect(position(), position());
36     }
37 protected:
38     SelectableControlPoint(SPDesktop *d, Geom::Point const &initial_pos,
39         Gtk::AnchorType anchor, SPCtrlShapeType shape,
40         unsigned int size, ControlPointSelection &sel, ColorSet *cset = 0,
41         SPCanvasGroup *group = 0);
42     SelectableControlPoint(SPDesktop *d, Geom::Point const &initial_pos,
43         Gtk::AnchorType anchor, Glib::RefPtr<Gdk::Pixbuf> pixbuf,
44         ControlPointSelection &sel, ColorSet *cset = 0, SPCanvasGroup *group = 0);
46     virtual void _setState(State state);
47 private:
48     void _connectHandlers();
49     void _takeSelection();
50     
51     bool _clickedHandler(GdkEventButton *);
52     void _grabbedHandler(GdkEventMotion *);
53     
54     ControlPointSelection &_selection;
55 };
57 } // namespace UI
58 } // namespace Inkscape
60 #endif
62 /*
63   Local Variables:
64   mode:c++
65   c-file-style:"stroustrup"
66   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
67   indent-tabs-mode:nil
68   fill-column:99
69   End:
70 */
71 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :