Dialog boxes are a convenient way to prompt the user for a small amount of input, eg. to display a message, ask a question, or anything else that does not require extensive effort on the user's part.
Gtkada treats a dialog as a window split horizontally. The top section is a Gtk_Vbox, and is where widgets such as a Gtk_Label or a Gtk_Entry should be packed. The second area is known as the action_area. This is generally used for packing buttons into the dialog which may perform functions such as cancel, ok, or apply. The two areas are separated by a Gtk_Hseparator.
If 'dialog' is a newly created dialog, the two primary areas of the window can be accessed using Get_Vbox and Get_Action_Area as can be seen from the example, below.
A 'modal' dialog (that is, one which freezes the rest of the application from user input), can be created by calling Set_Modal on the dialog.
see section Package Gtkada.Dialogs for a higher level dialog interface.
Widget Hierarchy |
---|
GObject (see section Package Glib.Object) Gtk_Object (see section Package Gtk.Object) \___ Gtk_Widget (see section Package Gtk.Widget) \___ Gtk_Container (see section Package Gtk.Container) \___ Gtk_Bin (see section Package Gtk.Bin) \___ Gtk_Window (see section Package Gtk.Window) \___ Gtk_Dialog (see section Package Gtk.Dialog) |
Signals |
---|
Types |
---|
type Gtk_Dialog_Flags is mod 3; | |
| |
type Gtk_Response_Type is new Gint; | |
Type used for Response_Id's.
Positive values are totally user-interpreted.
GtkAda will sometimes return Gtk_Response_None if no Response_Id is
available.
Typical usage is:
if Gtk.Dialog.Run (Dialog) = Gtk_Response_Accept then
blah;
end if;
|
Subprograms |
---|
Subprograms | ||
procedure Gtk_New (Dialog : out Gtk_Dialog); | ||
Create a new dialog. | ||
procedure Gtk_New (Dialog : out Gtk_Dialog; Title : UTF8_String; Parent : Gtk.Window.Gtk_Window; Flags : Gtk_Dialog_Flags); | ||
Create a new dialog with a specific title, and specific attributes. | ||
function Get_Type return Gtk.Gtk_Type; | ||
Return the internal value associated with a Gtk_Dialog.
| ||
function Get_Action_Area (Dialog : access Gtk_Dialog_Record) return Gtk.Box.Gtk_Box; | ||
Return the action area box associated with a Dialog.
| ||
function Get_Vbox (Dialog : access Gtk_Dialog_Record) return Gtk.Box.Gtk_Box; | ||
Return the vertical box associated with a Dialog.
| ||
procedure Add_Action_Widget (Dialog : access Gtk_Dialog_Record; Child : access Gtk.Widget.Gtk_Widget_Record'Class; Response_Id : Gtk_Response_Type); | ||
Add an activatable widget to the action area of Dialog. | ||
function Add_Button (Dialog : access Gtk_Dialog_Record; Text : UTF8_String; Response_Id : Gtk_Response_Type) return Gtk.Widget.Gtk_Widget; | ||
Add a button with the given text to the dialog. Note that you can also | ||
procedure Set_Response_Sensitive (Dialog : access Gtk_Dialog_Record; Response_Id : Gtk_Response_Type; Setting : Boolean); | ||
Call Gtk.Widget.Set_Sensitive for all the buttons in the dialog | ||
procedure Set_Default_Response (Dialog : access Gtk_Dialog_Record; Response_Id : Gtk_Response_Type); | ||
Set the last widget in the dialog's action area with the given | ||
procedure Set_Has_Separator (Dialog : access Gtk_Dialog_Record; Setting : Boolean); | ||
Set whether the dialog has a separator above the buttons.
| ||
function Get_Has_Separator (Dialog : access Gtk_Dialog_Record) return Boolean; | ||
Return True if the dialog has a separator above the buttons.
| ||
function Run (Dialog : access Gtk_Dialog_Record) return Gtk_Response_Type; | ||
Block in a recursive main loop until Dialog emits the "response" | ||
Signals | ||
procedure Response (Dialog : access Gtk_Dialog_Record; Response_Id : Gtk_Response_Type); | ||
Emit the "response" signal
|