summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2020-05-18 16:01:56 -0600
committerPaul Davis <paul@linuxaudiosystems.com>2020-05-18 16:04:41 -0600
commit618c7a6bf26949461039f8b379f45ae2a9491668 (patch)
tree9017e61f441b8ef5328f956435c109418443d1d3 /libs
parent4c8f562053e20e926d750cea85cf5d257475c3e6 (diff)
tweak Prompter API to allow skipping the default "Cancel" button
Diffstat (limited to 'libs')
-rw-r--r--libs/widgets/prompter.cc15
-rw-r--r--libs/widgets/widgets/prompter.h6
2 files changed, 12 insertions, 9 deletions
diff --git a/libs/widgets/prompter.cc b/libs/widgets/prompter.cc
index de18be29df..9f2df26b5e 100644
--- a/libs/widgets/prompter.cc
+++ b/libs/widgets/prompter.cc
@@ -28,30 +28,33 @@
using namespace std;
using namespace ArdourWidgets;
-Prompter::Prompter (Gtk::Window& parent, bool modal)
+Prompter::Prompter (Gtk::Window& parent, bool modal, bool with_cancel)
: Gtk::Dialog ("", parent, modal)
, first_show (true)
, can_accept_from_entry (false)
{
- init ();
+ init (with_cancel);
}
-Prompter::Prompter (bool modal)
+Prompter::Prompter (bool modal, bool with_cancel)
: Gtk::Dialog ("", modal)
, first_show (true)
, can_accept_from_entry (false)
{
- init ();
+ init (with_cancel);
}
void
-Prompter::init ()
+Prompter::init (bool with_cancel)
{
set_type_hint (Gdk::WINDOW_TYPE_HINT_DIALOG);
set_position (Gtk::WIN_POS_MOUSE);
set_name ("Prompter");
- add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
+ if (with_cancel) {
+ /* some callers need to name this button more sensibly */
+ add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
+ }
/*
Alas a generic 'affirmative' button seems a bit useless sometimes.
diff --git a/libs/widgets/widgets/prompter.h b/libs/widgets/widgets/prompter.h
index afe6733d1b..94e0ad65cc 100644
--- a/libs/widgets/widgets/prompter.h
+++ b/libs/widgets/widgets/prompter.h
@@ -38,8 +38,8 @@ namespace ArdourWidgets {
class LIBWIDGETS_API Prompter : public Gtk::Dialog
{
public:
- Prompter (bool modal = false);
- Prompter (Gtk::Window& parent, bool modal = false);
+ Prompter (bool modal = false, bool with_cancel_button = true);
+ Prompter (Gtk::Window& parent, bool modal = false, bool with_cancel_button = true);
~Prompter () {};
void set_prompt (std::string prompt) {
@@ -68,7 +68,7 @@ private:
bool first_show;
bool can_accept_from_entry;
- void init ();
+ void init (bool with_cancel);
void entry_activated ();
};