Inkscape
Vector Graphics Editor
style-swatch.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
5/* Authors:
6 * buliabyak@gmail.com
7 * Krzysztof KosiƄski <tweenk.pl@gmail.com>
8 *
9 * Copyright (C) 2005-2008 Authors
10 *
11 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
12 */
13
14#ifndef SEEN_INKSCAPE_UI_STYLE_SWATCH_H
15#define SEEN_INKSCAPE_UI_STYLE_SWATCH_H
16
17#include <memory>
18#include <gtkmm/box.h>
19#include <gtkmm/gesture.h> // Gtk::EventSequenceState
20#include <gtkmm/label.h>
21
22#include "desktop.h"
23#include "preferences.h"
24
25class SPStyle;
26class SPCSSAttr;
27
28namespace Gtk {
29class GestureClick;
30class Grid;
31} // namespace Gtk
32
33namespace Inkscape {
34
35namespace Util {
36class Unit;
37} // namespace Util
38
39namespace UI::Widget {
40
41class ColorPreview;
42
43class StyleSwatch : public Gtk::Box
44{
45public:
46 StyleSwatch (SPCSSAttr *attr, gchar const *main_tip, Gtk::Orientation orient = Gtk::Orientation::VERTICAL);
47 ~StyleSwatch() override;
48
49 void setStyle(SPStyle *style);
50 void setStyle(SPCSSAttr *attr);
52
53 void setWatchedTool (const char *path, bool synthesize);
54 void setToolName(const Glib::ustring& tool_name);
55 void setDesktop(SPDesktop *desktop);
56
57private:
58 Gtk::EventSequenceState on_click(Gtk::GestureClick const &click,
59 int n_press, double x, double y);
60
62
64 Glib::ustring _tool_name;
66 std::unique_ptr<PrefObs> _tool_obs;
67 std::unique_ptr<PrefObs> _style_obs;
68 Glib::ustring _tool_path;
69 Gtk::Grid *_table;
70 Gtk::Label _label[2];
71 Gtk::Box _empty_space;
72 Gtk::Label _value[2];
73 Gtk::Box _place[2];
74 Gtk::Label _opacity_value;
75 std::unique_ptr<ColorPreview> _color_preview[2];
76 Glib::ustring _color[2];
77 Gtk::Box _stroke;
78 Gtk::Label _stroke_width;
80
81 friend void tool_obs_callback(StyleSwatch &, Preferences::Entry const &);
82};
83
84} // namespace UI::Widget
85
86} // namespace Inkscape
87
88#endif // SEEN_INKSCAPE_UI_STYLE_SWATCH_H
89
90/*
91 Local Variables:
92 mode:c++
93 c-file-style:"stroustrup"
94 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
95 indent-tabs-mode:nil
96 fill-column:99
97 End:
98*/
99// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
Data type representing a typeless value of a preference.
Definition: preferences.h:150
Callback-based preferences observer.
Definition: preferences.h:126
Gtk::EventSequenceState on_click(Gtk::GestureClick const &click, int n_press, double x, double y)
void setWatchedTool(const char *path, bool synthesize)
friend void tool_obs_callback(StyleSwatch &, Preferences::Entry const &)
Watches whether the tool uses the current style.
std::unique_ptr< ColorPreview > _color_preview[2]
Definition: style-swatch.h:75
void setDesktop(SPDesktop *desktop)
void setToolName(const Glib::ustring &tool_name)
std::unique_ptr< PrefObs > _style_obs
Definition: style-swatch.h:67
std::unique_ptr< PrefObs > _tool_obs
Definition: style-swatch.h:66
StyleSwatch(SPCSSAttr *attr, gchar const *main_tip, Gtk::Orientation orient=Gtk::Orientation::VERTICAL)
To do: update description of desktop.
Definition: desktop.h:150
An SVG style object.
Definition: style.h:45
Editable view implementation.
Definition: desktop.h:51
Miscellaneous supporting code.
Definition: color-conv.cpp:9
CMYK to sRGB conversion routines.
@ VERTICAL
The y-dimension (1).
Definition: rectangle.h:47
Singleton class to access the preferences file in a convenient way.
Glib::ustring const tool_name
Definition: toolbars.cpp:62