Code

Reduce libsigc++ usage to partially fix performance regressions
[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);
48     virtual void dragged(Geom::Point &, GdkEventMotion *);
49     virtual bool grabbed(GdkEventMotion *);
50     virtual void ungrabbed(GdkEventButton *);
51     virtual bool clicked(GdkEventButton *);
53     ControlPointSelection &_selection;
54 private:
55     void _takeSelection();
56 };
58 } // namespace UI
59 } // namespace Inkscape
61 #endif
63 /*
64   Local Variables:
65   mode:c++
66   c-file-style:"stroustrup"
67   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
68   indent-tabs-mode:nil
69   fill-column:99
70   End:
71 */
72 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :