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 "libnr/nr-forward.h"
19 #include "libnr/nr-point.h"
20 #include "libnr/nr-maybe.h"
21 #include <vector>
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, NR::Point const &p);
42 void move(NR::Point const &p);
43 NR::Maybe<NR::Rect> getRectangle() const;
44 void stop();
45 bool is_started();
47 inline int getMode() {return _mode;}
48 inline std::vector<NR::Point> getPoints() {return _points;}
50 void setMode(int mode);
52 static Rubberband* get();
54 private:
56 Rubberband();
57 static Rubberband* _instance;
59 SPDesktop *_desktop;
60 NR::Point _start;
61 NR::Point _end;
63 std::vector<NR::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 :