ardour
search_path_option.h
Go to the documentation of this file.
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  const std::string& default_path,
37  sigc::slot<std::string>, sigc::slot<bool, std::string>);
39 
40  void set_state_from_config ();
42  void clear ();
43 
44  Gtk::Widget& tip_widget() { return add_chooser; }
45 
46  protected:
47  sigc::slot<std::string> _get;
48  sigc::slot<bool, std::string> _set;
49 
50  struct PathEntry {
51  PathEntry (const std::string& path, bool removable=true);
52 
53  Gtk::Entry entry;
54  Gtk::Button remove_button;
55  Gtk::HBox box;
56 
57  std::string path;
58  };
59 
60  std::list<PathEntry*> paths;
61  Gtk::FileChooserButton add_chooser;
62  Gtk::VBox vbox;
63  Gtk::VBox path_box;
64  Gtk::Label session_label;
65 
66  void add_path (const std::string& path, bool removable=true);
67  void remove_path (PathEntry*);
68  void changed ();
69  void path_chosen ();
70 };
71 
72 #endif /* __gtk_ardour_search_path_option_h__ */
Gtk::FileChooserButton add_chooser
Gtk::Widget & tip_widget()
PathEntry(const std::string &path, bool removable=true)
SearchPathOption(const std::string &pathname, const std::string &label, const std::string &default_path, sigc::slot< std::string >, sigc::slot< bool, std::string >)
Base class for option editing dialog boxes.
void add_to_page(OptionEditorPage *)
void add_path(const std::string &path, bool removable=true)
void remove_path(PathEntry *)
std::list< PathEntry * > paths
Gtk::Label session_label
sigc::slot< std::string > _get
slot to get the configuration variable's value
sigc::slot< bool, std::string > _set
slot to set the configuration variable's value