Inkscape
Vector Graphics Editor
registered-enums.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Authors:
4 * Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
5 *
6 * Copyright (C) 2007 Authors
7 *
8 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
9 */
10
11#ifndef INKSCAPE_UI_WIDGET_REGISTERED_ENUMS_H
12#define INKSCAPE_UI_WIDGET_REGISTERED_ENUMS_H
13
16
17namespace Inkscape {
18namespace UI {
19namespace Widget {
20
24template<typename E> class RegisteredEnum : public RegisteredWidget< LabelledComboBoxEnum<E> >
25{
26public:
27 ~RegisteredEnum() override {
28 _changed_connection.disconnect();
29 }
30
31 RegisteredEnum ( const Glib::ustring& label,
32 const Glib::ustring& tip,
33 const Glib::ustring& key,
35 Registry& wr,
36 Inkscape::XML::Node* repr_in = nullptr,
37 SPDocument *doc_in = nullptr,
38 bool sorted = true )
39 : RegisteredWidget< LabelledComboBoxEnum<E> >(label, tip, c, Glib::ustring{}, true, sorted)
40 {
42 _changed_connection = combobox()->signal_changed().connect (sigc::mem_fun (*this, &RegisteredEnum::on_changed));
43 }
44
45 void set_active_by_id (E id) {
46 combobox()->set_active_by_id(id);
47 };
48
49 void set_active_by_key (const Glib::ustring& key) {
50 combobox()->set_active_by_key(key);
51 }
52
54 combobox()->get_active_data();
55 }
56
59 }
60
61 sigc::connection _changed_connection;
62
63protected:
64 void on_changed() {
65 if (combobox()->setProgrammatically) {
66 combobox()->setProgrammatically = false;
67 return;
68 }
69
71 return;
72
74
75 const Util::EnumData<E>* data = combobox()->get_active_data();
76 if (data) {
78 }
79
81 }
82};
83
84}
85}
86}
87
88#endif
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 :
Simplified management of enumerations in the UI as combobox.
Definition: combo-enums.h:35
Simplified management of enumerations in the UI as combobox, plus the functionality of Labelled.
Definition: combo-enums.h:210
Simplified management of enumerations in the UI as combobox.
const Util::EnumData< E > * get_active_data()
void set_active_by_key(const Glib::ustring &key)
RegisteredEnum(const Glib::ustring &label, const Glib::ustring &tip, const Glib::ustring &key, const Util::EnumDataConverter< E > &c, Registry &wr, Inkscape::XML::Node *repr_in=nullptr, SPDocument *doc_in=nullptr, bool sorted=true)
void init_parent(Glib::ustring const &key, Registry &wr, Inkscape::XML::Node *const repr_in, SPDocument *const doc_in)
Simplified management of enumerations of svg items with UI labels.
Definition: enums.h:42
Interface for refcounted XML nodes.
Definition: node.h:80
Typed SVG document implementation.
Definition: document.h:106
double c[8][4]
Definition: cylinder3d.cpp:40
CMYK to sRGB conversion routines.
static cairo_user_data_key_t key
Definition: nr-svgfonts.cpp:46
unsigned char * data
Simplified management of enumerations of svg items with UI labels.
Definition: enums.h:27