add the notion of a "tip widget" for all option editor elements, allowing us to add...
[ardour.git] / gtk2_ardour / search_path_option.h
1 /*
2     Copyright (C) 2000-2010 Paul Davis
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #ifndef __gtk_ardour_search_path_option_h__
21 #define __gtk_ardour_search_path_option_h__
22
23 #include <string>
24
25 #include <gtkmm/filechooserbutton.h>
26 #include <gtkmm/entry.h>
27 #include <gtkmm/button.h>
28 #include <gtkmm/box.h>
29
30 #include "option_editor.h"
31
32 class SearchPathOption : public Option
33 {
34   public:
35         SearchPathOption (const std::string& pathname, const std::string& label,
36                           sigc::slot<std::string>, sigc::slot<bool, std::string>);
37         ~SearchPathOption ();
38
39         void set_state_from_config ();
40         void add_to_page (OptionEditorPage*);
41         void clear ();
42
43         Gtk::Widget& tip_widget() { return add_chooser; }
44
45   protected:
46         sigc::slot<std::string> _get; ///< slot to get the configuration variable's value
47         sigc::slot<bool, std::string> _set;  ///< slot to set the configuration variable's value
48
49         struct PathEntry {
50             PathEntry (const std::string& path, bool removable=true);
51
52             Gtk::Entry entry;
53             Gtk::Button remove_button;
54             Gtk::HBox box;
55
56             std::string path;
57         };
58
59         std::list<PathEntry*> paths;
60         Gtk::FileChooserButton add_chooser;
61         Gtk::VBox vbox;
62         Gtk::VBox path_box;
63         Gtk::Label session_label;
64
65         void add_path (const std::string& path, bool removable=true);
66         void remove_path (PathEntry*);
67         void changed ();
68         void path_chosen ();
69 };
70
71 #endif /* __gtk_ardour_search_path_option_h__ */