index c87e860d5da882c6b3dea4eef091b9f6ca6a44d0..8abe6b1bab1fcc4f0a67c27459cf5614696d13cd 100644 (file)
#include "attributes.h"
#include "sp-object.h"
#include "xml/node.h"
#include "attributes.h"
#include "sp-object.h"
#include "xml/node.h"
+#include <gtkmm/tooltips.h>
namespace Inkscape {
namespace UI {
namespace Inkscape {
namespace UI {
T_NONE,
T_DOUBLE,
T_VECT_DOUBLE,
T_NONE,
T_DOUBLE,
T_VECT_DOUBLE,
- T_BOOL
+ T_BOOL,
+ T_UINT,
+ T_CHARPTR
};
class DefaultValueHolder
};
class DefaultValueHolder
double d_val;
std::vector<double>* vt_val;
bool b_val;
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
} value;
//FIXME remove copy ctor and assignment operator as private to avoid double free of the vector
value.vt_val = d;
}
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 (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;
}
~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;
bool as_bool() {
g_assert (type == T_BOOL);
return value.b_val;
g_assert (type == T_VECT_DOUBLE);
return value.vt_val;
}
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:
};
class AttrWidget
{
public:
+ AttrWidget(const SPAttributeEnum a, unsigned int value)
+ : _attr(a),
+ _default(value)
+ {}
+
AttrWidget(const SPAttributeEnum a, double value)
: _attr(a),
_default(value)
AttrWidget(const SPAttributeEnum a, double value)
: _attr(a),
_default(value)
return 0;
}
return 0;
}
+protected:
+ Gtk::Tooltips _tt;
+
private:
const SPAttributeEnum _attr;
DefaultValueHolder _default;
private:
const SPAttributeEnum _attr;
DefaultValueHolder _default;