summaryrefslogtreecommitdiff
path: root/libs/gtkmm2ext/utils.cc
diff options
context:
space:
mode:
authorJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>2016-08-16 01:57:58 +0200
committerJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>2016-08-17 01:45:47 +0200
commit6a985df81efcfbe21d077a66245e2ffc80c76a11 (patch)
treec4c2d0f4890f9f8eb7ab7d8588dd3be08a9cb009 /libs/gtkmm2ext/utils.cc
parent46710a75de4083b5ed4bdfd2b1109c20d8929848 (diff)
Replace positioning function with popup helper
Because all uses of the function positioning menus anchored to a widget were as callback argument to Gtk::Menu::popup() where the caller needed to correctly bind arguments, this led to repeated and a bit obscure code. Wrap the logic into an helper function that takes care of all that, and update the callers.
Diffstat (limited to 'libs/gtkmm2ext/utils.cc')
-rw-r--r--libs/gtkmm2ext/utils.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/libs/gtkmm2ext/utils.cc b/libs/gtkmm2ext/utils.cc
index 2b3a29fc0d..4ba85e2f25 100644
--- a/libs/gtkmm2ext/utils.cc
+++ b/libs/gtkmm2ext/utils.cc
@@ -310,10 +310,10 @@ Gtkmm2ext::pixbuf_from_string(const string& name, const Pango::FontDescription&
}
void
-Gtkmm2ext::position_menu_anchored (const Gtk::Menu* const menu,
+_position_menu_anchored (int& x, int& y, bool& push_in,
+ const Gtk::Menu* const menu,
Gtk::Widget* const anchor,
- const std::string& selected,
- int& x, int& y, bool& push_in) {
+ const std::string& selected) {
using namespace Gdk;
using namespace Gtk;
using namespace Gtk::Menu_Helpers;
@@ -417,6 +417,18 @@ Gtkmm2ext::position_menu_anchored (const Gtk::Menu* const menu,
}
void
+Gtkmm2ext::anchored_menu_popup (Gtk::Menu* const menu,
+ Gtk::Widget* const anchor,
+ const std::string& selected,
+ guint button, guint32 time) {
+ menu->popup(
+ sigc::bind (sigc::ptr_fun(&_position_menu_anchored),
+ menu, anchor, selected),
+ button,
+ time);
+}
+
+void
Gtkmm2ext::set_popdown_strings (Gtk::ComboBoxText& cr, const vector<string>& strings)
{
vector<string>::const_iterator i;