Inkscape
Vector Graphics Editor
|
A class to represent the parameter of an extension. More...
#include <parameter.h>
Classes | |
class | param_no_name |
An error class for when a parameter is called on a type it is not. More... | |
class | param_no_text |
class | param_not_bool_param |
class | param_not_color_param |
class | param_not_float_param |
class | param_not_int_param |
class | param_not_optiongroup_param |
class | param_not_string_param |
Public Member Functions | |
InxParameter (Inkscape::XML::Node *in_repr, Inkscape::Extension::Extension *ext) | |
~InxParameter () override | |
bool | get_bool () const |
Wrapper to cast to the object and use its function. More... | |
int | get_int () const |
Wrapper to cast to the object and use it's function. More... | |
double | get_float () const |
Wrapper to cast to the object and use it's function. More... | |
const char * | get_string () const |
Wrapper to cast to the object and use it's function. More... | |
const char * | get_optiongroup () const |
Wrapper to cast to the object and use it's function. More... | |
bool | get_optiongroup_contains (const char *value) const |
unsigned int | get_color () const |
Wrapper to cast to the object and use it's function. More... | |
bool | set_bool (bool in) |
Wrapper to cast to the object and use it's function. More... | |
int | set_int (int in) |
Wrapper to cast to the object and use it's function. More... | |
double | set_float (double in) |
Wrapper to cast to the object and use it's function. More... | |
const char * | set_string (const char *in) |
Wrapper to cast to the object and use it's function. More... | |
const char * | set_optiongroup (const char *in) |
Wrapper to cast to the object and use it's function. More... | |
unsigned int | set_color (unsigned int in) |
Wrapper to cast to the object and use it's function. More... | |
char const * | name () const |
const char * | get_tooltip () const override |
virtual std::string | value_to_string () const |
Gets the current value of the parameter in a string form. More... | |
virtual void | string_to_value (const std::string &in) |
Sets the current value of the parameter from a string. More... | |
virtual const std::string & | set (const std::string &in) |
Calls string_to_value and then saves the result in the prefs. More... | |
Public Member Functions inherited from Inkscape::Extension::InxWidget | |
InxWidget (Inkscape::XML::Node *in_repr, Inkscape::Extension::Extension *in_ext) | |
virtual | ~InxWidget () |
virtual Gtk::Widget * | get_widget (sigc::signal< void()> *changeSignal) |
Return the instance's GTK::Widget representation for usage in a GUI. More... | |
virtual const char * | get_tooltip () const |
bool | get_hidden () const |
Indicates if the widget is hidden or not. More... | |
void | set_hidden (bool hidden) |
Sets the widget to being hidden, or shown. More... | |
int | get_indent () const |
Indentation level of the widget. More... | |
virtual void | get_widgets (std::vector< InxWidget * > &list) |
Recursively construct a list containing the current widget and all of it's child widgets (if it has any) More... | |
Static Public Member Functions | |
static InxParameter * | make (Inkscape::XML::Node *in_repr, Inkscape::Extension::Extension *in_ext) |
Creates a new extension parameter for usage in a prefdialog. More... | |
Static Public Member Functions inherited from Inkscape::Extension::InxWidget | |
static InxWidget * | make (Inkscape::XML::Node *in_repr, Inkscape::Extension::Extension *in_ext) |
Creates a new extension widget for usage in a prefdialog. More... | |
static bool | is_valid_widget_name (const char *name) |
Checks if name is a valid widget name, i.e. More... | |
Static Public Attributes | |
static constexpr int | GUI_PARAM_WIDGETS_SPACING = 4 |
Recommended spacing between the widgets making up a single Parameter (e.g. More... | |
Static Public Attributes inherited from Inkscape::Extension::InxWidget | |
static constexpr int | GUI_BOX_MARGIN = 10 |
Recommended margin of boxes containing multiple widgets (in px) More... | |
static constexpr int | GUI_BOX_SPACING = 4 |
Recommended spacing between multiple widgets packed into a box (in px) More... | |
static constexpr int | GUI_INDENTATION = 12 |
Recommended indentation width of widgets(in px) More... | |
static constexpr int | GUI_MAX_LINE_LENGTH = 60 |
Recommended maximum line length for wrapping textual wdgets (in chars) More... | |
Protected Member Functions | |
Glib::ustring | pref_name () const |
Build preference name for the current parameter. More... | |
Protected Member Functions inherited from Inkscape::Extension::InxWidget | |
const char * | get_translation (const char *msgid) |
gets the gettext translation for msgid More... | |
Protected Attributes | |
char * | _name = nullptr |
The name of this parameter. More... | |
char * | _text = nullptr |
Parameter text to show as the GUI label. More... | |
char * | _description = nullptr |
Extended description of the parameter (currently shown as tooltip on hover). More... | |
Protected Attributes inherited from Inkscape::Extension::InxWidget | |
Inkscape::Extension::Extension * | _extension = nullptr |
Which extension is this Widget attached to. More... | |
std::vector< InxWidget * > | _children |
Child widgets of this widget (might be empty if there are none) More... | |
bool | _hidden = false |
Whether the widget is visible. More... | |
bool | _gui_hidden = false |
int | _indent = 0 |
Indentation level of the widget. More... | |
char * | _appearance = nullptr |
Appearance of the widget (not used by all widgets). More... | |
Translatable | _translatable = UNSET |
Is widget translatable? More... | |
char * | _context = nullptr |
context for translation of translatable strings. More... | |
Additional Inherited Members | |
Protected Types inherited from Inkscape::Extension::InxWidget | |
enum | Translatable { UNSET , YES , NO } |
A class to represent the parameter of an extension.
This is really a super class that allows them to abstract all the different types of parameters into some that can be passed around. There is also a few functions that are used by all the different parameters.
Definition at line 34 of file parameter.h.
Inkscape::Extension::InxParameter::InxParameter | ( | Inkscape::XML::Node * | in_repr, |
Inkscape::Extension::Extension * | ext | ||
) |
Definition at line 226 of file parameter.cpp.
References _description, Inkscape::Extension::InxWidget::_extension, Inkscape::Extension::InxWidget::_hidden, _name, _text, Inkscape::Extension::InxWidget::_translatable, Inkscape::XML::Node::attribute(), Inkscape::Extension::Extension::get_id(), Inkscape::Extension::InxWidget::get_translation(), name(), and Inkscape::Extension::InxWidget::NO.
|
override |
Definition at line 269 of file parameter.cpp.
References _description, _name, and _text.
bool Inkscape::Extension::InxParameter::get_bool | ( | ) | const |
Wrapper to cast to the object and use its function.
Definition at line 110 of file parameter.cpp.
References Inkscape::Extension::ParamBool::get().
Referenced by Inkscape::Extension::Extension::get_param_bool().
unsigned int Inkscape::Extension::InxParameter::get_color | ( | ) | const |
Wrapper to cast to the object and use it's function.
Definition at line 166 of file parameter.cpp.
References Inkscape::Extension::ParamColor::get().
Referenced by Inkscape::Extension::Extension::get_param_color().
double Inkscape::Extension::InxParameter::get_float | ( | ) | const |
Wrapper to cast to the object and use it's function.
Definition at line 130 of file parameter.cpp.
References Inkscape::Extension::ParamFloat::get().
Referenced by Inkscape::Extension::Extension::get_param_float().
int Inkscape::Extension::InxParameter::get_int | ( | ) | const |
Wrapper to cast to the object and use it's function.
Definition at line 119 of file parameter.cpp.
References Inkscape::Preferences::get(), Inkscape::Extension::ParamInt::get(), Inkscape::Preferences::getInt(), and pref_name().
Referenced by Inkscape::Extension::Extension::get_param_int().
const char * Inkscape::Extension::InxParameter::get_optiongroup | ( | ) | const |
Wrapper to cast to the object and use it's function.
Definition at line 148 of file parameter.cpp.
References Inkscape::Extension::ParamOptionGroup::get().
Referenced by Inkscape::Extension::Extension::get_param_optiongroup().
bool Inkscape::Extension::InxParameter::get_optiongroup_contains | ( | const char * | value | ) | const |
Definition at line 157 of file parameter.cpp.
References Inkscape::Extension::ParamOptionGroup::contains().
Referenced by Inkscape::Extension::Extension::get_param_optiongroup_contains().
const char * Inkscape::Extension::InxParameter::get_string | ( | ) | const |
Wrapper to cast to the object and use it's function.
Definition at line 139 of file parameter.cpp.
References Inkscape::Extension::ParamString::get().
Referenced by Inkscape::Extension::Extension::get_param_string().
|
inlineoverridevirtual |
Reimplemented from Inkscape::Extension::InxWidget.
Definition at line 94 of file parameter.h.
References _description.
|
static |
Creates a new extension parameter 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.
Called from base-class method of the same name.
in_repr | The XML representation describing the widget. |
in_ext | The extension the widget belongs to. |
Definition at line 66 of file parameter.cpp.
References Inkscape::XML::Node::attribute(), Inkscape::Extension::Extension::get_id(), and Inkscape::XML::Node::setAttribute().
Referenced by Inkscape::Extension::InxWidget::make(), and Inkscape::Extension::PrefDialog::PrefDialog().
|
inline |
Definition at line 78 of file parameter.h.
References _name.
Referenced by Inkscape::Extension::Extension::get_param(), InxParameter(), Inkscape::Extension::Extension::paramListString(), and Inkscape::Extension::ParamOptionGroup::ParamOptionGroupOption::ParamOptionGroupOption().
|
protected |
Build preference name for the current parameter.
Returns a preference name that can be used with setters and getters from Inkscape::Preferences. The name is assembled from a fixed root ("/extensions/"), extension ID and parameter name.
Definition at line 281 of file parameter.cpp.
References Inkscape::Extension::InxWidget::_extension, _name, Geom::compose(), and Inkscape::Extension::Extension::get_id().
Referenced by Inkscape::Extension::ParamColor::_onColorChanged(), get_int(), Inkscape::Extension::ParamBool::ParamBool(), Inkscape::Extension::ParamColor::ParamColor(), Inkscape::Extension::ParamFloat::ParamFloat(), Inkscape::Extension::ParamInt::ParamInt(), Inkscape::Extension::ParamNotebook::ParamNotebook(), Inkscape::Extension::ParamOptionGroup::ParamOptionGroup(), Inkscape::Extension::ParamPath::ParamPath(), Inkscape::Extension::ParamString::ParamString(), Inkscape::Extension::ParamBool::set(), Inkscape::Extension::ParamOptionGroup::set(), Inkscape::Extension::ParamNotebook::set(), set(), Inkscape::Extension::ParamPath::set(), Inkscape::Extension::ParamFloat::set(), Inkscape::Extension::ParamString::set(), and Inkscape::Extension::ParamInt::set().
|
virtual |
Calls string_to_value and then saves the result in the prefs.
Reimplemented in Inkscape::Extension::ParamPath.
Definition at line 301 of file parameter.cpp.
References Inkscape::Preferences::get(), pref_name(), Inkscape::Preferences::setString(), string_to_value(), and value_to_string().
Referenced by Inkscape::Extension::Extension::set_param_any().
bool Inkscape::Extension::InxParameter::set_bool | ( | bool | in | ) |
Wrapper to cast to the object and use it's function.
Definition at line 175 of file parameter.cpp.
References Inkscape::Extension::ParamBool::set().
Referenced by Inkscape::Extension::Extension::set_param_bool().
unsigned int Inkscape::Extension::InxParameter::set_color | ( | unsigned int | in | ) |
Wrapper to cast to the object and use it's function.
Definition at line 217 of file parameter.cpp.
References Inkscape::Extension::ParamColor::set().
Referenced by Inkscape::Extension::Extension::set_param_color().
double Inkscape::Extension::InxParameter::set_float | ( | double | in | ) |
Wrapper to cast to the object and use it's function.
Definition at line 191 of file parameter.cpp.
References Inkscape::Extension::ParamFloat::set().
Referenced by Inkscape::Extension::Extension::set_param_float().
int Inkscape::Extension::InxParameter::set_int | ( | int | in | ) |
Wrapper to cast to the object and use it's function.
Definition at line 183 of file parameter.cpp.
References Inkscape::Extension::ParamInt::set().
Referenced by Inkscape::Extension::Extension::set_param_int().
const char * Inkscape::Extension::InxParameter::set_optiongroup | ( | const char * | in | ) |
Wrapper to cast to the object and use it's function.
Definition at line 208 of file parameter.cpp.
References Inkscape::Extension::ParamOptionGroup::set().
Referenced by Inkscape::Extension::Extension::set_param_optiongroup().
const char * Inkscape::Extension::InxParameter::set_string | ( | const char * | in | ) |
Wrapper to cast to the object and use it's function.
Definition at line 200 of file parameter.cpp.
References Inkscape::Extension::ParamString::set().
Referenced by Inkscape::Extension::Extension::set_param_string().
|
virtual |
Sets the current value of the parameter from a string.
Reimplemented in Inkscape::Extension::ParamBool, Inkscape::Extension::ParamColor, Inkscape::Extension::ParamFloat, Inkscape::Extension::ParamInt, Inkscape::Extension::ParamNotebook, Inkscape::Extension::ParamOptionGroup, Inkscape::Extension::ParamPath, and Inkscape::Extension::ParamString.
Definition at line 294 of file parameter.cpp.
References Inkscape::Extension::InxWidget::_extension, _name, and Inkscape::Extension::Extension::get_id().
Referenced by set().
|
virtual |
Gets the current value of the parameter in a string form.
Reimplemented in Inkscape::Extension::ParamBool, Inkscape::Extension::ParamColor, Inkscape::Extension::ParamFloat, Inkscape::Extension::ParamInt, Inkscape::Extension::ParamNotebook::ParamNotebookPage, Inkscape::Extension::ParamNotebook, Inkscape::Extension::ParamOptionGroup, Inkscape::Extension::ParamPath, and Inkscape::Extension::ParamString.
Definition at line 286 of file parameter.cpp.
References Inkscape::Extension::InxWidget::_extension, _name, and Inkscape::Extension::Extension::get_id().
Referenced by Inkscape::Extension::Extension::paramListString(), and set().
|
protected |
Extended description of the parameter (currently shown as tooltip on hover).
Definition at line 139 of file parameter.h.
Referenced by get_tooltip(), InxParameter(), and ~InxParameter().
|
protected |
The name of this parameter.
Definition at line 133 of file parameter.h.
Referenced by InxParameter(), name(), Inkscape::Extension::ParamColor::ParamColor(), Inkscape::Extension::ParamFloat::ParamFloat(), Inkscape::Extension::ParamInt::ParamInt(), Inkscape::Extension::ParamNotebook::ParamNotebook(), Inkscape::Extension::ParamOptionGroup::ParamOptionGroup(), Inkscape::Extension::ParamPath::ParamPath(), Inkscape::Extension::ParamString::ParamString(), pref_name(), Inkscape::Extension::ParamOptionGroup::set(), string_to_value(), Inkscape::Extension::ParamBool::string_to_value(), value_to_string(), and ~InxParameter().
|
protected |
Parameter text to show as the GUI label.
Definition at line 136 of file parameter.h.
Referenced by Inkscape::Extension::ParamBool::get_widget(), Inkscape::Extension::ParamColor::get_widget(), Inkscape::Extension::ParamFloat::get_widget(), Inkscape::Extension::ParamInt::get_widget(), Inkscape::Extension::ParamOptionGroup::get_widget(), Inkscape::Extension::ParamPath::get_widget(), Inkscape::Extension::ParamString::get_widget(), InxParameter(), and ~InxParameter().
|
staticconstexpr |
Recommended spacing between the widgets making up a single Parameter (e.g.
label and input) (in px)
Definition at line 119 of file parameter.h.
Referenced by Inkscape::Extension::ParamBool::get_widget(), Inkscape::Extension::ParamColor::get_widget(), Inkscape::Extension::ParamFloat::get_widget(), Inkscape::Extension::ParamInt::get_widget(), Inkscape::Extension::ParamOptionGroup::get_widget(), Inkscape::Extension::ParamPath::get_widget(), and Inkscape::Extension::ParamString::get_widget().