Code

r11450@tres: ted | 2006-04-17 22:08:15 -0700
[inkscape.git] / src / extension / parameter.h
1 #ifndef __INK_EXTENSION_PARAM_H__
2 #define __INK_EXTENSION_PARAM_H__
4 /** \file
5  * Parameters for extensions.
6  */
8 /*
9  * Authors:
10  *   Ted Gould <ted@gould.cx>
11  *
12  * Copyright (C) 2005 Authors
13  *
14  * Released under GNU GPL, read the file 'COPYING' for more information
15  */
16 #include <gtkmm/widget.h>
18 #include "xml/document.h"
19 #include "extension-forward.h"
21 namespace Inkscape {
22 namespace Extension {
24 class Parameter {
25 private:
26     /** \brief  Which extension is this parameter attached to? */
27     Inkscape::Extension::Extension * extension;
28     /** \brief  The name of this parameter. */
29     gchar *       _name;
30     /** \brief  Description of the parameter. */
31     gchar *       _desc;
32     /** \brief  List of possible scopes. */
33     typedef enum {
34         SCOPE_USER,     /**<  Parameter value is saved in the user's configuration file. (default) */
35         SCOPE_DOCUMENT, /**<  Parameter value is saved in the document. */
36         SCOPE_NODE      /**<  Parameter value is attached to the node. */
37     } _scope_t;
38     /** \brief  Scope of the parameter. */
39     _scope_t _scope;
41 protected:
42     /** \brief  Text for the GUI selection of this. */
43     gchar *       _text;
44     gchar *       pref_name (void);
46 public:
47                   Parameter  (const gchar * name,
48                               const gchar * guitext,
49                               const gchar * desc,
50                               const Parameter::_scope_t scope,
51                               Inkscape::Extension::Extension * ext);
52                   Parameter  (const gchar * name,
53                               const gchar * guitext,
54                               Inkscape::Extension::Extension * ext) {
55                       Parameter(name, guitext, NULL, Parameter::SCOPE_USER, ext);
56                   };
57     virtual      ~Parameter  (void);
58     bool          get_bool   (const Inkscape::XML::Document * doc,
59                               const Inkscape::XML::Node * node);
60     int           get_int    (const Inkscape::XML::Document * doc,
61                               const Inkscape::XML::Node * node);
62     float         get_float  (const Inkscape::XML::Document * doc,
63                               const Inkscape::XML::Node * node);
64     const gchar * get_string (const Inkscape::XML::Document * doc,
65                               const Inkscape::XML::Node * node);
67     bool          set_bool   (bool in,          Inkscape::XML::Document * doc, Inkscape::XML::Node * node);
68     int           set_int    (int  in,          Inkscape::XML::Document * doc, Inkscape::XML::Node * node);
69     float         set_float  (float in,         Inkscape::XML::Document * doc, Inkscape::XML::Node * node);
70     const gchar * set_string (const gchar * in, Inkscape::XML::Document * doc, Inkscape::XML::Node * node);
72     const gchar * name       (void) {return _name;}
74     static Parameter * make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * in_ext);
75     virtual Gtk::Widget * get_widget (void);
76     virtual Glib::ustring * string (void);
77 };
80 }  /* namespace Extension */
81 }  /* namespace Inkscape */
83 #endif /* __INK_EXTENSION_PARAM_H__ */
85 /*
86   Local Variables:
87   mode:c++
88   c-file-style:"stroustrup"
89   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
90   indent-tabs-mode:nil
91   fill-column:99
92   End:
93 */
94 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :