1 #ifndef __RUBBERBAND_H__
2 #define __RUBBERBAND_H__
4 /**
5 * \file src/rubberband.h
6 * \brief Rubberbanding selector
7 *
8 * Authors:
9 * Lauris Kaplinski <lauris@kaplinski.com>
10 * Carl Hetherington <inkscape@carlh.net>
11 *
12 * Copyright (C) 1999-2002 Lauris Kaplinski
13 *
14 * Released under GNU GPL, read the file 'COPYING' for more information
15 */
17 #include "forward.h"
18 #include <boost/optional.hpp>
19 #include <vector>
20 #include <2geom/point.h>
21 #include <2geom/rect.h>
23 /* fixme: do multidocument safe */
25 class CtrlRect;
26 class SPCanvasItem;
27 class SPCurve;
29 enum {
30 RUBBERBAND_MODE_RECT,
31 RUBBERBAND_MODE_TOUCHPATH
32 };
34 namespace Inkscape
35 {
37 class Rubberband
38 {
39 public:
41 void start(SPDesktop *desktop, Geom::Point const &p);
42 void move(Geom::Point const &p);
43 Geom::OptRect getRectangle() const;
44 void stop();
45 bool is_started();
47 inline int getMode() {return _mode;}
48 inline std::vector<Geom::Point> getPoints() {return _points;}
50 void setMode(int mode);
52 static Rubberband* get(SPDesktop *desktop);
54 private:
56 Rubberband(SPDesktop *desktop);
57 static Rubberband* _instance;
59 SPDesktop *_desktop;
60 Geom::Point _start;
61 Geom::Point _end;
63 std::vector<Geom::Point> _points;
65 CtrlRect *_rect;
66 SPCanvasItem *_touchpath;
67 SPCurve *_touchpath_curve;
69 void delete_canvas_items();
71 bool _started;
72 int _mode;
73 };
75 }
77 #endif
79 /*
80 Local Variables:
81 mode:c++
82 c-file-style:"stroustrup"
83 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
84 indent-tabs-mode:nil
85 fill-column:99
86 End:
87 */
88 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :