1
#ifndef INKSCAPE_LIVEPATHEFFECT_PARAMETER_ENUM_H
2
#define INKSCAPE_LIVEPATHEFFECT_PARAMETER_ENUM_H
5
* Inkscape::LivePathEffectParameters
7
* Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
9
* Released under GNU GPL, read the file 'COPYING' for more information
12
#include <glib/gtypes.h>
14
#include "ui/widget/registry.h"
15
#include "ui/widget/registered-enums.h"
16
#include <gtkmm/tooltips.h>
18
#include "live_effects/parameter/parameter.h"
23
namespace LivePathEffect {
25
template<typename E> class EnumParam : public Parameter {
27
EnumParam( const Glib::ustring& label,
28
const Glib::ustring& tip,
29
const Glib::ustring& key,
30
const Util::EnumDataConverter<E>& c,
31
Inkscape::UI::Widget::Registry* wr,
34
: Parameter(label, tip, key, wr, effect)
37
defvalue = default_value;
41
virtual ~EnumParam() { };
43
virtual Gtk::Widget * param_newWidget(Gtk::Tooltips * /*tooltips*/) {
44
Inkscape::UI::Widget::RegisteredEnum<E> *regenum = Gtk::manage (
45
new Inkscape::UI::Widget::RegisteredEnum<E>( param_label, param_tooltip,
46
param_key, *enumdataconv, *param_wr, param_effect->getRepr(), param_effect->getSPDoc() ) );
48
regenum->set_active_by_id(value);
49
regenum->combobox()->setProgrammatically = false;
50
regenum->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change enumeration parameter"));
52
return dynamic_cast<Gtk::Widget *> (regenum);
55
bool param_readSVGValue(const gchar * strvalue) {
61
param_set_value( enumdataconv->get_id_from_key(Glib::ustring(strvalue)) );
65
gchar * param_writeSVGValue() const {
66
gchar * str = g_strdup( enumdataconv->get_key(value).c_str() );
74
void param_set_default() {
75
param_set_value(defvalue);
78
void param_set_value(E val) {
83
EnumParam(const EnumParam&);
84
EnumParam& operator=(const EnumParam&);
89
const Util::EnumDataConverter<E> * enumdataconv;
93
}; //namespace LivePathEffect
95
}; //namespace Inkscape