13
0

Add ArdourDropdown API for use as dumb text dropdown.

This commit is contained in:
Robin Gareus 2018-01-30 15:21:45 +01:00
parent e6b8a0d95b
commit f979463cfe
2 changed files with 18 additions and 0 deletions

View File

@ -28,6 +28,7 @@
#include "pbd/stacktrace.h"
#include "gtkmm2ext/utils.h"
#include "gtkmm2ext/menu_elems.h"
#include "gtkmm2ext/rgb_macros.h"
#include "gtkmm2ext/gui_thread.h"
@ -162,3 +163,15 @@ ArdourDropdown::disable_scrolling()
{
_scrolling_disabled = true;
}
void
ArdourDropdown::append_text_item (std::string const& text) {
using namespace Gtkmm2ext;
AddMenuElem (MenuElemNoMnemonic (text, sigc::bind (sigc::mem_fun (*this, &ArdourDropdown::default_text_handler), text)));
}
void
ArdourDropdown::default_text_handler (std::string const& text) {
set_text (text);
StateChanged (); /* EMIT SIGNAL */
}

View File

@ -49,6 +49,11 @@ public:
Gtk::Menu_Helpers::MenuList& items () { return _menu.items (); }
void append_text_item (std::string const& text);
protected:
void default_text_handler (std::string const& text);
private:
Gtk::Menu _menu;