diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-10-15 15:57:35 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-10-15 15:57:35 +0000 |
commit | cb84e71caa6faa3694a9c1958d24a67d02839326 (patch) | |
tree | f1f2c2732c14af8e27d93ce19fb7ba1dd39e0047 /gtk2_ardour/option_editor.h | |
parent | 6ab663342df34cd5b9ceb27efda49ee65f5b6967 (diff) |
create and manage a new config parameter that defines where LTC originates (still some tweaks to be done here and there)
git-svn-id: svn://localhost/ardour2/branches/3.0@13280 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/option_editor.h')
-rw-r--r-- | gtk2_ardour/option_editor.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/gtk2_ardour/option_editor.h b/gtk2_ardour/option_editor.h index 3e64e4f125..6ea38648b0 100644 --- a/gtk2_ardour/option_editor.h +++ b/gtk2_ardour/option_editor.h @@ -285,6 +285,76 @@ private: }; +/** Component which provides the UI to handle an enumerated option using a GTK ComboBox. + * The template parameter is the enumeration. + */ +class ComboStringOption : public Option +{ +public: + + /** Construct an ComboOption. + * @param i id + * @param n User-visible name. + * @param g Slot to get the variable's value. + * @param s Slot to set the variable's value. + */ + ComboStringOption ( + std::string const & i, + std::string const & n, + sigc::slot<std::string> g, + sigc::slot<bool, std::string> s + ) + : Option (i, n), + _get (g), + _set (s) + { + _label = manage (new Gtk::Label (n + ":")); + _label->set_alignment (0, 0.5); + _combo = manage (new Gtk::ComboBoxText); + _combo->signal_changed().connect (sigc::mem_fun (*this, &ComboStringOption::changed)); + } + + void set_state_from_config () { + _combo->set_active_text (_get()); + } + + void add_to_page (OptionEditorPage* p) + { + add_widgets_to_page (p, _label, _combo); + } + + /** Set the allowed strings for this option + * @param strings a vector of allowed strings + */ + void set_popdown_strings (const std::vector<std::string>& strings) { + _combo->clear_items (); + for (std::vector<std::string>::const_iterator i = strings.begin(); i != strings.end(); ++i) { + _combo->append_text (*i); + } + } + + void clear () { + _combo->clear_items(); + } + + void changed () { + _set (_combo->get_active_text ()); + } + + void set_sensitive (bool yn) { + _combo->set_sensitive (yn); + } + + Gtk::Widget& tip_widget() { return *_combo; } + +private: + sigc::slot<std::string> _get; + sigc::slot<bool, std::string> _set; + Gtk::Label* _label; + Gtk::ComboBoxText* _combo; +}; + + /** Component which provides the UI to handle a boolean option which needs * to be represented as a ComboBox to be clear to the user. */ |