13
0

Make Dropdown menus at least as wide as the button

This commit is contained in:
Julien "_FrnchFrgg_" RIVAUD 2016-08-07 18:43:39 +02:00
parent 5f6cec7c2f
commit 5dd4c33915
2 changed files with 7 additions and 0 deletions

View File

@ -50,6 +50,7 @@ ArdourDropdown::ArdourDropdown (Element e)
: _scrolling_disabled(false)
{
// signal_button_press_event().connect (sigc::mem_fun(*this, &ArdourDropdown::on_mouse_pressed));
_menu.signal_size_request().connect (sigc::mem_fun(*this, &ArdourDropdown::menu_size_request));
add_elements(e);
add_elements(ArdourButton::Menu);
@ -59,6 +60,11 @@ ArdourDropdown::~ArdourDropdown ()
{
}
void
ArdourDropdown::menu_size_request(Requisition *req) {
req->width = max(req->width, get_allocation().get_width());
}
void
ArdourDropdown::position_menu(int& x, int& y, bool& push_in) {
using namespace Menu_Helpers;

View File

@ -39,6 +39,7 @@ class ArdourDropdown : public ArdourButton
bool on_button_press_event (GdkEventButton*);
bool on_scroll_event (GdkEventScroll*);
void position_menu(int&, int&, bool&);
void menu_size_request(Gtk::Requisition*);
void clear_items ();
void AddMenuElem (Gtk::Menu_Helpers::Element e);