summaryrefslogtreecommitdiffstats
path: root/src/ui/tool/selectable-control-point.h
blob: 919988a754f5ad4f7d9df1eb493c9787c23761fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// SPDX-License-Identifier: GPL-2.0-or-later
/* Authors:
 *   Krzysztof Kosiński <tweenk.pl@gmail.com>
 *   Jon A. Cruz <jon@joncruz.org>
 *
 * Copyright (C) 2009 Authors
 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
 */

#ifndef SEEN_UI_TOOL_SELECTABLE_CONTROL_POINT_H
#define SEEN_UI_TOOL_SELECTABLE_CONTROL_POINT_H

#include "ui/tool/control-point.h"

namespace Inkscape {
namespace UI {

class ControlPointSelection;

/**
 * Desktop-bound selectable control object.
 */
class SelectableControlPoint : public ControlPoint {
public:

    ~SelectableControlPoint() override;
    bool selected() const;
    void updateState() { _setState(_state); }
    virtual Geom::Rect bounds() const {
        return Geom::Rect(position(), position());
    }
    virtual void select(bool toselect);
    friend class NodeList;


protected:

    SelectableControlPoint(SPDesktop *d, Geom::Point const &initial_pos, SPAnchorType anchor,
                           Inkscape::ControlType type,
                           ControlPointSelection &sel,
                           ColorSet const &cset = _default_scp_color_set, SPCanvasGroup *group = nullptr);

    SelectableControlPoint(SPDesktop *d, Geom::Point const &initial_pos, SPAnchorType anchor,
                           Glib::RefPtr<Gdk::Pixbuf> pixbuf,
                           ControlPointSelection &sel,
                           ColorSet const &cset = _default_scp_color_set, SPCanvasGroup *group = nullptr);

    void _setState(State state) override;

    void dragged(Geom::Point &new_pos, GdkEventMotion *event) override;
    bool grabbed(GdkEventMotion *event) override;
    void ungrabbed(GdkEventButton *event) override;
    bool clicked(GdkEventButton *event) override;

    ControlPointSelection &_selection;

private:

    void _takeSelection();

    static ColorSet _default_scp_color_set;
};

} // namespace UI
} // namespace Inkscape

#endif

/*
  Local Variables:
  mode:c++
  c-file-style:"stroustrup"
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
  indent-tabs-mode:nil
  fill-column:99
  End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :