GtkDialog

A popup window.

Object Hierarchy

GObject
`-- GtkObject
       `-- GtkWidget
              `-- GtkContainer
                     `-- GtkBin
                            `-- GtkWindow
                                   `-- GtkDialog

Direct Subclasses

Description

As the name suggests, GtkDialog is a widget that is useful whenever you want to interact with the user. For example, you might want to ask the user a question, prompt for certain input, or confirm some action. The GtkDialog helps in such cases by providing a suitable window for interaction. Don't be fooled by the simple example, a GtkDialog can do much more powerful things than what is shown!

A GtkDialog is basically made up of two main areas, the top area, where you may pack widgets like GtkLabel or a GtkEntry. The bottom area may be used to display GtkButtons that will perform some action, like OK or cancel. The bottom area of the dialog is known as the action_area, while the top area is a vbox.

The general procedure for creating a dialog box would be to create a Dialog Box with its constructor and then adding the appropriate widgets to the vbox and action_area. Alternatively, instead of adding the required buttons to the action_area, you may make use of the add_button() method. The advantage of this method is that you get to choose a response signal. You may choose a response ID from GtkResponseType, that suits the purpose of your button. The third and most convenient way to add buttons to the dialog is passing them as parameters while using the constructor.

Most of the time however, you do not have to go through all this trouble unless you want to create a highly customized dialog. The common types of dialog boxes have widgets of their own, like the GtkFileChooserDialog or the GtkColorSelectionDialog.

Constructors

GtkDialog ([string title = null [, GtkWidget parent_window = null [, GtkDialogFlags dialog_flags = 0 [, array (GtkButton, GtkResponseType)]]]]);

-- Creates a new dialog box.

Methods

add_action_widget()
  Add a widget to the action_area
add_button()
  Adds a button to the dialog.
add_buttons()
  Adds an array of buttons to the dialog.
get_has_separator()
  Returns whether the dialog has a separator.
response()
  Emits the response signal.
run()
  Blocks the main loop until the dialog is destroyed.
set_default_response()
  Sets the response ID to be generated by the dialog.
set_has_separator()
  Sets whether the dialog has a separator.
set_response_sensitive()
  Sets the activatable widgets to be sensitive or not.

Fields

action_area:
  Describes the area of the dialog that holds the action widgets (buttons).
vbox:
  Describes the area of the dialog that holds the prompt widgets (labels).

Signals

"close"
  Emitted when the dialog is destroyed.
"response"
  Emitted when an action widget (button) is clicked.