From 6bac625e4cd3df47c3086413b27b0b8ac18cf32c Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 22 Jan 2018 17:16:55 +0100 Subject: Add pixmap and data (pointer) members to column. --- src/ui/widget/ink-select-one-action.cpp | 8 +++++++- src/ui/widget/ink-select-one-action.h | 12 +++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'src/ui/widget') diff --git a/src/ui/widget/ink-select-one-action.cpp b/src/ui/widget/ink-select-one-action.cpp index 42a63adf0..da130ec1d 100644 --- a/src/ui/widget/ink-select-one-action.cpp +++ b/src/ui/widget/ink-select-one-action.cpp @@ -53,6 +53,7 @@ InkSelectOneAction::InkSelectOneAction (const Glib::ustring &name, _use_radio (true), _use_label (true), _use_icon (true), + _use_pixbuf (false), _icon_size ( Gtk::ICON_SIZE_LARGE_TOOLBAR ), _combobox (nullptr), _radioaction (nullptr), @@ -192,11 +193,16 @@ Gtk::Widget* InkSelectOneAction::create_tool_item_vfunc() { _combobox->set_model(_store); InkSelectOneActionColumns columns; - if (_use_icon ) { + if (_use_icon) { Gtk::CellRendererPixbuf *renderer = new Gtk::CellRendererPixbuf; renderer->set_property ("stock_size", Gtk::ICON_SIZE_LARGE_TOOLBAR); _combobox->pack_start (*renderer, false); _combobox->add_attribute (*renderer, "icon_name", columns.col_icon ); + } else if (_use_pixbuf) { + Gtk::CellRendererPixbuf *renderer = new Gtk::CellRendererPixbuf; + //renderer->set_property ("stock_size", Gtk::ICON_SIZE_LARGE_TOOLBAR); + _combobox->pack_start (*renderer, false); + _combobox->add_attribute (*renderer, "pixbuf", columns.col_pixbuf ); } if (_use_label) { diff --git a/src/ui/widget/ink-select-one-action.h b/src/ui/widget/ink-select-one-action.h index a50242bad..c95407797 100644 --- a/src/ui/widget/ink-select-one-action.h +++ b/src/ui/widget/ink-select-one-action.h @@ -37,11 +37,15 @@ public: InkSelectOneActionColumns() { add (col_label); add (col_icon); + add (col_pixbuf); + add (col_data); // Used to store a pointer add (col_tooltip); add (col_sensitive); } Gtk::TreeModelColumn col_label; Gtk::TreeModelColumn col_icon; + Gtk::TreeModelColumn > col_pixbuf; + Gtk::TreeModelColumn col_data; Gtk::TreeModelColumn col_tooltip; Gtk::TreeModelColumn col_sensitive; }; @@ -58,9 +62,10 @@ public: Glib::RefPtr store ); /* Style of action */ - void use_radio( bool use_radio ) { _use_radio = use_radio; } - void use_label( bool use_label ) { _use_label = use_label; } - void use_icon( bool use_icon ) { _use_icon = use_icon; } + void use_radio( bool use_radio ) { _use_radio = use_radio; } + void use_label( bool use_label ) { _use_label = use_label; } + void use_icon( bool use_icon ) { _use_icon = use_icon; } + void use_pixbuf( bool use_pixbuf ) { _use_pixbuf = use_pixbuf; } void use_group_label( bool use_group_label ) { _use_group_label = use_group_label; } gint get_active() { return _active; } @@ -94,6 +99,7 @@ private: bool _use_radio; // Applies to tool item only bool _use_label; bool _use_icon; // Applies to menu item only + bool _use_pixbuf; bool _use_group_label; // Applies to tool item only Gtk::BuiltinIconSize _icon_size; -- cgit v1.2.3