Constructor
Gtk.Dialog.new_with_buttons
Declaration [src]
GtkWidget*
gtk_dialog_new_with_buttons (
const char* title,
GtkWindow* parent,
GtkDialogFlags flags,
const char* first_button_text,
...
)
Description [src]
Creates a new GtkDialog
with the given title and transient parent.
The flags
argument can be used to make the dialog modal, have it
destroyed along with its transient parent, or make it use a headerbar.
Button text/response ID pairs should be listed in pairs, 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
GtkResponseType
enumeration. If the user clicks one of these
buttons, GtkDialog
will emit the GtkDialog::response
signal
with the corresponding response ID.
If a GtkDialog
receives a delete event, it will emit ::response with a
response ID of GTK_RESPONSE_DELETE_EVENT
.
However, destroying a dialog does not emit the ::response signal;
so be careful relying on ::response when using the
GTK_DIALOG_DESTROY_WITH_PARENT
flag.
Here’s a simple example:
GtkWindow *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);
Parameters
title |
const char* |
Title of the dialog, or |
|
Can be NULL | |
Ownership is not transferred to the callee | |
The string is a NUL terminated UTF-8 string | |
parent |
GtkWindow |
Transient parent of the dialog, or |
|
Can be NULL | |
Ownership is not transferred to the callee | |
flags |
GtkDialogFlags |
from |
|
first_button_text |
const char* |
text to go in first button, or |
|
Can be NULL | |
Ownership is not transferred to the callee | |
The string is a NUL terminated UTF-8 string | |
... |
|
response ID for first button, then additional buttons, ending with |
Return value
Returns: GtkWidget |
|
a new |
|
Ownership is not transferred to the caller |