diff options
| author | Alexander Valavanis <valavanisalex@gmail.com> | 2018-07-29 13:56:29 +0000 |
|---|---|---|
| committer | Alexander Valavanis <valavanisalex@gmail.com> | 2018-07-29 13:56:29 +0000 |
| commit | aa6dde633662cf5fecea6425b7367eb2b93d53fb (patch) | |
| tree | 947bc444bd17b5ff424e3efcaa17f788e4b1b880 /src/ui/toolbar/toolbar.cpp | |
| parent | change header string (diff) | |
| download | inkscape-aa6dde633662cf5fecea6425b7367eb2b93d53fb.tar.gz inkscape-aa6dde633662cf5fecea6425b7367eb2b93d53fb.zip | |
DropperToolbar: GtkAction migration
Diffstat (limited to 'src/ui/toolbar/toolbar.cpp')
| -rw-r--r-- | src/ui/toolbar/toolbar.cpp | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/src/ui/toolbar/toolbar.cpp b/src/ui/toolbar/toolbar.cpp index e1c9d082f..8a17dcbea 100644 --- a/src/ui/toolbar/toolbar.cpp +++ b/src/ui/toolbar/toolbar.cpp @@ -1,6 +1,8 @@ #include "toolbar.h" +#include <gtkmm/label.h> #include <gtkmm/separatortoolitem.h> +#include <gtkmm/toggletoolbutton.h> #include "desktop.h" @@ -10,17 +12,52 @@ namespace Inkscape { namespace UI { namespace Toolbar { +Gtk::ToolItem * +Toolbar::add_label(const Glib::ustring &label_text) +{ + auto ti = Gtk::manage(new Gtk::ToolItem()); + + // For now, we always enable mnemonic + auto label = Gtk::manage(new Gtk::Label(label_text, true)); + + ti->add(*label); + add(*ti); + + return ti; +} + +/** + * \brief Add a toggle toolbutton to the toolbar + * + * \param[in] label_text The text to display in the toolbar + * \param[in] tooltip_text The tooltip text for the toolitem + * + * \returns The toggle button + */ +Gtk::ToggleToolButton * +Toolbar::add_toggle_button(const Glib::ustring &label_text, + const Glib::ustring &tooltip_text) +{ + auto btn = Gtk::manage(new Gtk::ToggleToolButton(label_text)); + btn->set_tooltip_text(tooltip_text); + add(*btn); + return btn; +} + /** * \brief Add a toolbutton that performs a given verb * * \param[in] verb_code The code for the verb (e.g., SP_VERB_EDIT_SELECT_ALL) + * + * \returns a pointer to the toolbutton */ -void +Gtk::ToolButton * Toolbar::add_toolbutton_for_verb(unsigned int verb_code) { auto context = Inkscape::ActionContext(_desktop); auto button = SPAction::create_toolbutton_for_verb(verb_code, context); add(*button); + return button; } /** |
