package Gtk_Message_Type_Properties is new Generic_Internal_Discrete_Property (Gtk_Message_Type);
package Gtk_Buttons_Type_Properties is new Generic_Internal_Discrete_Property (Gtk_Buttons_Type);
package Implements_Gtk_Buildable is new Glib.Types.Implements (Gtk.Buildable.Gtk_Buildable, Gtk_Message_Dialog_Record, Gtk_Message_Dialog);
type Gtk_Message_Dialog_Record is new Gtk_Dialog_Record with null record;
type Gtk_Message_Dialog is access all Gtk_Message_Dialog_Record'Class;
type Gtk_Message_Type is ( Message_Info, Message_Warning, Message_Question, Message_Error, Message_Other);
type Gtk_Buttons_Type is ( Buttons_None, Buttons_Ok, Buttons_Close, Buttons_Cancel, Buttons_Yes_No, Buttons_Ok_Cancel);
type Property_Gtk_Message_Type is new Gtk_Message_Type_Properties.Property;
type Property_Gtk_Buttons_Type is new Gtk_Buttons_Type_Properties.Property;
Buttons_Property : constant Gtk.Message_Dialog.Property_Gtk_Buttons_Type;
Image_Property : constant Glib.Properties.Property_Object;
Message_Area_Property : constant Glib.Properties.Property_Object;
Message_Type_Property : constant Gtk.Message_Dialog.Property_Gtk_Message_Type;
Secondary_Text_Property : constant Glib.Properties.Property_String;
Secondary_Use_Markup_Property : constant Glib.Properties.Property_Boolean;
Text_Property : constant Glib.Properties.Property_String;
Use_Markup_Property : constant Glib.Properties.Property_Boolean;
procedure Gtk_New
( | Dialog | : out Gtk_Message_Dialog; |
Parent | : access Gtk.Window.Gtk_Window_Record'Class; | |
Flags | : Gtk_Dialog_Flags; | |
The_Type | : Gtk_Message_Type; | |
Buttons | : Gtk_Buttons_Type; | |
Message | : UTF8_String := ""; | |
Arg5 | : System.Address); |
procedure Initialize
( | Dialog | : not null access Gtk_Message_Dialog_Record'Class; |
Parent | : access Gtk.Window.Gtk_Window_Record'Class; | |
Flags | : Gtk_Dialog_Flags; | |
The_Type | : Gtk_Message_Type; | |
Buttons | : Gtk_Buttons_Type; | |
Message | : UTF8_String := ""; | |
Arg5 | : System.Address); |
function Gtk_Message_Dialog_New
( | Parent | : access Gtk.Window.Gtk_Window_Record'Class; |
Flags | : Gtk_Dialog_Flags; | |
The_Type | : Gtk_Message_Type; | |
Buttons | : Gtk_Buttons_Type; | |
Message | : UTF8_String := ""; | |
Arg5 | : System.Address) return Gtk_Message_Dialog; |
procedure Gtk_New_With_Markup
( | Dialog | : out Gtk_Message_Dialog; |
Parent | : access Gtk.Window.Gtk_Window_Record'Class; | |
Flags | : Gtk_Dialog_Flags; | |
The_Type | : Gtk_Message_Type; | |
Buttons | : Gtk_Buttons_Type; | |
Message | : UTF8_String := ""; | |
Arg5 | : System.Address); |
procedure Initialize_With_Markup
( | Dialog | : not null access Gtk_Message_Dialog_Record'Class; |
Parent | : access Gtk.Window.Gtk_Window_Record'Class; | |
Flags | : Gtk_Dialog_Flags; | |
The_Type | : Gtk_Message_Type; | |
Buttons | : Gtk_Buttons_Type; | |
Message | : UTF8_String := ""; | |
Arg5 | : System.Address); |
function Gtk_Message_Dialog_New_With_Markup
( | Parent | : access Gtk.Window.Gtk_Window_Record'Class; |
Flags | : Gtk_Dialog_Flags; | |
The_Type | : Gtk_Message_Type; | |
Buttons | : Gtk_Buttons_Type; | |
Message | : UTF8_String := ""; | |
Arg5 | : System.Address) return Gtk_Message_Dialog; |
function Get_Type return Glib.GType;
procedure Format_Secondary_Markup
( | Dialog | : not null access Gtk_Message_Dialog_Record; |
Message | : UTF8_String := ""; | |
Arg2 | : System.Address); |
function Get_Image
( | Dialog | : not null access Gtk_Message_Dialog_Record) return Gtk.Widget.Gtk_Widget; |
procedure Set_Image
( | Dialog | : not null access Gtk_Message_Dialog_Record; |
Image | : not null access Gtk.Widget.Gtk_Widget_Record'Class); |
function Get_Message_Area
( | Dialog | : not null access Gtk_Message_Dialog_Record) return Gtk.Widget.Gtk_Widget; |
procedure Set_Markup
( | Dialog | : not null access Gtk_Message_Dialog_Record; |
Str | : UTF8_String); |
function "+"
( | Widget | : access Gtk_Message_Dialog_Record'Class) return Gtk.Buildable.Gtk_Buildable renames Implements_Gtk_Buildable.To_Interface; |
function "-"
( | Interf | : Gtk.Buildable.Gtk_Buildable) return Gtk_Message_Dialog renames Implements_Gtk_Buildable.To_Object; |
Gtk.Message_Dialog.Gtk_Message_Dialog presents a dialog with an image representing the type of message (Error, Question, etc.) alongside some message text. It's simply a convenience widget; you could construct the equivalent of Gtk.Message_Dialog.Gtk_Message_Dialog from Gtk.Dialog.Gtk_Dialog without too much effort, but Gtk.Message_Dialog.Gtk_Message_Dialog saves typing.
One difference from Gtk.Dialog.Gtk_Dialog is that Gtk.Message_Dialog.Gtk_Message_Dialog sets the Gtk.Window.Gtk_Window:skip-taskbar-hint property to True, so that the dialog is hidden from the taskbar by default.
The easiest way to do a modal message dialog is to use Gtk.Dialog.Run, though you can also pass in the GTK_DIALOG_MODAL flag, Gtk.Dialog.Run automatically makes the dialog modal and waits for the user to respond to it. Gtk.Dialog.Run returns when any dialog button is clicked. == A modal dialog. == dialog = gtk_message_dialog_new (main_application_window, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Error loading file '%s': %s", filename, g_strerror (errno)); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); You might do a non-modal Gtk.Message_Dialog.Gtk_Message_Dialog as follows: == A non-modal dialog. == dialog = gtk_message_dialog_new (main_application_window, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Error loading file '%s': %s", filename, g_strerror (errno)); /* Destroy the dialog when the user responds to it (e.g. clicks a button) */ g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog); == GtkMessageDialog as GtkBuildable == The GtkMessageDialog implementation of the GtkBuildable interface exposes the message area as an internal child with the name "message_area".