1. ----------------------------------------------------------------------- 
  2. --              GtkAda - Ada95 binding for Gtk+/Gnome                -- 
  3. --                                                                   -- 
  4. --                Copyright (C) 2006-2010, AdaCore                   -- 
  5. --                                                                   -- 
  6. -- This library is free software; you can redistribute it and/or     -- 
  7. -- modify it under the terms of the GNU General Public               -- 
  8. -- License as published by the Free Software Foundation; either      -- 
  9. -- version 2 of the License, or (at your option) any later version.  -- 
  10. --                                                                   -- 
  11. -- This library is distributed in the hope that it will be useful,   -- 
  12. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  13. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  14. -- General Public License for more details.                          -- 
  15. --                                                                   -- 
  16. -- You should have received a copy of the GNU General Public         -- 
  17. -- License along with this library; if not, write to the             -- 
  18. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  19. -- Boston, MA 02111-1307, USA.                                       -- 
  20. --                                                                   -- 
  21. -- -- -- -- -- -- -- -- -- -- -- --
  22. ----------------------------------------------------------------------- 
  23.  
  24. --  <description> 
  25. --  Gtk_Message_Dialog presents a dialog with an image representing the type of 
  26. --  message (Error, Question, etc.) alongside some message text. It's simply a 
  27. --  convenience widget; you could construct the equivalent of 
  28. --  Gtk_Message_Dialog from Gtk_Dialog without too much effort, but 
  29. --  Gtk_Message_Dialog saves typing. 
  30. -- 
  31. --  The easiest way to do a modal message dialog is to use Gtk.Dialog.Run, 
  32. --  though you can also pass in the MODAL flag, Gtk.Dialog.Run automatically 
  33. --  makes the dialog modal and waits for the user to respond to it. 
  34. --  Gtk.Dialog.Run returns when any dialog button is clicked. 
  35. --  </description> 
  36. --  <c_version>2.16.6</c_version> 
  37. --  <group>Windows</group> 
  38. --  <screenshot>messagedialog.png</screenshot> 
  39. --  <see>Gtkada.Dialogs</see> 
  40.  
  41. with Glib.Properties; 
  42. with Gtk.Dialog; 
  43. with Gtk.Widget; 
  44. with Gtk.Window; 
  45.  
  46. package Gtk.Message_Dialog is 
  47.  
  48.    type Gtk_Message_Dialog_Record is new Gtk.Dialog.Gtk_Dialog_Record with 
  49.      null record; 
  50.    type Gtk_Message_Dialog is access all Gtk_Message_Dialog_Record'Class; 
  51.  
  52.    type Gtk_Message_Type is 
  53.      (Message_Info, 
  54.       Message_Warning, 
  55.       Message_Question, 
  56.       Message_Error); 
  57.  
  58.    type Gtk_Buttons_Type is 
  59.      (Buttons_None, 
  60.       Buttons_Ok, 
  61.       Buttons_Close, 
  62.       Buttons_Cancel, 
  63.       Buttons_Yes_No, 
  64.       Buttons_Ok_Cancel); 
  65.  
  66.    procedure Gtk_New 
  67.      (Dialog         : out Gtk_Message_Dialog; 
  68.       Parent         : Gtk.Window.Gtk_Window := null; 
  69.       Flags          : Gtk.Dialog.Gtk_Dialog_Flags := 0; 
  70.       Typ            : Gtk_Message_Type := Message_Info; 
  71.       Buttons        : Gtk_Buttons_Type := Buttons_Close; 
  72.       Message        : String); 
  73.    procedure Initialize 
  74.      (Dialog         : access Gtk_Message_Dialog_Record'Class; 
  75.       Parent         : Gtk.Window.Gtk_Window := null; 
  76.       Flags          : Gtk.Dialog.Gtk_Dialog_Flags := 0; 
  77.       Typ            : Gtk_Message_Type := Message_Info; 
  78.       Buttons        : Gtk_Buttons_Type := Buttons_Close; 
  79.       Message        : String); 
  80.    --  Creates a new message dialog, which is a simple dialog with an icon 
  81.    --  indicating the dialog type (error, warning, etc.) and some text the user 
  82.    --  may want to see. When the user clicks a button a "response" signal is 
  83.    --  emitted with response IDs from Gtk.Dialog.Gtk_Response_Type. See 
  84.    --  Gtk_Dialog for more details. 
  85.  
  86.    procedure Gtk_New_With_Markup 
  87.      (Dialog         : out Gtk_Message_Dialog; 
  88.       Parent         : Gtk.Window.Gtk_Window := null; 
  89.       Flags          : Gtk.Dialog.Gtk_Dialog_Flags := 0; 
  90.       Typ            : Gtk_Message_Type := Message_Info; 
  91.       Buttons        : Gtk_Buttons_Type := Buttons_Close; 
  92.       Message        : String); 
  93.    procedure Initialize_With_Markup 
  94.      (Dialog         : access Gtk_Message_Dialog_Record'Class; 
  95.       Parent         : Gtk.Window.Gtk_Window := null; 
  96.       Flags          : Gtk.Dialog.Gtk_Dialog_Flags := 0; 
  97.       Typ            : Gtk_Message_Type := Message_Info; 
  98.       Buttons        : Gtk_Buttons_Type := Buttons_Close; 
  99.       Message        : String); 
  100.    --  Same as Gtk_New and Initialize, but Message might contain special markup 
  101.    --  like <b>, <i>, <big>,... 
  102.  
  103.    function Get_Type return GType; 
  104.    --  Return the internal type used for a Gtk_Message_Dialog 
  105.  
  106.    procedure Set_Markup 
  107.      (Message_Dialog : access Gtk_Message_Dialog_Record; 
  108.       Str            : String); 
  109.    --  Sets the text of the message dialog to be Str, which is marked 
  110.    --  up with the >Pango text markup language. This means that you can for 
  111.    --  instance <b> to get bold text. 
  112.  
  113.    procedure Format_Secondary_Markup 
  114.      (Message_Dialog : access Gtk_Message_Dialog_Record; 
  115.       Message        : String); 
  116.    procedure Format_Secondary_Text 
  117.      (Message_Dialog : access Gtk_Message_Dialog_Record; 
  118.       Message        : String); 
  119.    --  Sets the secondary text of the message dialog to be Message. When using 
  120.    --  markup, special marks are interpreted (<b> for bold, <i> for italic,...) 
  121.    --  Note that setting a secondary text makes the primary text become bold, 
  122.    --  unless you have provided explicit markup. 
  123.  
  124.    function Get_Image 
  125.      (Dialog : access Gtk_Message_Dialog_Record) 
  126.       return Gtk.Widget.Gtk_Widget; 
  127.    procedure Set_Image 
  128.      (Dialog : access Gtk_Message_Dialog_Record; 
  129.       Image  : access Gtk.Widget.Gtk_Widget_Record'Class); 
  130.    --  Get and set the dialog's image. 
  131.  
  132.    ---------------- 
  133.    -- Properties -- 
  134.    ---------------- 
  135.    --  The following properties are defined for this widget. See 
  136.    --  Glib.Properties for more information on properties. 
  137.    -- 
  138.    --  <properties> 
  139.    --  Name:  Buttons_Property 
  140.    --  Type:  Enum 
  141.    --  Descr: The buttons shown in the message dialog 
  142.    -- 
  143.    --  Name:  Image_Property 
  144.    --  Type:  Object 
  145.    --  Descr: The image 
  146.    -- 
  147.    --  Name:  Message_Type_Property 
  148.    --  Type:  Enum 
  149.    --  Descr: The type of message 
  150.    -- 
  151.    --  Name:  Secondary_Text_Property 
  152.    --  Type:  String 
  153.    --  Descr: The secondary text of the message dialog 
  154.    -- 
  155.    --  Name:  Secondary_Use_Markup_Property 
  156.    --  Type:  Boolean 
  157.    --  Descr: The secondary text includes Pango markup. 
  158.    -- 
  159.    --  Name:  Text_Property 
  160.    --  Type:  String 
  161.    --  Descr: The primary text of the message dialog 
  162.    -- 
  163.    --  Name:  Use_Markup_Property 
  164.    --  Type:  Boolean 
  165.    --  Descr: The primary text of the title includes Pango markup. 
  166.    -- 
  167.    --  </properties> 
  168.  
  169. --     Buttons_Property      : constant Glib.Properties.Property_Enum; 
  170. --     Message_Type_Property : constant Glib.Properties.Property_Enum; 
  171.    Image_Property                : constant Glib.Properties.Property_Object; 
  172.    Secondary_Text_Property       : constant Glib.Properties.Property_String; 
  173.    Secondary_Use_Markup_Property : constant Glib.Properties.Property_Boolean; 
  174.    Text_Property                 : constant Glib.Properties.Property_String; 
  175.    Use_Markup_Property           : constant Glib.Properties.Property_Boolean; 
  176.  
  177.    ---------------------- 
  178.    -- Style Properties -- 
  179.    ---------------------- 
  180.    --  The following properties can be changed through the gtk theme and 
  181.    --  configuration files, and retrieved through Gtk.Widget.Style_Get_Property 
  182.    -- 
  183.    --  <style_properties> 
  184.    --  Name:  Message_Border_Property 
  185.    --  Type:  Int 
  186.    --  Descr: Width of border around the label and image in the message dialog 
  187.    -- 
  188.    --  Name:  Use_Separator_Property 
  189.    --  Type:  Boolean 
  190.    --  Descr: Whether to put a separator between the message dialog's text and 
  191.    --         the buttons 
  192.    -- 
  193.    --  </style_properties> 
  194.  
  195.    Message_Border_Property : constant Glib.Properties.Property_Int; 
  196.    Use_Separator_Property  : constant Glib.Properties.Property_Boolean; 
  197.  
  198. private 
  199. --     Buttons_Property : constant Glib.Properties.Property_Enum := 
  200. --       Glib.Properties.Build ("buttons"); 
  201. --     Message_Type_Property : constant Glib.Properties.Property_Enum := 
  202. --       Glib.Properties.Build ("message-type"); 
  203.    Image_Property : constant Glib.Properties.Property_Object := 
  204.      Glib.Properties.Build ("image"); 
  205.    Secondary_Text_Property : constant Glib.Properties.Property_String := 
  206.      Glib.Properties.Build ("secondary-text"); 
  207.    Secondary_Use_Markup_Property : constant Glib.Properties.Property_Boolean := 
  208.      Glib.Properties.Build ("secondary-use-markup"); 
  209.    Text_Property : constant Glib.Properties.Property_String := 
  210.      Glib.Properties.Build ("text"); 
  211.    Use_Markup_Property : constant Glib.Properties.Property_Boolean := 
  212.      Glib.Properties.Build ("use-markup"); 
  213.  
  214.    Message_Border_Property : constant Glib.Properties.Property_Int := 
  215.      Glib.Properties.Build ("message-border"); 
  216.    Use_Separator_Property : constant Glib.Properties.Property_Boolean := 
  217.      Glib.Properties.Build ("use-separator"); 
  218.  
  219.    pragma Import (C, Get_Type, "gtk_message_dialog_get_type"); 
  220.  
  221. end Gtk.Message_Dialog; 
  222.  
  223. --  Implemented through our own C wrappers: 
  224. --  No binding: gtk_message_dialog_format_secondary_markup 
  225. --  No binding: gtk_message_dialog_format_secondary_text 
  226. --  No binding: gtk_message_dialog_new 
  227. --  No binding: gtk_message_dialog_new_with_markup