Code

copyedit
[inkscape.git] / src / ui / widget / attr-widget.h
index c87e860d5da882c6b3dea4eef091b9f6ca6a44d0..8abe6b1bab1fcc4f0a67c27459cf5614696d13cd 100644 (file)
@@ -16,6 +16,7 @@
 #include "attributes.h"
 #include "sp-object.h"
 #include "xml/node.h"
+#include <gtkmm/tooltips.h>
 
 namespace Inkscape {
 namespace UI {
@@ -26,7 +27,9 @@ enum DefaultValueType
     T_NONE,
     T_DOUBLE,
     T_VECT_DOUBLE,
-    T_BOOL
+    T_BOOL,
+    T_UINT,
+    T_CHARPTR
 };
 
 class DefaultValueHolder
@@ -36,6 +39,8 @@ class DefaultValueHolder
         double d_val;
         std::vector<double>* vt_val;
         bool b_val;
+        unsigned int uint_val;
+        char* cptr_val;
     } value;
 
     //FIXME remove copy ctor and assignment operator as private to avoid double free of the vector
@@ -54,16 +59,31 @@ public:
         value.vt_val = d;
     }
 
+    DefaultValueHolder (char* c) {
+        type = T_CHARPTR;
+        value.cptr_val = c;
+    }
+
     DefaultValueHolder (bool d) {
         type = T_BOOL;
         value.b_val = d;
     }
 
+    DefaultValueHolder (unsigned int ui) {
+        type = T_UINT;
+        value.uint_val = ui;
+    }
+
     ~DefaultValueHolder() {
         if (type == T_VECT_DOUBLE)
             delete value.vt_val;
     }
 
+    unsigned int as_uint() {
+        g_assert (type == T_UINT);
+        return value.uint_val;
+    }
+
     bool as_bool() {
         g_assert (type == T_BOOL);
         return value.b_val;
@@ -78,11 +98,21 @@ public:
         g_assert (type == T_VECT_DOUBLE);
         return value.vt_val;
     }
+
+    char* as_charptr() {
+        g_assert (type == T_CHARPTR);
+        return value.cptr_val;
+    }
 };
 
 class AttrWidget
 {
 public:
+    AttrWidget(const SPAttributeEnum a, unsigned int value)
+        : _attr(a),
+          _default(value)
+    {}
+
     AttrWidget(const SPAttributeEnum a, double value)
         : _attr(a),
           _default(value)
@@ -125,6 +155,9 @@ protected:
         return 0;
     }
 
+protected:
+    Gtk::Tooltips _tt;
+
 private:
     const SPAttributeEnum _attr;
     DefaultValueHolder _default;