Ardour  9.0-pre0-582-g084a23a80d
prompter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1999 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef _WIDGETS_PROMPTER_H_
21 #define _WIDGETS_PROMPTER_H_
22 
23 #include <string>
24 #include <gtkmm/box.h>
25 #include <gtkmm/button.h>
26 #include <gtkmm/entry.h>
27 #include <gtkmm/label.h>
28 #include <gtkmm/dialog.h>
29 #include <sigc++/sigc++.h>
30 
31 #include "widgets/visibility.h"
32 
33 namespace Gtk {
34  class Window;
35 }
36 
37 namespace ArdourWidgets {
38 
40 {
41 public:
42  Prompter (bool modal = false, bool with_cancel_button = true);
43  Prompter (Gtk::Window& parent, bool modal = false, bool with_cancel_button = true);
44  ~Prompter () {};
45 
46  void set_prompt (std::string prompt) {
47  entryLabel.set_label (prompt);
48  }
49 
50  void set_initial_text (std::string txt, bool allow_replace = false);
51  void set_default_text (std::string const& txt);
52 
53  void change_labels (std::string ok, std::string cancel);
54 
55  void get_result (std::string &str, bool strip=true);
56  void set_allow_empty (bool yn = true);
57 
58 protected:
59  Gtk::Entry& the_entry() { return entry; }
60 
62  void on_show ();
63 
64 private:
69  bool first_show;
72  std::string default_text;
73 
74  void init (bool with_cancel);
75  void entry_activated ();
76 };
77 
78 } /* namespace */
79 
80 #endif
void set_default_text(std::string const &txt)
void on_show()
This is a default handler for the signal signal_show().
void init(bool with_cancel)
void change_labels(std::string ok, std::string cancel)
Prompter(bool modal=false, bool with_cancel_button=true)
void set_allow_empty(bool yn=true)
Gtk::Button resetButton
Definition: prompter.h:68
Gtk::Entry & the_entry()
Definition: prompter.h:59
std::string default_text
Definition: prompter.h:72
Gtk::Label entryLabel
Definition: prompter.h:67
void set_prompt(std::string prompt)
Definition: prompter.h:46
Prompter(Gtk::Window &parent, bool modal=false, bool with_cancel_button=true)
void get_result(std::string &str, bool strip=true)
void set_initial_text(std::string txt, bool allow_replace=false)
Definition: Window.h:41
Definition: ardour_ui.h:188
#define LIBWIDGETS_API