From 5b4ddfaee3979a1b8290ed8381f3a4cda6ce7a8e Mon Sep 17 00:00:00 2001 From: gustav_b Date: Thu, 17 Jan 2008 00:56:37 +0000 Subject: RegisteredColorPicker is now subclassed from RegisteredWidget instead of old RegisteredWdg (bzr r4530) --- src/ui/widget/registered-widget.cpp | 37 ++++++++++++++++++------------------- src/ui/widget/registered-widget.h | 34 ++++++++++++++-------------------- 2 files changed, 32 insertions(+), 39 deletions(-) (limited to 'src/ui/widget') 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 (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 { 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; -- cgit v1.2.3