Moved strip_whitespace_edges() to pbd/whitespace.h
[ardour.git] / libs / gtkmm2ext / gtkmm2ext / prompter.h
1 /*
2     Copyright (C) 1999 Paul Barton-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     $Id$
19 */
20
21 #ifndef __gtkmm2ext_prompter_h__
22 #define __gtkmm2ext_prompter_h__
23
24 #include <string>
25 #include <gtkmm/box.h>
26 #include <gtkmm/entry.h>
27 #include <gtkmm/label.h>
28 #include <gtkmm/dialog.h>
29 #include <sigc++/sigc++.h>
30
31 namespace Gtk {
32         class Window;
33 }
34
35 namespace Gtkmm2ext {
36
37 class Prompter : public Gtk::Dialog
38
39 {
40   public:
41         Prompter (bool modal = false);
42         Prompter (Gtk::Window& parent, bool modal = false);
43         ~Prompter () {};
44
45         void set_prompt (std::string prompt) {
46                 entryLabel.set_label (prompt);
47         }
48
49         void set_initial_text (std::string txt) {
50                 entry.set_text (txt);
51                 entry.select_region (0, entry.get_text_length());
52         }
53
54         void change_labels (std::string ok, std::string cancel);
55
56         void get_result (std::string &str, bool strip=true);
57
58   protected:
59         Gtk::Entry& the_entry() { return entry; }
60
61   private:
62         Gtk::Entry entry;
63         Gtk::VBox entryBox;
64         Gtk::Label entryLabel;
65         
66         void init ();
67 };
68
69 } /* namespace */
70
71 #endif  /* __gtkmm2ext_prompter_h__ */