tweak Prompter API to allow skipping the default "Cancel" button
This commit is contained in:
parent
4c8f562053
commit
618c7a6bf2
@ -28,30 +28,33 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ArdourWidgets;
|
using namespace ArdourWidgets;
|
||||||
|
|
||||||
Prompter::Prompter (Gtk::Window& parent, bool modal)
|
Prompter::Prompter (Gtk::Window& parent, bool modal, bool with_cancel)
|
||||||
: Gtk::Dialog ("", parent, modal)
|
: Gtk::Dialog ("", parent, modal)
|
||||||
, first_show (true)
|
, first_show (true)
|
||||||
, can_accept_from_entry (false)
|
, can_accept_from_entry (false)
|
||||||
{
|
{
|
||||||
init ();
|
init (with_cancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
Prompter::Prompter (bool modal)
|
Prompter::Prompter (bool modal, bool with_cancel)
|
||||||
: Gtk::Dialog ("", modal)
|
: Gtk::Dialog ("", modal)
|
||||||
, first_show (true)
|
, first_show (true)
|
||||||
, can_accept_from_entry (false)
|
, can_accept_from_entry (false)
|
||||||
{
|
{
|
||||||
init ();
|
init (with_cancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Prompter::init ()
|
Prompter::init (bool with_cancel)
|
||||||
{
|
{
|
||||||
set_type_hint (Gdk::WINDOW_TYPE_HINT_DIALOG);
|
set_type_hint (Gdk::WINDOW_TYPE_HINT_DIALOG);
|
||||||
set_position (Gtk::WIN_POS_MOUSE);
|
set_position (Gtk::WIN_POS_MOUSE);
|
||||||
set_name ("Prompter");
|
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.
|
Alas a generic 'affirmative' button seems a bit useless sometimes.
|
||||||
|
@ -38,8 +38,8 @@ namespace ArdourWidgets {
|
|||||||
class LIBWIDGETS_API Prompter : public Gtk::Dialog
|
class LIBWIDGETS_API Prompter : public Gtk::Dialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Prompter (bool modal = false);
|
Prompter (bool modal = false, bool with_cancel_button = true);
|
||||||
Prompter (Gtk::Window& parent, bool modal = false);
|
Prompter (Gtk::Window& parent, bool modal = false, bool with_cancel_button = true);
|
||||||
~Prompter () {};
|
~Prompter () {};
|
||||||
|
|
||||||
void set_prompt (std::string prompt) {
|
void set_prompt (std::string prompt) {
|
||||||
@ -68,7 +68,7 @@ private:
|
|||||||
bool first_show;
|
bool first_show;
|
||||||
bool can_accept_from_entry;
|
bool can_accept_from_entry;
|
||||||
|
|
||||||
void init ();
|
void init (bool with_cancel);
|
||||||
void entry_activated ();
|
void entry_activated ();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user