208593e3fc2cb36eb160e2e1592864d88760fad6
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 ControlPointSelection &_selection;
49 private:
50 void _connectHandlers();
51 void _takeSelection();
53 void _grabbedHandler();
54 void _draggedHandler(Geom::Point const &, Geom::Point &, GdkEventMotion *);
55 void _ungrabbedHandler();
56 bool _clickedHandler(GdkEventButton *);
57 };
59 } // namespace UI
60 } // namespace Inkscape
62 #endif
64 /*
65 Local Variables:
66 mode:c++
67 c-file-style:"stroustrup"
68 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
69 indent-tabs-mode:nil
70 fill-column:99
71 End:
72 */
73 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :