Inkscape
Vector Graphics Editor
Inkscape::Extension::InxParameter Class Reference

A class to represent the parameter of an extension. More...

#include <parameter.h>

Inheritance diagram for Inkscape::Extension::InxParameter:
Inkscape::Extension::InxWidget Inkscape::Extension::ParamBool Inkscape::Extension::ParamColor Inkscape::Extension::ParamFloat Inkscape::Extension::ParamInt Inkscape::Extension::ParamNotebook Inkscape::Extension::ParamNotebook::ParamNotebookPage Inkscape::Extension::ParamOptionGroup Inkscape::Extension::ParamOptionGroup::ParamOptionGroupOption Inkscape::Extension::ParamPath Inkscape::Extension::ParamString

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 InxParametermake (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 InxWidgetmake (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 }
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ InxParameter()

◆ ~InxParameter()

Inkscape::Extension::InxParameter::~InxParameter ( )
override

Definition at line 269 of file parameter.cpp.

References _description, _name, and _text.

Member Function Documentation

◆ get_bool()

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().

◆ get_color()

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().

◆ get_float()

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().

◆ get_int()

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().

◆ get_optiongroup()

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().

◆ get_optiongroup_contains()

bool Inkscape::Extension::InxParameter::get_optiongroup_contains ( const char *  value) const

◆ get_string()

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().

◆ get_tooltip()

const char * Inkscape::Extension::InxParameter::get_tooltip ( ) const
inlineoverridevirtual

Reimplemented from Inkscape::Extension::InxWidget.

Definition at line 94 of file parameter.h.

References _description.

◆ make()

InxParameter * Inkscape::Extension::InxParameter::make ( Inkscape::XML::Node in_repr,
Inkscape::Extension::Extension in_ext 
)
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.

Parameters
in_reprThe XML representation describing the widget.
in_extThe extension the widget belongs to.
Returns
a pointer to a new Widget if applicable, null otherwise..

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().

◆ name()

◆ pref_name()

◆ set()

const std::string & Inkscape::Extension::InxParameter::set ( const std::string &  in)
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().

◆ set_bool()

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().

◆ set_color()

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().

◆ set_float()

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().

◆ set_int()

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().

◆ set_optiongroup()

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().

◆ set_string()

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().

◆ string_to_value()

void Inkscape::Extension::InxParameter::string_to_value ( const std::string &  in)
virtual

◆ value_to_string()

Member Data Documentation

◆ _description

char* Inkscape::Extension::InxParameter::_description = nullptr
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().

◆ _name

◆ _text

◆ GUI_PARAM_WIDGETS_SPACING

constexpr int Inkscape::Extension::InxParameter::GUI_PARAM_WIDGETS_SPACING = 4
staticconstexpr

The documentation for this class was generated from the following files: