From 02abf956d7b3b77a6511a953adcbfc8809e7a6b3 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 25 Jun 2025 22:17:53 -0600 Subject: [PATCH] a better way to build ArdourDropdowns from Actions --- libs/widgets/ardour_dropdown.cc | 6 ++++++ libs/widgets/widgets/ardour_dropdown.h | 1 + 2 files changed, 7 insertions(+) diff --git a/libs/widgets/ardour_dropdown.cc b/libs/widgets/ardour_dropdown.cc index 63c89c72ff..3873b4ab67 100644 --- a/libs/widgets/ardour_dropdown.cc +++ b/libs/widgets/ardour_dropdown.cc @@ -195,3 +195,9 @@ ArdourDropdown::default_text_handler (std::string const& text) { set_text (text); StateChanged (); /* EMIT SIGNAL */ } + +void +ArdourDropdown::append (Glib::RefPtr action) +{ + _menu.items().push_back (Menu_Helpers::MenuElem (action->get_short_label(), sigc::mem_fun (action.get(), &Action::activate))); +} diff --git a/libs/widgets/widgets/ardour_dropdown.h b/libs/widgets/widgets/ardour_dropdown.h index 9247b544a1..57550d72ec 100644 --- a/libs/widgets/widgets/ardour_dropdown.h +++ b/libs/widgets/widgets/ardour_dropdown.h @@ -45,6 +45,7 @@ public: void clear_items (); void AddMenuElem (Gtk::Menu_Helpers::Element e); + void append (Glib::RefPtr); void disable_scrolling();