blob: a1e976e838daf7210819a07cf159fcf5e1fa6932 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef INK_EXTENSION_PARAMOPTIONGROUP_H_SEEN
#define INK_EXTENSION_PARAMOPTIONGROUP_H_SEEN
/** \file
* extension parameter for options with multiple predefined value choices
*
* Currently implemented as either Gtk::RadioButton or Gtk::ComboBoxText
*/
/*
* Authors:
* Johan Engelen <johan@shouraizou.nl>
* Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2006-2007 Johan Engelen
*
* Released under GNU GPL v2+, read the file 'COPYING' for more information.
*/
#include "parameter.h"
#include <vector>
#include <glibmm/ustring.h>
namespace Gtk {
class Widget;
}
namespace Inkscape {
namespace Extension {
class Extension;
// \brief A class to represent an optiongroup (option with multiple predefined value choices) parameter of an extension
class ParamOptionGroup : public InxParameter {
public:
enum AppearanceMode {
RADIOBUTTON, COMBOBOX
};
ParamOptionGroup(Inkscape::XML::Node *xml, Inkscape::Extension::Extension *ext);
~ParamOptionGroup() override;
Gtk::Widget *get_widget(sigc::signal<void ()> *changeSignal) override;
std::string value_to_string() const override;
void string_to_value(const std::string &in) override;
Glib::ustring value_from_label(const Glib::ustring label);
const Glib::ustring& get() const { return _value; }
const Glib::ustring &set(const Glib::ustring &in);
/**
* @returns true if text is a valid choice for this option group
* @param text string value to check (this is an actual option value, not the user-visible option name!)
*/
bool contains(const Glib::ustring text) const;
private:
/** \brief Internal value. */
Glib::ustring _value;
/** appearance mode **/
AppearanceMode _mode = RADIOBUTTON;
/* For internal use only. */
class ParamOptionGroupOption : public InxParameter {
friend class ParamOptionGroup;
public:
ParamOptionGroupOption(Inkscape::XML::Node *xml, Inkscape::Extension::Extension *ext,
const Inkscape::Extension::ParamOptionGroup *parent);
private:
Glib::ustring _value;
Glib::ustring _text;
};
std::vector<ParamOptionGroupOption *> choices; /**< List of available options for the option group */
}; /* class ParamOptionGroup */
} /* namespace Extension */
} /* namespace Inkscape */
#endif /*INK_EXTENSION_PARAMOPTIONGROUP_H_SEEN */
/*
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 :
|