Code

r11512@tres: ted | 2006-04-24 21:36:08 -0700
[inkscape.git] / src / extension / parameter.h
index d527421edfdedec84d13a1308add8d130bd018d5..67cceff60c935a00ef6b001d2d431d43d30230cc 100644 (file)
 namespace Inkscape {
 namespace Extension {
 
+/** \brief  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.
+*/
 class Parameter {
 private:
     /** \brief  Which extension is this parameter attached to? */
@@ -29,13 +36,32 @@ private:
     gchar *       _name;
 
 protected:
+    /** \brief  Description of the parameter. */
+    gchar *       _desc;
+    /** \brief  List of possible scopes. */
+    typedef enum {
+        SCOPE_USER,     /**<  Parameter value is saved in the user's configuration file. (default) */
+        SCOPE_DOCUMENT, /**<  Parameter value is saved in the document. */
+        SCOPE_NODE      /**<  Parameter value is attached to the node. */
+    } _scope_t;
+    /** \brief  Scope of the parameter. */
+    _scope_t _scope;
     /** \brief  Text for the GUI selection of this. */
     gchar *       _text;
     gchar *       pref_name (void);
 
 public:
-    Parameter (const gchar * name, const gchar * guitext, Inkscape::Extension::Extension * ext);
-    virtual ~Parameter(void);
+                  Parameter  (const gchar * name,
+                              const gchar * guitext,
+                              const gchar * desc,
+                              const Parameter::_scope_t scope,
+                              Inkscape::Extension::Extension * ext);
+                  Parameter  (const gchar * name,
+                              const gchar * guitext,
+                              Inkscape::Extension::Extension * ext) {
+                      Parameter(name, guitext, NULL, Parameter::SCOPE_USER, ext);
+                  };
+    virtual      ~Parameter  (void);
     bool          get_bool   (const Inkscape::XML::Document * doc,
                               const Inkscape::XML::Node * node);
     int           get_int    (const Inkscape::XML::Document * doc,
@@ -55,6 +81,7 @@ public:
     static Parameter * make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * in_ext);
     virtual Gtk::Widget * get_widget (void);
     virtual Glib::ustring * string (void);
+    gchar const * get_tooltip (void) { return _desc; }
 };