Inkscape
Vector Graphics Editor
style-subject.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
11/*
12 * Copyright (C) 2007 MenTaLguY <mental@rydia.net>
13 *
14 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
15 */
16#ifndef SEEN_INKSCAPE_UI_WIDGET_STYLE_SUBJECT_H
17#define SEEN_INKSCAPE_UI_WIDGET_STYLE_SUBJECT_H
18
19#include <optional>
20#include <2geom/rect.h>
21#include <cstddef>
22#include <sigc++/sigc++.h>
23
24#include "object/sp-item.h"
25#include "object/sp-tag.h"
26#include "object/sp-tag-use.h"
28
29class SPDesktop;
30class SPObject;
31class SPCSSAttr;
32class SPStyle;
33
34namespace Inkscape {
35class Selection;
36}
37
38namespace Inkscape {
39namespace UI {
40namespace Widget {
41
43public:
44 class Selection;
45 class CurrentLayer;
46
47
49 virtual ~StyleSubject();
50
51 void setDesktop(SPDesktop *desktop);
52 SPDesktop *getDesktop() const { return _desktop; }
53
55 virtual int queryStyle(SPStyle *query, int property) = 0;
56 virtual void setCSS(SPCSSAttr *css) = 0;
57 virtual std::vector<SPObject*> list(){return std::vector<SPObject*>();};
58
59 sigc::connection connectChanged(sigc::signal<void ()>::slot_type slot) {
60 return _changed_signal.connect(slot);
61 }
62
63protected:
64 virtual void _afterDesktopSwitch(SPDesktop */*desktop*/) {}
65 void _emitChanged() { _changed_signal.emit(); }
66 void _emitModified(Inkscape::Selection* selection, guint flags) {
67 // Do not say this object has styles unless it's style has been modified
68 if (flags & (SP_OBJECT_STYLE_MODIFIED_FLAG)) {
70 }
71 }
72
73private:
74 sigc::signal<void ()> _changed_signal;
75 SPDesktop *_desktop = nullptr;
76};
77
79public:
81 ~Selection() override;
82
84 int queryStyle(SPStyle *query, int property) override;
85 void setCSS(SPCSSAttr *css) override;
86 std::vector<SPObject*> list() override;
87
88protected:
89 void _afterDesktopSwitch(SPDesktop *desktop) override;
90
91private:
93
94 sigc::connection _sel_changed;
95 sigc::connection _subsel_changed;
96 sigc::connection _sel_modified;
97};
98
99}
100}
101}
102
103#endif // SEEN_INKSCAPE_UI_WIDGET_STYLE_SUBJECT_H
104
105/*
106 Local Variables:
107 mode:c++
108 c-file-style:"stroustrup"
109 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
110 indent-tabs-mode:nil
111 fill-column:99
112 End:
113*/
114// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
Axis-aligned rectangle that can be empty.
Definition: rect.h:180
The set of selected SPObjects for a given document and layer model.
Definition: selection.h:55
int queryStyle(SPStyle *query, int property) override
std::vector< SPObject * > list() override
Geom::OptRect getBounds(SPItem::BBoxType type) override
Inkscape::Selection * _getSelection() const
void _afterDesktopSwitch(SPDesktop *desktop) override
void _emitModified(Inkscape::Selection *selection, guint flags)
Definition: style-subject.h:66
sigc::signal< void()> _changed_signal
Definition: style-subject.h:74
virtual std::vector< SPObject * > list()
Definition: style-subject.h:57
virtual Geom::OptRect getBounds(SPItem::BBoxType type)=0
virtual void setCSS(SPCSSAttr *css)=0
virtual void _afterDesktopSwitch(SPDesktop *)
Definition: style-subject.h:64
virtual int queryStyle(SPStyle *query, int property)=0
void setDesktop(SPDesktop *desktop)
sigc::connection connectChanged(sigc::signal< void()>::slot_type slot)
Definition: style-subject.h:59
To do: update description of desktop.
Definition: desktop.h:150
BBoxType
Definition: sp-item.h:110
SPObject is an abstract base class of all of the document nodes at the SVG document level.
Definition: sp-object.h:146
An SVG style object.
Definition: style.h:45
std::shared_ptr< Css const > css
CMYK to sRGB conversion routines.
Axis-aligned rectangle.
Some things pertinent to all visible shapes: SPItem, SPItemView, SPItemCtx.
SVG <inkscape:tag> implementation.