mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-21 14:16:31 +01:00
[Summary] Progressing dropdown
This commit is contained in:
parent
e59ebf02bb
commit
96003844c0
3 changed files with 7 additions and 18 deletions
|
|
@ -41,14 +41,18 @@ WavesDropdown::add_menu_item (const std::string& item, void* cookie)
|
||||||
{
|
{
|
||||||
Gtk::Menu_Helpers::MenuList& items = _menu.items ();
|
Gtk::Menu_Helpers::MenuList& items = _menu.items ();
|
||||||
|
|
||||||
items.push_back (Gtk::Menu_Helpers::MenuElem (item, sigc::bind (sigc::mem_fun(*this, &WavesDropdown::_on_menu_item), cookie)));
|
items.push_back (Gtk::Menu_Helpers::MenuElem (item, sigc::bind (sigc::mem_fun(*this, &WavesDropdown::_on_menu_item), items.size (), cookie)));
|
||||||
|
|
||||||
return _menu.items ().back ();
|
return _menu.items ().back ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
WavesDropdown::_on_menu_item (void* cookie)
|
WavesDropdown::_on_menu_item (size_t item_number, void* cookie)
|
||||||
{
|
{
|
||||||
|
Gtk::Menu_Helpers::MenuList& items = _menu.items ();
|
||||||
|
Gtk::Menu_Helpers::MenuList::iterator i = items.begin();
|
||||||
|
std::advance (i, item_number);
|
||||||
|
set_text ((*i).get_label());
|
||||||
signal_menu_item_clicked (this, cookie);
|
signal_menu_item_clicked (this, cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,18 +75,4 @@ WavesDropdown::_on_popup_menu_position (int& x, int& y, bool& push_in)
|
||||||
x += xo;
|
x += xo;
|
||||||
y += yo;
|
y += yo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if (get_window ()) {
|
|
||||||
Gtk::Allocation a = get_allocation ();
|
|
||||||
|
|
||||||
int xo;
|
|
||||||
int yo;
|
|
||||||
|
|
||||||
get_window ()->get_origin (xo, yo);
|
|
||||||
|
|
||||||
x = xo;
|
|
||||||
y = yo + a.get_height ();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ class WavesDropdown : public WavesIconButton
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Gtk::Menu _menu;
|
Gtk::Menu _menu;
|
||||||
void _on_menu_item (void* cookie);
|
void _on_menu_item (size_t item_number, void* cookie);
|
||||||
void _on_popup_menu_position (int& x, int& y, bool& push_in);
|
void _on_popup_menu_position (int& x, int& y, bool& push_in);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -463,7 +463,6 @@ WavesUI::create_ui (const XMLNodeList& definition, const XMLNodeMap& styles, Gtk
|
||||||
WavesDropdown* dropdown = dynamic_cast<WavesDropdown*> (&root);
|
WavesDropdown* dropdown = dynamic_cast<WavesDropdown*> (&root);
|
||||||
|
|
||||||
if (dropdown) {
|
if (dropdown) {
|
||||||
dbg_msg ("launching dropdown->create_menu ()");
|
|
||||||
add_dropdown_items (*dropdown, definition, styles);
|
add_dropdown_items (*dropdown, definition, styles);
|
||||||
} else {
|
} else {
|
||||||
for (XMLNodeList::const_iterator i = definition.begin (); i != definition.end (); ++i) {
|
for (XMLNodeList::const_iterator i = definition.begin (); i != definition.end (); ++i) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue