diff options
| author | Alexander Valavanis <valavanisalex@gmail.com> | 2019-05-28 09:52:31 +0000 |
|---|---|---|
| committer | Alexander Valavanis <valavanisalex@gmail.com> | 2019-05-28 09:52:31 +0000 |
| commit | 88bc8d77cc809cc1597823667c142d3c1eee3434 (patch) | |
| tree | 2f158d44d41a58c0f310364f77828d9c909bdce5 /src/ui/widget/spin-button-tool-item.cpp | |
| parent | Strip out all content from TextToolbar (diff) | |
| download | inkscape-88bc8d77cc809cc1597823667c142d3c1eee3434.tar.gz inkscape-88bc8d77cc809cc1597823667c142d3c1eee3434.zip | |
Hackfest2019: TextToolbar: Start GtkAction 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(); } |
