diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:24:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:24:48 +0000 |
commit | cca66b9ec4e494c1d919bff0f71a820d8afab1fa (patch) | |
tree | 146f39ded1c938019e1ed42d30923c2ac9e86789 /src/ui/widget/gradient-vector-selector.h | |
parent | Initial commit. (diff) | |
download | inkscape-12fc8abae6d434cac7670a59ed3a67301cc2eb10.tar.xz inkscape-12fc8abae6d434cac7670a59ed3a67301cc2eb10.zip |
Adding upstream version 1.2.2.upstream/1.2.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/ui/widget/gradient-vector-selector.h')
-rw-r--r-- | src/ui/widget/gradient-vector-selector.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/src/ui/widget/gradient-vector-selector.h b/src/ui/widget/gradient-vector-selector.h new file mode 100644 index 0000000..6ce8edb --- /dev/null +++ b/src/ui/widget/gradient-vector-selector.h @@ -0,0 +1,97 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +#ifndef SEEN_GRADIENT_VECTOR_H +#define SEEN_GRADIENT_VECTOR_H + +/* + * Gradient vector selection widget + * + * Author: + * Lauris Kaplinski <lauris@kaplinski.com> + * Jon A. Cruz <jon@joncruz.org> + * + * Copyright (C) 2010 Jon A. Cruz + * Copyright (C) 2001-2002 Lauris Kaplinski + * Copyright (C) 2001 Ximian, Inc. + * + * Released under GNU GPL v2+, read the file 'COPYING' for more information. + */ + +#include "ui/widget/gradient-selector.h" + +#include <gtkmm/liststore.h> +#include <sigc++/connection.h> + +class SPDocument; +class SPObject; +class SPGradient; +class SPStop; + +namespace Inkscape { +namespace UI { +namespace Widget { + +class GradientVectorSelector : public Gtk::Box { + private: + bool _swatched = false; + + SPDocument *_doc = nullptr; + SPGradient *_gr = nullptr; + + /* Gradient vectors store */ + Glib::RefPtr<Gtk::ListStore> _store; + Inkscape::UI::Widget::GradientSelector::ModelColumns *_columns; + + sigc::connection _gradient_release_connection; + sigc::connection _defs_release_connection; + sigc::connection _defs_modified_connection; + sigc::connection _tree_select_connection; + + sigc::signal<void, SPGradient *> _signal_vector_set; + + void gradient_release(SPObject *obj); + void defs_release(SPObject *defs); + void defs_modified(SPObject *defs, guint flags); + void rebuild_gui_full(); + + public: + GradientVectorSelector(SPDocument *doc, SPGradient *gradient); + ~GradientVectorSelector() override; + + void setSwatched(); + void set_gradient(SPDocument *doc, SPGradient *gr); + // width and height of gradient preview pixmap + void set_pixmap_size(int width, int height); + + inline decltype(_columns) get_columns() const { return _columns; } + inline decltype(_doc) get_document() const { return _doc; } + inline decltype(_gr) get_gradient() const { return _gr; } + inline decltype(_store) get_store() const { return _store; } + + inline decltype(_signal_vector_set) signal_vector_set() const { return _signal_vector_set; } + + inline void set_tree_select_connection(sigc::connection &connection) { _tree_select_connection = connection; } + +private: + int _pix_width = 64; + int _pix_height = 18; +}; + +} // namespace Widget +} // namespace UI +} // namespace Inkscape + +Glib::ustring gr_prepare_label (SPObject *obj); +Glib::ustring gr_ellipsize_text(Glib::ustring const &src, size_t maxlen); + +#endif // SEEN_GRADIENT_VECTOR_H + +/* + 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 : |