add API to get combobox option count.
[ardour.git] / libs / gtkmm2ext / utils.cc
index 6efa95ac1a36e83ae57ea703a386d4ddf2f5a439..f1616f16a13aa02d3d08ba9492e3bcc119a6a797 100644 (file)
@@ -322,6 +322,16 @@ Gtkmm2ext::get_popdown_strings (Gtk::ComboBoxText& cr, std::vector<std::string>&
        }
 }
 
+size_t
+Gtkmm2ext::get_popdown_string_count (Gtk::ComboBoxText& cr)
+{
+       Glib::RefPtr<const Gtk::TreeModel> m = cr.get_model();
+       if (!m) {
+               return 0;
+       }
+       return m->children().size();
+}
+
 bool
 Gtkmm2ext::contains_value (Gtk::ComboBoxText& cr, const std::string text)
 {