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