Creates a new Dialog with title title
(or null
for the default title; see set_title) and transient parent parent
(or
null for none; see set_transient_for).
The flags
argument can be used to make the dialog modal (MODAL)
and/or to have it destroyed along with its transient parent (
DESTROY_WITH_PARENT). After flags
, button text/response ID pairs should be listed, with a
null pointer ending the list. Button text can be arbitrary text. A response ID can be any positive number, or one of the values
in the ResponseType enumeration. If the user clicks one of these dialog buttons,
Dialog will emit the response signal
with the corresponding response ID. If a Dialog receives the
delete_event signal, it will emit
response with a response ID of
DELETE_EVENT. However, destroying a dialog does not emit the
response signal; so be careful relying on
response when using the
DESTROY_WITH_PARENT flag. Buttons are from left to right, so the
first button in the list will be the leftmost button in the dialog.
Here’s a simple example:
GtkWidget *main_app_window; // Window the dialog should show up on
GtkWidget *dialog;
GtkDialogFlags flags = GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT;
dialog = gtk_dialog_new_with_buttons ("My dialog",
main_app_window,
flags,
_("_OK"),
GTK_RESPONSE_ACCEPT,
_("_Cancel"),
GTK_RESPONSE_REJECT,
NULL);
title |
Title of the dialog, or null |
parent |
Transient parent of the dialog, or null |
flags |
from DialogFlags |
... |
response ID for first button, then additional buttons, ending with null |
first_button_text |
text to go in first button, or null |
a new Dialog |