diff options
| author | Alexander Valavanis <valavanisalex@gmail.com> | 2019-06-05 19:34:19 +0000 |
|---|---|---|
| committer | Alexander Valavanis <valavanisalex@gmail.com> | 2019-06-05 19:34:19 +0000 |
| commit | 346e764345e1fbf877307313cd4779874dfd3ed9 (patch) | |
| tree | d5c326e85f752a1cd54301bc19592d90d9445e51 /src/ui/widget/spin-button-tool-item.cpp | |
| parent | Merge changes (diff) | |
| parent | Finish TextToolbar migration (diff) | |
| download | inkscape-346e764345e1fbf877307313cd4779874dfd3ed9.tar.gz inkscape-346e764345e1fbf877307313cd4779874dfd3ed9.zip | |
Merge branch 'text-toolbar-migration'
Diffstat (limited to 'src/ui/widget/spin-button-tool-item.cpp')
| -rw-r--r-- | src/ui/widget/spin-button-tool-item.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/ui/widget/spin-button-tool-item.cpp b/src/ui/widget/spin-button-tool-item.cpp index f8c285344..e190d8dd2 100644 --- a/src/ui/widget/spin-button-tool-item.cpp +++ b/src/ui/widget/spin-button-tool-item.cpp @@ -3,6 +3,7 @@ #include "spin-button-tool-item.h" #include <gtkmm/box.h> +#include <gtkmm/image.h> #include <gtkmm/radiomenuitem.h> #include <gtkmm/toolbar.h> @@ -390,14 +391,28 @@ SpinButtonToolItem::SpinButtonToolItem(const Glib::ustring name, _btn->add_events(Gdk::KEY_PRESS_MASK); // Create a label - auto label = Gtk::manage(new Gtk::Label(label_text)); + _label = Gtk::manage(new Gtk::Label(label_text)); // Arrange the widgets in a horizontal box - auto hbox = Gtk::manage(new Gtk::Box()); - hbox->set_spacing(3); - hbox->pack_start(*label); - hbox->pack_start(*_btn); - add(*hbox); + _hbox = Gtk::manage(new Gtk::Box()); + _hbox->set_spacing(3); + _hbox->pack_start(*_label); + _hbox->pack_start(*_btn); + add(*_hbox); + show_all(); +} + +void +SpinButtonToolItem::set_icon(const Glib::ustring& icon_name) +{ + _hbox->remove(*_label); + _icon = Gtk::manage(new Gtk::Image(icon_name, Gtk::ICON_SIZE_SMALL_TOOLBAR)); + + if(_icon) { + _hbox->pack_start(*_icon); + _hbox->reorder_child(*_icon, 0); + } + show_all(); } |
