本文整理汇总了C++中gtk::MessageDialog::add_button方法的典型用法代码示例。如果您正苦于以下问题:C++ MessageDialog::add_button方法的具体用法?C++ MessageDialog::add_button怎么用?C++ MessageDialog::add_button使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk::MessageDialog
的用法示例。
在下文中一共展示了MessageDialog::add_button方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: keyReplaceDialog
Glib::ustring Document::keyReplaceDialog (
Glib::ustring const &original,
Glib::ustring const &replacement,
const char *message_text)
{
Glib::ustring message = String::ucompose (
"<big><b>%1</b></big>\n\n%2",
_("Key naming conflict"),
String::ucompose (
message_text,
original, replacement));
Gtk::MessageDialog dialog (message, true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE, true);
Gtk::Button *button;
button = dialog.add_button (_("_Ignore"), Gtk::RESPONSE_CANCEL);
Gtk::Image *noImage = Gtk::manage (new Gtk::Image (Gtk::Stock::NO, Gtk::ICON_SIZE_BUTTON));
button->set_image (*noImage);
button = dialog.add_button (_("_Replace"), Gtk::RESPONSE_ACCEPT);
Gtk::Image *yesImage = Gtk::manage (new Gtk::Image (Gtk::Stock::YES, Gtk::ICON_SIZE_BUTTON));
button->set_image (*yesImage);
dialog.set_default_response (Gtk::RESPONSE_ACCEPT);
if (dialog.run () == Gtk::RESPONSE_ACCEPT)
return replacement;
else
return original;
}
示例2: show_dialog
void show_dialog() const
{
Gtk::MessageDialog* dialog = new Gtk::MessageDialog(
m_simple_desc,
false,
Gtk::MESSAGE_ERROR,
Gtk::BUTTONS_NONE,
false);
Gtk::Window* parent = NULL;
Gtk::Widget* toplevel_widget = m_widget->get_toplevel();
if(gtk_widget_is_toplevel(toplevel_widget->gobj()))
parent = dynamic_cast<Gtk::Window*>(toplevel_widget);
g_assert(parent != NULL);
dialog->set_transient_for(*parent);
dialog->add_button(_("_Close"), Gtk::RESPONSE_CLOSE);
dialog->set_secondary_text(m_detail_desc, true);
dialog->signal_response().connect(
sigc::hide(
sigc::bind(
sigc::ptr_fun(dispose_dialog),
dialog)));
dialog->show();
}
示例3: open_quit_dialog
void mixer_window::open_quit_dialog()
{
Gtk::MessageDialog dialog (*this, gettext("Really quit?"), false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE);
dialog.add_button(gettext("No, continue running dvswitch."), Gtk::RESPONSE_CANCEL);
dialog.add_button(gettext("Yes, exit dvswitch."), Gtk::RESPONSE_YES);
dialog.set_default_response(Gtk::RESPONSE_CANCEL);
dialog.set_position (Gtk::WIN_POS_CENTER_ON_PARENT);
switch (dialog.run())
{
case Gtk::RESPONSE_ACCEPT:
case Gtk::RESPONSE_YES:
Gtk::Main::quit();
break;
default:
break;
}
}
示例4: show_dialog
void show_dialog() const
{
Gtk::MessageDialog* dialog = new Gtk::MessageDialog(
m_simple_desc,
false,
Gtk::MESSAGE_ERROR,
Gtk::BUTTONS_NONE,
false);
dialog->add_button(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE);
dialog->set_secondary_text(m_detail_desc, true);
dialog->signal_response().connect(
sigc::hide(
sigc::bind(
sigc::ptr_fun(dispose_dialog),
dialog)));
dialog->show();
}
示例5: ext
//.........这里部分代码省略.........
if (found) fmt = r[column->text];
}
if (!found)
{
Gtk::MessageDialog tbd
(*this, _("Unsupported file format."),
use_markup, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, modal);
tbd.set_secondary_text
((format (_("The '%1%' file extension is not associated with"
" a supported file format. Please select a file"
" format or use one of the known file extensions."))
% ext).str ());
if (dynamic_cast< Gtk::Window * > (this))
get_group ()->add_window (tbd);
tbd.run ();
signal_response ().emission_stop ();
response (Gtk::RESPONSE_CANCEL);
return;
}
}
if (!single_image_mode_
&& requests_single_file (get_current_name ()))
{ // check whether single file is okay
if (!supports_multi_image (get_current_name ()))
{
Gtk::MessageDialog tbd
(*this, (format (_("The %1% format does not support multiple"
" images in a single file.")) % fmt).str (),
use_markup, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, modal);
tbd.set_secondary_text
((format (_("Please save to PDF or TIFF if you want a single"
" file. If you prefer the %1% image format, use"
" a filename such as 'Untitled-%%3i%2%'."))
% fmt % get_current_extension ()).str ());
if (dynamic_cast< Gtk::Window * > (this))
get_group ()->add_window (tbd);
tbd.run ();
signal_response ().emission_stop ();
response (Gtk::RESPONSE_CANCEL);
return;
}
}
if (!do_overwrite_confirmation_) return;
format message;
format details;
if (requests_single_file (get_current_name ()))
{
if (!fs::exists (std::string (get_filename ()))) return;
message = format (_("The name \"%1%\" already exists.\n"
"OK to overwrite this name using the new settings?"));
details = format (_("The file already exists in \"%1%\"."
" Replacing it will overwrite its contents."));
}
else
{
// FIXME Add meaningful checking
// if (no_possible_matches ) return;
message = format (_("Files matching \"%1%\" may already exist."
" Do you want to replace them?"));
//details = format (_("These files already exist in \"%1%\"."
// " Replacing them may overwrite their contents."));
// FIXME show list of matching files in an expander with details
}
message % get_current_name ();
if (0 < details.size ())
details % get_current_folder ();
Gtk::MessageDialog tbd (*this, message.str (), use_markup,
Gtk::MESSAGE_QUESTION,
Gtk::BUTTONS_NONE, modal);
if (0 < details.size ())
tbd.set_secondary_text (details.str ());
tbd.add_button (Gtk::Stock::NO , Gtk::RESPONSE_CANCEL);
tbd.add_button (Gtk::Stock::YES, Gtk::RESPONSE_ACCEPT);
tbd.set_default_response (Gtk::RESPONSE_ACCEPT);
if (dynamic_cast< Gtk::Window * > (this))
get_group ()->add_window (tbd);
if (Gtk::RESPONSE_ACCEPT != tbd.run ())
{
signal_response ().emission_stop ();
response (Gtk::RESPONSE_CANCEL);
}
}