diff options
| author | gustav_b <gustav_b@users.sourceforge.net> | 2008-01-17 00:56:37 +0000 |
|---|---|---|
| committer | gustav_b <gustav_b@users.sourceforge.net> | 2008-01-17 00:56:37 +0000 |
| commit | 5b4ddfaee3979a1b8290ed8381f3a4cda6ce7a8e (patch) | |
| tree | c45bd9a4c80cf63a65c72c028def5bd60a7a70f7 /src/ui/widget | |
| parent | now act on settings in dialogue (diff) | |
| download | inkscape-5b4ddfaee3979a1b8290ed8381f3a4cda6ce7a8e.tar.gz inkscape-5b4ddfaee3979a1b8290ed8381f3a4cda6ce7a8e.zip | |
RegisteredColorPicker is now subclassed from RegisteredWidget<ColorPicker> instead of old RegisteredWdg
(bzr r4530)
Diffstat (limited to 'src/ui/widget')
| -rw-r--r-- | src/ui/widget/registered-widget.cpp | 37 | ||||
| -rw-r--r-- | src/ui/widget/registered-widget.h | 34 |
2 files changed, 32 insertions, 39 deletions
diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index 4d0e05e98..629de910f 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -293,42 +293,41 @@ RegisteredScalar::on_value_changed() * Registered COLORPICKER */ -RegisteredColorPicker::RegisteredColorPicker() -: _label(0), _cp(0) -{ -} - -RegisteredColorPicker::~RegisteredColorPicker() -{ - _changed_connection.disconnect(); - if (_cp) delete _cp; - if (_label) delete _label; -} - -void -RegisteredColorPicker::init (const Glib::ustring& label, const Glib::ustring& title, const Glib::ustring& tip, const Glib::ustring& ckey, const Glib::ustring& akey, Registry& wr, Inkscape::XML::Node* repr_in, SPDocument *doc_in) +RegisteredColorPicker::RegisteredColorPicker(const Glib::ustring& label, + const Glib::ustring& title, + const Glib::ustring& tip, + const Glib::ustring& ckey, + const Glib::ustring& akey, + Registry& wr, + Inkscape::XML::Node* repr_in, + SPDocument *doc_in) + : RegisteredWidget<ColorPicker> (title, tip, 0, true) { init_parent("", wr, repr_in, doc_in); _label = new Gtk::Label (label, 1.0, 0.5); _label->set_use_underline (true); - _cp = new ColorPicker (title,tip,0,true); - _label->set_mnemonic_widget (*_cp); + _label->set_mnemonic_widget (*this); _ckey = ckey; _akey = akey; - _changed_connection = _cp->connectChanged (sigc::mem_fun (*this, &RegisteredColorPicker::on_changed)); + _changed_connection = connectChanged (sigc::mem_fun (*this, &RegisteredColorPicker::on_changed)); +} + +RegisteredColorPicker::~RegisteredColorPicker() +{ + _changed_connection.disconnect(); } void RegisteredColorPicker::setRgba32 (guint32 rgba) { - _cp->setRgba32 (rgba); + ColorPicker::setRgba32 (rgba); } void RegisteredColorPicker::closeWindow() { - _cp->closeWindow(); + ColorPicker::closeWindow(); } void diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h index 3d99aec5b..e6281e0ef 100644 --- a/src/ui/widget/registered-widget.h +++ b/src/ui/widget/registered-widget.h @@ -23,6 +23,7 @@ #include "ui/widget/point.h" #include "ui/widget/random.h" +#include "ui/widget/color-picker.h" #include "inkscape.h" #include "document.h" @@ -42,7 +43,6 @@ namespace Inkscape { namespace UI { namespace Widget { -class ColorPicker; class Registry; class Scalar; class ScalarUnit; @@ -71,6 +71,8 @@ protected: RegisteredWidget( A& a, B& b ): W( a, b ) { construct(); } template< typename A, typename B, typename C > RegisteredWidget( A& a, B& b, C& c ): W( a, b, c ) { construct(); } + template< typename A, typename B, typename C, typename D > + RegisteredWidget( A& a, B& b, C c, D d ): W( a, b, c, d ) { construct(); } virtual ~RegisteredWidget() {}; @@ -262,31 +264,23 @@ protected: void on_value_changed(); }; -class RegisteredColorPicker : public RegisteredWdg { +class RegisteredColorPicker : public RegisteredWidget<ColorPicker> { public: - RegisteredColorPicker(); - ~RegisteredColorPicker(); - void init (const Glib::ustring& label, - const Glib::ustring& title, - const Glib::ustring& tip, - const Glib::ustring& ckey, - const Glib::ustring& akey, - Registry& wr, - Inkscape::XML::Node* repr_in, - SPDocument *doc_in); - inline void init ( const Glib::ustring& label, - const Glib::ustring& title, - const Glib::ustring& tip, - const Glib::ustring& ckey, - const Glib::ustring& akey, - Registry& wr) - { init(label, title, tip, ckey, akey, wr, NULL, NULL); }; + virtual ~RegisteredColorPicker(); + + RegisteredColorPicker (const Glib::ustring& label, + const Glib::ustring& title, + const Glib::ustring& tip, + const Glib::ustring& ckey, + const Glib::ustring& akey, + Registry& wr, + Inkscape::XML::Node* repr_in = NULL, + SPDocument *doc_in = NULL); void setRgba32 (guint32); void closeWindow(); Gtk::Label *_label; - ColorPicker *_cp; protected: Glib::ustring _ckey, _akey; |
