17#include <glibmm/i18n.h>
18#include <glibmm/ustring.h>
19#include <gdkmm/display.h>
20#include <gtkmm/cssprovider.h>
21#include <gtkmm/image.h>
22#include <gtkmm/styleprovider.h>
23#include <sigc++/functors/mem_fun.h>
37class AlternateIcons final :
public Gtk::Box {
39 AlternateIcons(Gtk::IconSize
const size, Glib::ustring
const &a, Glib::ustring
const &b)
42 set_name(
"AlternateIcons");
57 bool state()
const {
return _state; }
58 void setState(
bool state) {
62 if (_a) _a->set_visible(
false);
63 if (_b) _b->set_visible(
true);
65 if (_a) _a->set_visible(
true);
66 if (_b) _b->set_visible(
false);
71 Gtk::Image *_a =
nullptr;
72 Gtk::Image *_b =
nullptr;
76static constexpr auto cssName =
"LayerSelector";
80 , _label_style{
Gtk::CssProvider::
create()}
81 , _observer{
std::make_unique<
Inkscape::XML::SignalObserver>()}
91 _eye_label = Gtk::make_managed<AlternateIcons>(Gtk::IconSize::NORMAL,
92 INKSCAPE_ICON(
"object-visible"), INKSCAPE_ICON(
"object-hidden"));
97 _eye_toggle.set_tooltip_text(_(
"Toggle current layer visibility"));
100 _lock_label = Gtk::make_managed<AlternateIcons>(Gtk::IconSize::NORMAL,
101 INKSCAPE_ICON(
"object-unlocked"), INKSCAPE_ICON(
"object-locked"));
106 _lock_toggle.set_tooltip_text(_(
"Lock or unlock current layer"));
115 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
156 auto color_str = std::string(
"white");
185 layer->setLocked(lock);
194 layer->setHidden(hide);
206 return "this" + std::to_string(
reinterpret_cast<uintptr_t
>(
this));
std::optional< Color > converted(Color const &other) const
Return a copy of this color converted to the same format as the other color.
static void done(SPDocument *document, Glib::ustring const &event_description, Glib::ustring const &undo_icon, unsigned int object_modified_tag=0)
SPGroup * currentLayer() const
Returns current top layer.
SPGroup * currentRoot() const
Returns current root (=bottom) layer.
sigc::connection connectCurrentLayerChanged(const sigc::slot< void(SPGroup *)> &slot)
void new_dialog(const Glib::ustring &dialog_type)
Add new dialog to the current container or in a floating window, based on preferences.
To do: update description of desktop.
SPDocument * getDocument() const
Inkscape::UI::Dialog::DialogContainer * getContainer()
Inkscape::LayerManager & layerManager()
void set(SPAttr key, char const *value) override
Inkscape::Colors::Color highlight_color() const override
Generate a highlight colour if one isn't set and return it.
char const * defaultLabel() const
Returns a default label property for this object.
std::shared_ptr< Css const > css
Editable view implementation.
A widget that manages DialogNotebook's and other widgets inside a horizontal DialogMultipaned.
TODO: insert short description here.
Gtk::Image * sp_get_icon_image(Glib::ustring const &icon_name, int size)
Macro for icon names used in Inkscape.
void pack_start(Gtk::Box &box, Gtk::Widget &child, bool const expand, bool const fill, unsigned const padding)
Adds child to box, packed with reference to the start of box.
Helper class to stream background task notifications as a series of messages.
static void append(std::vector< T > &target, std::vector< T > &&source)
Helpers for using Gtk::Boxes, encapsulating large changes between GTK3 & GTK4.