1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /** @file 3 * @brief Static style swatch (fill, stroke, opacity) 4 */ 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 INKSCAPE_UI_CURRENT_STYLE_H 15 #define INKSCAPE_UI_CURRENT_STYLE_H 16 17 #include <gtkmm/box.h> 18 #include <gtkmm/label.h> 19 #include <gtkmm/eventbox.h> 20 #include <gtkmm/enums.h> 21 22 #include "desktop.h" 23 #include "preferences.h" 24 25 constexpr int STYLE_SWATCH_WIDTH = 135; 26 27 class SPStyle; 28 class SPCSSAttr; 29 30 namespace Gtk { 31 class Grid; 32 } 33 34 namespace Inkscape { 35 36 namespace Util { 37 class Unit; 38 } 39 40 namespace UI { 41 namespace Widget { 42 43 class StyleSwatch : public Gtk::Box 44 { 45 public: 46 StyleSwatch (SPCSSAttr *attr, gchar const *main_tip); 47 48 ~StyleSwatch() override; 49 50 void setStyle(SPStyle *style); 51 void setStyle(SPCSSAttr *attr); 52 SPCSSAttr *getStyle(); 53 54 void setWatchedTool (const char *path, bool synthesize); 55 56 void setClickVerb(sp_verb_t verb_t); 57 void setDesktop(SPDesktop *desktop); 58 bool on_click(GdkEventButton *event); 59 60 private: 61 class ToolObserver; 62 class StyleObserver; 63 64 SPDesktop *_desktop; 65 sp_verb_t _verb_t; 66 SPCSSAttr *_css; 67 ToolObserver *_tool_obs; 68 StyleObserver *_style_obs; 69 Glib::ustring _tool_path; 70 71 Gtk::EventBox _swatch; 72 73 Gtk::Grid *_table; 74 75 Gtk::Label _label[2]; 76 Gtk::EventBox _place[2]; 77 Gtk::EventBox _opacity_place; 78 Gtk::Label _value[2]; 79 Gtk::Label _opacity_value; 80 Gtk::Widget *_color_preview[2]; 81 Glib::ustring __color[2]; 82 Gtk::Box _stroke; 83 Gtk::EventBox _stroke_width_place; 84 Gtk::Label _stroke_width; 85 86 Inkscape::Util::Unit *_sw_unit; 87 88 friend class ToolObserver; 89 }; 90 91 92 } // namespace Widget 93 } // namespace UI 94 } // namespace Inkscape 95 96 #endif // INKSCAPE_UI_WIDGET_BUTTON_H 97 98 /* 99 Local Variables: 100 mode:c++ 101 c-file-style:"stroustrup" 102 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) 103 indent-tabs-mode:nil 104 fill-column:99 105 End: 106 */ 107 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : 108