Code

Split SPCanvasItem and SPCanvasGroup to individual .h files. Removed forward header.
[inkscape.git] / src / ui / tool / transform-handle-set.h
1 /** @file
2  * Affine transform handles component
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_TRANSFORM_HANDLE_SET_H
12 #define SEEN_UI_TOOL_TRANSFORM_HANDLE_SET_H
14 #include <memory>
15 #include <gdk/gdk.h>
16 #include <2geom/forward.h>
17 #include "ui/tool/commit-events.h"
18 #include "ui/tool/manipulator.h"
20 class SPDesktop;
21 class CtrlRect;
22 namespace Inkscape {
23 namespace UI {
25 //class TransformHandle;
26 class RotateHandle;
27 class SkewHandle;
28 class ScaleCornerHandle;
29 class ScaleSideHandle;
30 class RotationCenter;
32 class TransformHandleSet : public Manipulator {
33 public:
34     enum Mode {
35         MODE_SCALE,
36         MODE_ROTATE_SKEW
37     };
39     TransformHandleSet(SPDesktop *d, SPCanvasGroup *th_group);
40     virtual ~TransformHandleSet();
41     virtual bool event(GdkEvent *);
43     bool visible() { return _visible; }
44     Mode mode() { return _mode; }
45     Geom::Rect bounds();
46     void setVisible(bool v);
47     void setMode(Mode);
48     void setBounds(Geom::Rect const &, bool preserve_center = false);
50     bool transforming() { return _in_transform; }
51     ControlPoint &rotationCenter();
53     sigc::signal<void, Geom::Matrix const &> signal_transform;
54     sigc::signal<void, CommitEvent> signal_commit;
55 private:
56     void _emitTransform(Geom::Matrix const &);
57     void _setActiveHandle(ControlPoint *h);
58     void _clearActiveHandle();
59     void _updateVisibility(bool v);
60     union {
61         ControlPoint *_handles[17];
62         struct {
63             ScaleCornerHandle *_scale_corners[4];
64             ScaleSideHandle *_scale_sides[4];
65             RotateHandle *_rot_corners[4];
66             SkewHandle *_skew_sides[4];
67             RotationCenter *_center;
68         };
69     };
70     ControlPoint *_active;
71     SPCanvasGroup *_transform_handle_group;
72     CtrlRect *_trans_outline;
73     Mode _mode;
74     bool _in_transform;
75     bool _visible;
76     bool _rot_center_visible;
77     friend class TransformHandle;
78     friend class RotationCenter;
79 };
81 } // namespace UI
82 } // namespace Inkscape
84 #endif
86 /*
87   Local Variables:
88   mode:c++
89   c-file-style:"stroustrup"
90   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
91   indent-tabs-mode:nil
92   fill-column:99
93   End:
94 */
95 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :