summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick Storz <eduard.braun2@gmx.de>2019-08-04 18:21:06 +0000
committerPatrick Storz <eduard.braun2@gmx.de>2019-08-31 14:50:38 +0000
commit33c31cdcdb285b20ed0286f2ec6f87e39d666666 (patch)
tree99657d7b50c6b7eefaaa4d7c2541e737b15ceace /src
parentImplement "translationdomain" attribute for extensions (diff)
downloadinkscape-33c31cdcdb285b20ed0286f2ec6f87e39d666666.tar.gz
inkscape-33c31cdcdb285b20ed0286f2ec6f87e39d666666.zip
Create new InxWidget base class for extension widgets.
Diffstat (limited to 'src')
-rw-r--r--src/extension/CMakeLists.txt2
-rw-r--r--src/extension/prefdialog/parameter-bool.cpp2
-rw-r--r--src/extension/prefdialog/parameter-color.cpp2
-rw-r--r--src/extension/prefdialog/parameter-description.cpp2
-rw-r--r--src/extension/prefdialog/parameter-float.cpp2
-rw-r--r--src/extension/prefdialog/parameter-int.cpp2
-rw-r--r--src/extension/prefdialog/parameter-notebook.cpp6
-rw-r--r--src/extension/prefdialog/parameter-optiongroup.cpp2
-rw-r--r--src/extension/prefdialog/parameter-string.cpp2
-rw-r--r--src/extension/prefdialog/parameter.cpp64
-rw-r--r--src/extension/prefdialog/parameter.h64
-rw-r--r--src/extension/prefdialog/prefdialog.cpp4
-rw-r--r--src/extension/prefdialog/widget.cpp111
-rw-r--r--src/extension/prefdialog/widget.h129
14 files changed, 259 insertions, 135 deletions
diff --git a/src/extension/CMakeLists.txt b/src/extension/CMakeLists.txt
index 83ea6accb..a747f6d45 100644
--- a/src/extension/CMakeLists.txt
+++ b/src/extension/CMakeLists.txt
@@ -62,6 +62,7 @@ set(extension_SRC
prefdialog/parameter-notebook.cpp
prefdialog/parameter-optiongroup.cpp
prefdialog/parameter-string.cpp
+ prefdialog/widget.cpp
# ------
# Header
@@ -136,6 +137,7 @@ set(extension_SRC
prefdialog/parameter-notebook.h
prefdialog/parameter-optiongroup.h
prefdialog/parameter-string.h
+ prefdialog/widget.h
)
if(WIN32)
diff --git a/src/extension/prefdialog/parameter-bool.cpp b/src/extension/prefdialog/parameter-bool.cpp
index 6131272ec..56a1305ce 100644
--- a/src/extension/prefdialog/parameter-bool.cpp
+++ b/src/extension/prefdialog/parameter-bool.cpp
@@ -121,7 +121,7 @@ Gtk::Widget *ParamBool::get_widget(SPDocument *doc, Inkscape::XML::Node *node, s
return nullptr;
}
- auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, Parameter::GUI_PARAM_WIDGETS_SPACING));
+ auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, GUI_PARAM_WIDGETS_SPACING));
hbox->set_homogeneous(false);
ParamBoolCheckButton * checkbox = Gtk::manage(new ParamBoolCheckButton(this, _text, doc, node, changeSignal));
diff --git a/src/extension/prefdialog/parameter-color.cpp b/src/extension/prefdialog/parameter-color.cpp
index 44bac3513..b29f603f3 100644
--- a/src/extension/prefdialog/parameter-color.cpp
+++ b/src/extension/prefdialog/parameter-color.cpp
@@ -75,7 +75,7 @@ Gtk::Widget *ParamColor::get_widget( SPDocument * /*doc*/, Inkscape::XML::Node *
_changeSignal = new sigc::signal<void>(*changeSignal);
}
- Gtk::HBox *hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING));
+ Gtk::HBox *hbox = Gtk::manage(new Gtk::HBox(false, GUI_PARAM_WIDGETS_SPACING));
Gtk::Widget *selector = Gtk::manage(new ColorNotebook(_color));
hbox->pack_start(*selector, true, true, 0);
selector->show();
diff --git a/src/extension/prefdialog/parameter-description.cpp b/src/extension/prefdialog/parameter-description.cpp
index 7ab607a54..9c6912d81 100644
--- a/src/extension/prefdialog/parameter-description.cpp
+++ b/src/extension/prefdialog/parameter-description.cpp
@@ -100,7 +100,7 @@ Gtk::Widget *ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::
// This means texts can not shrink anymore (they can still grow, though) and it's also necessary
// to prevent https://bugzilla.gnome.org/show_bug.cgi?id=773572
int len = newtext.length();
- label->set_width_chars(len > Parameter::GUI_MAX_LINE_LENGTH ? Parameter::GUI_MAX_LINE_LENGTH : len);
+ label->set_width_chars(len > GUI_MAX_LINE_LENGTH ? GUI_MAX_LINE_LENGTH : len);
label->show();
diff --git a/src/extension/prefdialog/parameter-float.cpp b/src/extension/prefdialog/parameter-float.cpp
index d4e7ce01f..852ac37ac 100644
--- a/src/extension/prefdialog/parameter-float.cpp
+++ b/src/extension/prefdialog/parameter-float.cpp
@@ -162,7 +162,7 @@ Gtk::Widget *ParamFloat::get_widget(SPDocument *doc, Inkscape::XML::Node *node,
return nullptr;
}
- Gtk::HBox *hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING));
+ Gtk::HBox *hbox = Gtk::manage(new Gtk::HBox(false, GUI_PARAM_WIDGETS_SPACING));
auto pfa = new ParamFloatAdjustment(this, doc, node, changeSignal);
Glib::RefPtr<Gtk::Adjustment> fadjust(pfa);
diff --git a/src/extension/prefdialog/parameter-int.cpp b/src/extension/prefdialog/parameter-int.cpp
index 3464a4579..4be385b2e 100644
--- a/src/extension/prefdialog/parameter-int.cpp
+++ b/src/extension/prefdialog/parameter-int.cpp
@@ -146,7 +146,7 @@ ParamInt::get_widget (SPDocument *doc, Inkscape::XML::Node *node, sigc::signal<v
return nullptr;
}
- Gtk::HBox *hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING));
+ Gtk::HBox *hbox = Gtk::manage(new Gtk::HBox(false, GUI_PARAM_WIDGETS_SPACING));
auto pia = new ParamIntAdjustment(this, doc, node, changeSignal);
Glib::RefPtr<Gtk::Adjustment> fadjust(pia);
diff --git a/src/extension/prefdialog/parameter-notebook.cpp b/src/extension/prefdialog/parameter-notebook.cpp
index 443f935dc..2cbe8531a 100644
--- a/src/extension/prefdialog/parameter-notebook.cpp
+++ b/src/extension/prefdialog/parameter-notebook.cpp
@@ -90,15 +90,15 @@ Gtk::Widget *ParamNotebook::ParamNotebookPage::get_widget(SPDocument *doc, Inksc
}
Gtk::VBox * vbox = Gtk::manage(new Gtk::VBox);
- vbox->set_border_width(Parameter::GUI_BOX_MARGIN);
- vbox->set_spacing(Parameter::GUI_BOX_SPACING);
+ vbox->set_border_width(GUI_BOX_MARGIN);
+ vbox->set_spacing(GUI_BOX_SPACING);
// add parameters onto page (if any)
for (auto parameter : parameters) {
Gtk::Widget *parameter_widget = parameter->get_widget(doc, node, changeSignal);
if (parameter_widget) {
int indent = parameter->get_indent();
- parameter_widget->set_margin_start(indent *Parameter::GUI_INDENTATION);
+ parameter_widget->set_margin_start(indent *GUI_INDENTATION);
vbox->pack_start(*parameter_widget, false, false, 0);
const gchar *tooltip = parameter->get_tooltip();
diff --git a/src/extension/prefdialog/parameter-optiongroup.cpp b/src/extension/prefdialog/parameter-optiongroup.cpp
index 4d746f524..07f60b897 100644
--- a/src/extension/prefdialog/parameter-optiongroup.cpp
+++ b/src/extension/prefdialog/parameter-optiongroup.cpp
@@ -254,7 +254,7 @@ Gtk::Widget *ParamOptionGroup::get_widget(SPDocument *doc, Inkscape::XML::Node *
return nullptr;
}
- auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, Parameter::GUI_PARAM_WIDGETS_SPACING));
+ auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, GUI_PARAM_WIDGETS_SPACING));
Gtk::Label *label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START));
hbox->pack_start(*label, false, false);
diff --git a/src/extension/prefdialog/parameter-string.cpp b/src/extension/prefdialog/parameter-string.cpp
index a51adbf8e..b62fae499 100644
--- a/src/extension/prefdialog/parameter-string.cpp
+++ b/src/extension/prefdialog/parameter-string.cpp
@@ -141,7 +141,7 @@ Gtk::Widget *ParamString::get_widget(SPDocument *doc, Inkscape::XML::Node *node,
return nullptr;
}
- Gtk::HBox *hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING));
+ Gtk::HBox *hbox = Gtk::manage(new Gtk::HBox(false, GUI_PARAM_WIDGETS_SPACING));
Gtk::Label *label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START));
label->show();
hbox->pack_start(*label, false, false);
diff --git a/src/extension/prefdialog/parameter.cpp b/src/extension/prefdialog/parameter.cpp
index 5716a3be8..c60928752 100644
--- a/src/extension/prefdialog/parameter.cpp
+++ b/src/extension/prefdialog/parameter.cpp
@@ -27,6 +27,7 @@
#include "parameter-notebook.h"
#include "parameter-optiongroup.h"
#include "parameter-string.h"
+#include "widget.h"
#include "extension/extension.h"
@@ -190,7 +191,7 @@ guint32 Parameter::set_color(guint32 in, SPDocument *doc, Inkscape::XML::Node *n
Parameter::Parameter (Inkscape::XML::Node *in_repr, Inkscape::Extension::Extension *ext)
- : _extension(ext)
+ : InxWidget(in_repr, ext)
{
// name (mandatory for all paramters)
const char *name = in_repr->attribute("name");
@@ -199,29 +200,6 @@ Parameter::Parameter (Inkscape::XML::Node *in_repr, Inkscape::Extension::Extensi
}
_name = g_strdup(name);
-
- // translatable (optional, required to translate gui-text and gui-description)
- const char *translatable = in_repr->attribute("translatable");
- if (translatable) {
- if (!strcmp(translatable, "yes")) {
- _translatable = YES;
- } else if (!strcmp(translatable, "no")) {
- _translatable = NO;
- } else {
- g_warning("Invalid value ('%s') for translatable attribute of parameter '%s' in extension '%s'",
- translatable, _name, _extension->get_id());
- }
- }
-
- // context (optional, required to translate gui-text and gui-description)
- const char *context = in_repr->attribute("context");
- if (!context) {
- context = in_repr->attribute("msgctxt"); // backwards-compatibility with previous name
- }
- if (context) {
- _context = g_strdup(context);
- }
-
// gui-text (TODO: should likely be mandatory for all parameters; maybe not for hidden ones?)
const char *gui_text = in_repr->attribute("gui-text");
if (!gui_text) {
@@ -245,26 +223,6 @@ Parameter::Parameter (Inkscape::XML::Node *in_repr, Inkscape::Extension::Extensi
}
_description = g_strdup(gui_description);
}
-
- // gui-hidden (optional)
- const char *gui_hidden = in_repr->attribute("gui-hidden");
- if (gui_hidden != nullptr) {
- if (strcmp(gui_hidden, "true") == 0) {
- _hidden = true;
- }
- }
-
- // indent (optional)
- const char *indent = in_repr->attribute("indent");
- if (indent != nullptr) {
- _indent = strtol(indent, nullptr, 0);
- }
-
- // appearance (optional, does not apply to all parameters)
- const char *appearance = in_repr->attribute("appearance");
- if (appearance) {
- _appearance = g_strdup(appearance);
- }
}
Parameter::~Parameter()
@@ -277,12 +235,6 @@ Parameter::~Parameter()
g_free(_description);
_description = nullptr;
-
- g_free(_appearance);
- _description = nullptr;
-
- g_free(_context);
- _context = nullptr;
}
gchar *Parameter::pref_name() const
@@ -290,13 +242,6 @@ gchar *Parameter::pref_name() const
return g_strdup_printf("%s.%s", _extension->get_id(), _name);
}
-/** Basically, if there is no widget pass a NULL. */
-Gtk::Widget *
-Parameter::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal<void> * /*changeSignal*/)
-{
- return nullptr;
-}
-
/** If I'm not sure which it is, just don't return a value. */
void Parameter::string(std::string &/*string*/) const
{
@@ -323,11 +268,6 @@ Parameter *Parameter::get_param(const gchar */*name*/)
return nullptr;
}
-
-const char *Parameter::get_translation(const char* msgid) {
- return _extension->get_translation(msgid, _context);
-}
-
Glib::ustring const extension_pref_root = "/extensions/";
} // namespace Extension
diff --git a/src/extension/prefdialog/parameter.h b/src/extension/prefdialog/parameter.h
index e9dbd6efc..822c93416 100644
--- a/src/extension/prefdialog/parameter.h
+++ b/src/extension/prefdialog/parameter.h
@@ -14,27 +14,12 @@
#ifndef SEEN_INK_EXTENSION_PARAM_H__
#define SEEN_INK_EXTENSION_PARAM_H__
-#include <string>
+#include "widget.h" // TODO: Necessary?
-#include <sigc++/sigc++.h>
-#include <glibmm/ustring.h>
-
-class SPDocument;
-
-namespace Gtk {
-class Widget;
-}
namespace Inkscape {
-namespace XML {
-class Node;
-}
-
namespace Extension {
-class Extension;
-
-
/**
* The root directory in the preferences database for extension-related parameters.
*
@@ -51,13 +36,8 @@ extern Glib::ustring const extension_pref_root;
* around. There is also a few functions that are used by all the
* different parameters.
*/
-class Parameter {
+class Parameter : public InxWidget {
public:
-
- enum Translatable {
- UNSET, YES, NO
- };
-
Parameter(Inkscape::XML::Node *in_repr,
Inkscape::Extension::Extension *ext);
@@ -128,16 +108,8 @@ public:
*/
static Parameter *make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Extension *in_ext);
- virtual Gtk::Widget *get_widget(SPDocument *doc, Inkscape::XML::Node *node, sigc::signal<void> *changeSignal);
-
const gchar *get_tooltip() const { return _description; }
- /** Indicates if the GUI for this parameter is hidden or not */
- bool get_hidden() const { return _hidden; }
-
- /** Indentation level of the parameter */
- int get_indent() const { return _indent; }
-
virtual void string(std::list <std::string> &list) const;
/**
@@ -150,16 +122,8 @@ public:
virtual Parameter *get_param(gchar const *name);
- /** Recommended margin of boxes containing multiple Parameters (in px) */
- const static int GUI_BOX_MARGIN = 10;
- /** Recommended spacing between multiple Parameters packed into a box (in px) */
- const static int GUI_BOX_SPACING = 4;
/** Recommended spacing between the widgets making up a single Parameter (e.g. label and input) (in px) */
const static int GUI_PARAM_WIDGETS_SPACING = 4;
- /** Recommended indentation width of parameters (in px) */
- const static int GUI_INDENTATION = 12;
- /** Recommended maximum line length for wrapping textual parameters (in chars) */
- const static int GUI_MAX_LINE_LENGTH = 60;
/** An error class for when a parameter is called on a type it is not */
@@ -174,9 +138,6 @@ public:
protected:
- /** Which extension is this parameter attached to. */
- Inkscape::Extension::Extension *_extension = nullptr;
-
/** The name of this parameter. */
gchar *_name = nullptr;
@@ -186,32 +147,13 @@ protected:
/** Extended description of the parameter (currently shown as tooltip on hover). */
gchar *_description = nullptr;
- /** Whether the parameter is visible. */
- bool _hidden = false;
-
- /** Indentation level of the parameter. */
- int _indent = 0;
-
- /** Appearance of the parameter (not used by all Parameters). */
- gchar *_appearance = nullptr;
-
- /** Is parameter translatable? */
- Translatable _translatable = UNSET;
-
- /** context for translation of translatable strings. */
- gchar *_context = nullptr;
-
- /* **** funcs **** */
+ /* **** member functions **** */
/**
* Build the name to write the parameter from the extension's ID and the name of this parameter.
*/
gchar *pref_name() const;
-
- /** gets the gettext translation for msgid
- * Handles translation domain of the extension and message context of the parameter internally */
- const char *get_translation(const char* msgid);
};
} // namespace Extension
diff --git a/src/extension/prefdialog/prefdialog.cpp b/src/extension/prefdialog/prefdialog.cpp
index a1966ec8d..66aaccc62 100644
--- a/src/extension/prefdialog/prefdialog.cpp
+++ b/src/extension/prefdialog/prefdialog.cpp
@@ -87,10 +87,10 @@ PrefDialog::PrefDialog (Glib::ustring name, Gtk::Widget * controls, Effect * eff
auto sep = Gtk::manage(new Gtk::Separator());
sep->show();
- this->get_content_area()->pack_start(*sep, false, false, Parameter::GUI_BOX_SPACING);
+ this->get_content_area()->pack_start(*sep, false, false, InxWidget::GUI_BOX_SPACING);
hbox = Gtk::manage(new Gtk::HBox());
- hbox->set_border_width(Parameter::GUI_BOX_MARGIN);
+ hbox->set_border_width(InxWidget::GUI_BOX_MARGIN);
_button_preview = _param_preview->get_widget(nullptr, nullptr, &_signal_preview);
_button_preview->show();
hbox->pack_start(*_button_preview, true, true, 0);
diff --git a/src/extension/prefdialog/widget.cpp b/src/extension/prefdialog/widget.cpp
new file mode 100644
index 000000000..ea02970ca
--- /dev/null
+++ b/src/extension/prefdialog/widget.cpp
@@ -0,0 +1,111 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/** @file
+ * Parameters for extensions.
+ *//*
+ * Author:
+ * Patrick Storz <eduard.braun2@gmx.de>
+ *
+ * Copyright (C) 2019 Authors
+ *
+ * Released under GNU GPL v2+, read the file 'COPYING' for more information.
+ */
+
+#include "widget.h"
+
+#include <sigc++/sigc++.h>
+
+#include "extension/extension.h"
+
+#include "xml/node.h"
+
+
+namespace Inkscape {
+namespace Extension {
+
+InxWidget *InxWidget::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Extension *in_ext)
+{
+ InxWidget *widget = nullptr;
+
+ // Note: param could equal nullptr
+ return widget;
+}
+
+InxWidget::InxWidget (Inkscape::XML::Node *in_repr, Inkscape::Extension::Extension *ext)
+ : _extension(ext)
+{
+ // translatable (optional)
+ const char *translatable = in_repr->attribute("translatable");
+ if (translatable) {
+ if (!strcmp(translatable, "yes")) {
+ _translatable = YES;
+ } else if (!strcmp(translatable, "no")) {
+ _translatable = NO;
+ } else {
+ g_warning("Invalid value ('%s') for translatable attribute of widget '%s' in extension '%s'",
+ translatable, in_repr->name(), _extension->get_id());
+ }
+ }
+
+ // context (optional)
+ const char *context = in_repr->attribute("context");
+ if (!context) {
+ context = in_repr->attribute("msgctxt"); // backwards-compatibility with previous name
+ }
+ if (context) {
+ _context = g_strdup(context);
+ }
+
+ // gui-hidden (optional)
+ const char *gui_hidden = in_repr->attribute("gui-hidden");
+ if (gui_hidden != nullptr) {
+ if (strcmp(gui_hidden, "true") == 0) {
+ _hidden = true;
+ }
+ }
+
+ // indent (optional)
+ const char *indent = in_repr->attribute("indent");
+ if (indent != nullptr) {
+ _indent = strtol(indent, nullptr, 0);
+ }
+
+ // appearance (optional, does not apply to all parameters)
+ const char *appearance = in_repr->attribute("appearance");
+ if (appearance) {
+ _appearance = g_strdup(appearance);
+ }
+}
+
+InxWidget::~InxWidget()
+{
+ g_free(_context);
+ _context = nullptr;
+
+ g_free(_appearance);
+ _appearance = nullptr;
+}
+
+/** Basically, if there is no widget pass a NULL. */
+Gtk::Widget *
+InxWidget::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal<void> * /*changeSignal*/)
+{
+ return nullptr;
+}
+
+const char *InxWidget::get_translation(const char* msgid) {
+ return _extension->get_translation(msgid, _context);
+}
+
+} // namespace Extension
+} // namespace Inkscape
+
+/*
+ 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 :
diff --git a/src/extension/prefdialog/widget.h b/src/extension/prefdialog/widget.h
new file mode 100644
index 000000000..7887f5579
--- /dev/null
+++ b/src/extension/prefdialog/widget.h
@@ -0,0 +1,129 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/** @file
+ * Base class for extension widgets.
+ *//*
+ * Authors:
+ * Patrick Storz <eduard.braun2@gmx.de>
+ *
+ * Copyright (C) 2019 Authors
+ *
+ * Released under GNU GPL v2+, read the file 'COPYING' for more information.
+ */
+
+#ifndef SEEN_INK_EXTENSION_WIDGET_H
+#define SEEN_INK_EXTENSION_WIDGET_H
+
+#include <string>
+
+#include <sigc++/sigc++.h>
+#include <glibmm/ustring.h>
+
+class SPDocument;
+
+namespace Gtk {
+class Widget;
+}
+
+namespace Inkscape {
+namespace XML {
+class Node;
+}
+
+namespace Extension {
+
+class Extension;
+
+
+/**
+ * Base class to represent all widgets of an extension (including parameters)
+ */
+class InxWidget {
+public:
+
+ enum Translatable {
+ UNSET, YES, NO
+ };
+
+ InxWidget(Inkscape::XML::Node *in_repr, Inkscape::Extension::Extension *in_ext);
+
+ virtual ~InxWidget();
+
+ /**
+ * Creates a new extension widget for usage in a prefdialog.
+ *
+ * The type of widget created is parsed from the XML representation passed in,
+ * and the suitable subclass constructor is called.
+ *
+ * For specialized widget types (like parameters) we defer to the subclass function of the same name.
+ *
+ * @param in_repr The XML representation describing the widget.
+ * @param in_ex t The extension the widget belongs to.
+ * @return a pointer to a new Widget if applicable, null otherwise..
+ */
+ static InxWidget *make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Extension *in_ext);
+
+ virtual Gtk::Widget *get_widget(SPDocument *doc, Inkscape::XML::Node *node, sigc::signal<void> *changeSignal);
+
+ /** Indicates if the widget is hidden or not */
+ bool get_hidden() const { return _hidden; }
+
+ /** Indentation level of the widget */
+ int get_indent() const { return _indent; }
+
+
+ /** Recommended margin of boxes containing multiple Widgets (in px) */
+ const static int GUI_BOX_MARGIN = 10;
+ /** Recommended spacing between multiple Widgets packed into a box (in px) */
+ const static int GUI_BOX_SPACING = 4;
+ /** Recommended indentation width of Widgets(in px) */
+ const static int GUI_INDENTATION = 12;
+ /** Recommended maximum line length for wrapping textual Widgets (in chars) */
+ const static int GUI_MAX_LINE_LENGTH = 60;
+
+protected:
+ /** Which extension is this Widget attached to. */
+ Inkscape::Extension::Extension *_extension = nullptr;
+
+ /** Whether the Widget is visible. */
+ bool _hidden = false;
+
+ /** Indentation level of the Widget. */
+ int _indent = 0;
+
+ /** Appearance of the Widget (not used by all Widgets). */
+ gchar *_appearance = nullptr;
+
+ /** Is Widget translatable? */
+ Translatable _translatable = UNSET;
+
+ /** context for translation of translatable strings. */
+ gchar *_context = nullptr;
+
+
+ /* **** member functions **** */
+
+ /** gets the gettext translation for msgid
+ *
+ * Handles translation domain of the extension and message context of the Widget internally
+ *
+ * @param msgid String to translate
+ * @return Translated string
+ */
+ const char *get_translation(const char* msgid);
+};
+
+} // namespace Extension
+} // namespace Inkscape
+
+#endif // SEEN_INK_EXTENSION_WIDGET_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 :