From c7f3577f6c28f0a4f452b194a39e910cdb193e02 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Thu, 12 Sep 2019 08:31:44 +0200 Subject: Fix non changing value on combobox. This can also be used in other toolbars --- src/ui/widget/combo-box-entry-tool-item.cpp | 8 ++++++++ src/ui/widget/combo-box-entry-tool-item.h | 1 + src/ui/widget/combo-tool-item.cpp | 9 +++++++-- src/ui/widget/combo-tool-item.h | 1 + 4 files changed, 17 insertions(+), 2 deletions(-) (limited to 'src/ui/widget') diff --git a/src/ui/widget/combo-box-entry-tool-item.cpp b/src/ui/widget/combo-box-entry-tool-item.cpp index 48f9cb856..f3786c6f6 100644 --- a/src/ui/widget/combo-box-entry-tool-item.cpp +++ b/src/ui/widget/combo-box-entry-tool-item.cpp @@ -334,6 +334,14 @@ ComboBoxEntryToolItem::set_extra_width( gint extra_width ) } } +void +ComboBoxEntryToolItem::focus_on_click( bool focus_on_click ) +{ + if (_combobox) { + gtk_widget_set_focus_on_click(GTK_WIDGET(_combobox), focus_on_click); + } +} + void ComboBoxEntryToolItem::popup_enable() { diff --git a/src/ui/widget/combo-box-entry-tool-item.h b/src/ui/widget/combo-box-entry-tool-item.h index 2c2b71542..3d6440aff 100644 --- a/src/ui/widget/combo-box-entry-tool-item.h +++ b/src/ui/widget/combo-box-entry-tool-item.h @@ -102,6 +102,7 @@ public: void popup_enable(); void popup_disable(); + void focus_on_click( bool focus_on_click ); void set_info( const gchar* info ); void set_info_cb( gpointer info_cb ); diff --git a/src/ui/widget/combo-tool-item.cpp b/src/ui/widget/combo-tool-item.cpp index c3adf921f..ce366d0fc 100644 --- a/src/ui/widget/combo-tool-item.cpp +++ b/src/ui/widget/combo-tool-item.cpp @@ -58,7 +58,6 @@ ComboToolItem::ComboToolItem(Glib::ustring group_label, { Gtk::Box* box = Gtk::manage(new Gtk::Box()); add(*box); - if (_use_group_label) { Gtk::Label *group_label = Gtk::manage (new Gtk::Label( _group_label + ": " )); box->add( *group_label ); @@ -72,12 +71,18 @@ ComboToolItem::ComboToolItem(Glib::ustring group_label, _combobox->signal_changed().connect( sigc::mem_fun(*this, &ComboToolItem::on_changed_combobox)); - box->add (*_combobox); show_all(); } +void +ComboToolItem::focus_on_click( bool focus_on_click ) +{ + _combobox->set_focus_on_click(focus_on_click); +} + + void ComboToolItem::use_label(bool use_label) { diff --git a/src/ui/widget/combo-tool-item.h b/src/ui/widget/combo-tool-item.h index 6a612256f..125208239 100644 --- a/src/ui/widget/combo-tool-item.h +++ b/src/ui/widget/combo-tool-item.h @@ -62,6 +62,7 @@ public: /* Style of combobox */ void use_label( bool use_label ); void use_icon( bool use_icon ); + void focus_on_click( bool focus_on_click ); void use_pixbuf( bool use_pixbuf ); void use_group_label( bool use_group_label ) { _use_group_label = use_group_label; } -- cgit v1.2.3