1. ------------------------------------------------------------------------------ 
  2. --                                                                          -- 
  3. --      Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet       -- 
  4. --                     Copyright (C) 2000-2014, AdaCore                     -- 
  5. --                                                                          -- 
  6. -- This library is free software;  you can redistribute it and/or modify it -- 
  7. -- under terms of the  GNU General Public License  as published by the Free -- 
  8. -- Software  Foundation;  either version 3,  or (at your  option) any later -- 
  9. -- version. This library is distributed in the hope that it will be useful, -- 
  10. -- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- -- 
  11. -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            -- 
  12. --                                                                          -- 
  13. -- As a special exception under Section 7 of GPL version 3, you are granted -- 
  14. -- additional permissions described in the GCC Runtime Library Exception,   -- 
  15. -- version 3.1, as published by the Free Software Foundation.               -- 
  16. --                                                                          -- 
  17. -- You should have received a copy of the GNU General Public License and    -- 
  18. -- a copy of the GCC Runtime Library Exception along with this program;     -- 
  19. -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    -- 
  20. -- <http://www.gnu.org/licenses/>.                                          -- 
  21. --                                                                          -- 
  22. ------------------------------------------------------------------------------ 
  23.  
  24. --  <description> 
  25. --  The Gtk.Image.Gtk_Image widget displays an image. Various kinds of object 
  26. --  can be displayed as an image; most typically, you would load a 
  27. --  Gdk.Pixbuf.Gdk_Pixbuf ("pixel buffer") from a file, and then display that. 
  28. --  There's a convenience function to do this, Gtk.Image.Gtk_New, used as 
  29. --  follows: 
  30. -- 
  31. --    GtkWidget *image; 
  32. --    image = gtk_image_new_from_file ("myfile.png"); 
  33. -- 
  34. --  If the file isn't loaded successfully, the image will contain a "broken 
  35. --  image" icon similar to that used in many web browsers. If you want to 
  36. --  handle errors in loading the file yourself, for example by displaying an 
  37. --  error message, then load the image with Gdk.Pixbuf.Gdk_New_From_File, then 
  38. --  create the Gtk.Image.Gtk_Image with Gtk.Image.Gtk_New. 
  39. -- 
  40. --  The image file may contain an animation, if so the Gtk.Image.Gtk_Image 
  41. --  will display an animation (Gdk_Pixbuf_Animation) instead of a static image. 
  42. -- 
  43. --  Gtk.Image.Gtk_Image is a subclass of Gtk.Misc.Gtk_Misc, which implies that 
  44. --  you can align it (center, left, right) and add padding to it, using 
  45. --  Gtk.Misc.Gtk_Misc methods. 
  46. -- 
  47. --  Gtk.Image.Gtk_Image is a "no window" widget (has no Gdk.Gdk_Window of its 
  48. --  own), so by default does not receive events. If you want to receive events 
  49. --  on the image, such as button clicks, place the image inside a 
  50. --  Gtk.Event_Box.Gtk_Event_Box, then connect to the event signals on the event 
  51. --  box. 
  52. -- 
  53. --  <title>Handling button press events on a 
  54. --  <structname>GtkImage</structname>.</title> 
  55. --    static gboolean 
  56. --    button_press_callback (GtkWidget      *event_box, 
  57. --       GdkEventButton *event, 
  58. --       gpointer        data) 
  59. --    { 
  60. --       g_print ("Event box clicked at coordinates %f,%f\n", 
  61. --          event->x, event->y); 
  62. --       /<!---->* Returning TRUE means we handled the event, so the signal 
  63. --       * emission should be stopped (don't call any further 
  64. --          * callbacks that may be connected). Return FALSE 
  65. --       * to continue invoking callbacks. 
  66. --       *<!---->/ 
  67. --       return TRUE; 
  68. --    } 
  69. --    static GtkWidget* 
  70. --    create_image (void) 
  71. --    { 
  72. --       GtkWidget *image; 
  73. --       GtkWidget *event_box; 
  74. --       image = gtk_image_new_from_file ("myfile.png"); 
  75. --       event_box = gtk_event_box_new (<!-- -->); 
  76. --          gtk_container_add (GTK_CONTAINER (event_box), image); 
  77. --             g_signal_connect (G_OBJECT (event_box), 
  78. --             "button_press_event", 
  79. --             G_CALLBACK (button_press_callback), 
  80. --             image); 
  81. --          return image; 
  82. --       } 
  83. -- 
  84. --  When handling events on the event box, keep in mind that coordinates in 
  85. --  the image may be different from event box coordinates due to the alignment 
  86. --  and padding settings on the image (see Gtk.Misc.Gtk_Misc). The simplest way 
  87. --  to solve this is to set the alignment to 0.0 (left/top), and set the 
  88. --  padding to zero. Then the origin of the image will be the same as the 
  89. --  origin of the event box. 
  90. -- 
  91. --  Sometimes an application will want to avoid depending on external data 
  92. --  files, such as image files. GTK+ comes with a program to avoid this, called 
  93. --  <application>gdk-pixbuf-csource</application>. This library allows you to 
  94. --  convert an image into a C variable declaration, which can then be loaded 
  95. --  into a Gdk.Pixbuf.Gdk_Pixbuf using gdk_pixbuf_new_from_inline. 
  96. -- 
  97. --  </description> 
  98. --  <screenshot>gtk-image</screenshot> 
  99. --  <group>Display widgets</group> 
  100. pragma Ada_2005; 
  101.  
  102. pragma Warnings (Off, "*is already use-visible*"); 
  103. with GNAT.Strings;            use GNAT.Strings; 
  104. with Gdk.Pixbuf;              use Gdk.Pixbuf; 
  105. with Glib;                    use Glib; 
  106. with Glib.G_Icon;             use Glib.G_Icon; 
  107. with Glib.Generic_Properties; use Glib.Generic_Properties; 
  108. with Glib.Properties;         use Glib.Properties; 
  109. with Glib.Types;              use Glib.Types; 
  110. with Gtk.Buildable;           use Gtk.Buildable; 
  111. with Gtk.Enums;               use Gtk.Enums; 
  112. with Gtk.Icon_Set;            use Gtk.Icon_Set; 
  113. with Gtk.Misc;                use Gtk.Misc; 
  114.  
  115. package Gtk.Image is 
  116.  
  117.    type Gtk_Image_Record is new Gtk_Misc_Record with null record; 
  118.    type Gtk_Image is access all Gtk_Image_Record'Class; 
  119.  
  120.    type Gtk_Image_Type is ( 
  121.       Image_Empty, 
  122.       Image_Pixbuf, 
  123.       Image_Stock, 
  124.       Image_Icon_Set, 
  125.       Image_Animation, 
  126.       Image_Icon_Name, 
  127.       Image_Gicon); 
  128.    pragma Convention (C, Gtk_Image_Type); 
  129.    --  Describes the image data representation used by a Gtk.Image.Gtk_Image. 
  130.    --  If you want to get the image from the widget, you can only get the 
  131.    --  currently-stored representation. e.g. if the Gtk.Image.Get_Storage_Type 
  132.    --  returns GTK_IMAGE_PIXBUF, then you can call Gtk.Image.Get but not Get. 
  133.    --  For empty images, you can request any storage type (call any of the 
  134.    --  "get" functions), but they will all return null values. 
  135.  
  136.    ---------------------------- 
  137.    -- Enumeration Properties -- 
  138.    ---------------------------- 
  139.  
  140.    package Gtk_Image_Type_Properties is 
  141.       new Generic_Internal_Discrete_Property (Gtk_Image_Type); 
  142.    type Property_Gtk_Image_Type is new Gtk_Image_Type_Properties.Property; 
  143.  
  144.    ------------------ 
  145.    -- Constructors -- 
  146.    ------------------ 
  147.  
  148.    procedure Gtk_New (Image : out Gtk_Image); 
  149.    procedure Initialize (Image : not null access Gtk_Image_Record'Class); 
  150.    --  Creates a new empty Gtk.Image.Gtk_Image widget. 
  151.  
  152.    function Gtk_Image_New return Gtk_Image; 
  153.    --  Creates a new empty Gtk.Image.Gtk_Image widget. 
  154.  
  155.    procedure Gtk_New 
  156.       (Image     : out Gtk_Image; 
  157.        Animation : Gdk.Pixbuf.Gdk_Pixbuf_Animation); 
  158.    procedure Initialize 
  159.       (Image     : not null access Gtk_Image_Record'Class; 
  160.        Animation : Gdk.Pixbuf.Gdk_Pixbuf_Animation); 
  161.    --  Creates a Gtk.Image.Gtk_Image displaying the given animation. The 
  162.    --  Gtk.Image.Gtk_Image does not assume a reference to the animation; you 
  163.    --  still need to unref it if you own references. Gtk.Image.Gtk_Image will 
  164.    --  add its own reference rather than adopting yours. 
  165.    --  Note that the animation frames are shown using a timeout with 
  166.    --  G_PRIORITY_DEFAULT. When using animations to indicate busyness, keep in 
  167.    --  mind that the animation will only be shown if the main loop is not busy 
  168.    --  with something that has a higher priority. 
  169.    --  "animation": an animation 
  170.  
  171.    function Gtk_Image_New_From_Animation 
  172.       (Animation : Gdk.Pixbuf.Gdk_Pixbuf_Animation) return Gtk_Image; 
  173.    --  Creates a Gtk.Image.Gtk_Image displaying the given animation. The 
  174.    --  Gtk.Image.Gtk_Image does not assume a reference to the animation; you 
  175.    --  still need to unref it if you own references. Gtk.Image.Gtk_Image will 
  176.    --  add its own reference rather than adopting yours. 
  177.    --  Note that the animation frames are shown using a timeout with 
  178.    --  G_PRIORITY_DEFAULT. When using animations to indicate busyness, keep in 
  179.    --  mind that the animation will only be shown if the main loop is not busy 
  180.    --  with something that has a higher priority. 
  181.    --  "animation": an animation 
  182.  
  183.    procedure Gtk_New (Image : out Gtk_Image; Filename : UTF8_String); 
  184.    procedure Initialize 
  185.       (Image    : not null access Gtk_Image_Record'Class; 
  186.        Filename : UTF8_String); 
  187.    --  Creates a new Gtk.Image.Gtk_Image displaying the file Filename. If the 
  188.    --  file isn't found or can't be loaded, the resulting Gtk.Image.Gtk_Image 
  189.    --  will display a "broken image" icon. This function never returns null, it 
  190.    --  always returns a valid Gtk.Image.Gtk_Image widget. 
  191.    --  If the file contains an animation, the image will contain an animation. 
  192.    --  If you need to detect failures to load the file, use 
  193.    --  Gdk.Pixbuf.Gdk_New_From_File to load the file yourself, then create the 
  194.    --  Gtk.Image.Gtk_Image from the pixbuf. (Or for animations, use 
  195.    --  Gdk.Pixbuf.Gdk_New_From_File). 
  196.    --  The storage type (gtk_image_get_storage_type) of the returned image is 
  197.    --  not defined, it will be whatever is appropriate for displaying the file. 
  198.    --  "filename": a filename 
  199.  
  200.    function Gtk_Image_New_From_File 
  201.       (Filename : UTF8_String) return Gtk_Image; 
  202.    --  Creates a new Gtk.Image.Gtk_Image displaying the file Filename. If the 
  203.    --  file isn't found or can't be loaded, the resulting Gtk.Image.Gtk_Image 
  204.    --  will display a "broken image" icon. This function never returns null, it 
  205.    --  always returns a valid Gtk.Image.Gtk_Image widget. 
  206.    --  If the file contains an animation, the image will contain an animation. 
  207.    --  If you need to detect failures to load the file, use 
  208.    --  Gdk.Pixbuf.Gdk_New_From_File to load the file yourself, then create the 
  209.    --  Gtk.Image.Gtk_Image from the pixbuf. (Or for animations, use 
  210.    --  Gdk.Pixbuf.Gdk_New_From_File). 
  211.    --  The storage type (gtk_image_get_storage_type) of the returned image is 
  212.    --  not defined, it will be whatever is appropriate for displaying the file. 
  213.    --  "filename": a filename 
  214.  
  215.    procedure Gtk_New_From_Gicon 
  216.       (Image : out Gtk_Image; 
  217.        Icon  : Glib.G_Icon.G_Icon; 
  218.        Size  : Gtk.Enums.Gtk_Icon_Size); 
  219.    procedure Initialize_From_Gicon 
  220.       (Image : not null access Gtk_Image_Record'Class; 
  221.        Icon  : Glib.G_Icon.G_Icon; 
  222.        Size  : Gtk.Enums.Gtk_Icon_Size); 
  223.    --  Creates a Gtk.Image.Gtk_Image displaying an icon from the current icon 
  224.    --  theme. If the icon name isn't known, a "broken image" icon will be 
  225.    --  displayed instead. If the current icon theme is changed, the icon will 
  226.    --  be updated appropriately. 
  227.    --  Since: gtk+ 2.14 
  228.    --  "icon": an icon 
  229.    --  "size": a stock icon size 
  230.  
  231.    function Gtk_Image_New_From_Gicon 
  232.       (Icon : Glib.G_Icon.G_Icon; 
  233.        Size : Gtk.Enums.Gtk_Icon_Size) return Gtk_Image; 
  234.    --  Creates a Gtk.Image.Gtk_Image displaying an icon from the current icon 
  235.    --  theme. If the icon name isn't known, a "broken image" icon will be 
  236.    --  displayed instead. If the current icon theme is changed, the icon will 
  237.    --  be updated appropriately. 
  238.    --  Since: gtk+ 2.14 
  239.    --  "icon": an icon 
  240.    --  "size": a stock icon size 
  241.  
  242.    procedure Gtk_New_From_Icon_Name 
  243.       (Image     : out Gtk_Image; 
  244.        Icon_Name : UTF8_String; 
  245.        Size      : Gtk.Enums.Gtk_Icon_Size); 
  246.    procedure Initialize_From_Icon_Name 
  247.       (Image     : not null access Gtk_Image_Record'Class; 
  248.        Icon_Name : UTF8_String; 
  249.        Size      : Gtk.Enums.Gtk_Icon_Size); 
  250.    --  Creates a Gtk.Image.Gtk_Image displaying an icon from the current icon 
  251.    --  theme. If the icon name isn't known, a "broken image" icon will be 
  252.    --  displayed instead. If the current icon theme is changed, the icon will 
  253.    --  be updated appropriately. 
  254.    --  Since: gtk+ 2.6 
  255.    --  "icon_name": an icon name 
  256.    --  "size": a stock icon size 
  257.  
  258.    function Gtk_Image_New_From_Icon_Name 
  259.       (Icon_Name : UTF8_String; 
  260.        Size      : Gtk.Enums.Gtk_Icon_Size) return Gtk_Image; 
  261.    --  Creates a Gtk.Image.Gtk_Image displaying an icon from the current icon 
  262.    --  theme. If the icon name isn't known, a "broken image" icon will be 
  263.    --  displayed instead. If the current icon theme is changed, the icon will 
  264.    --  be updated appropriately. 
  265.    --  Since: gtk+ 2.6 
  266.    --  "icon_name": an icon name 
  267.    --  "size": a stock icon size 
  268.  
  269.    procedure Gtk_New 
  270.       (Image    : out Gtk_Image; 
  271.        Icon_Set : Gtk.Icon_Set.Gtk_Icon_Set; 
  272.        Size     : Gtk.Enums.Gtk_Icon_Size); 
  273.    procedure Initialize 
  274.       (Image    : not null access Gtk_Image_Record'Class; 
  275.        Icon_Set : Gtk.Icon_Set.Gtk_Icon_Set; 
  276.        Size     : Gtk.Enums.Gtk_Icon_Size); 
  277.    --  Creates a Gtk.Image.Gtk_Image displaying an icon set. Sample stock 
  278.    --  sizes are GTK_ICON_SIZE_MENU, GTK_ICON_SIZE_SMALL_TOOLBAR. Instead of 
  279.    --  using this function, usually it's better to create a 
  280.    --  Gtk.Icon_Factory.Gtk_Icon_Factory, put your icon sets in the icon 
  281.    --  factory, add the icon factory to the list of default factories with 
  282.    --  Gtk.Icon_Factory.Add_Default, and then use Gtk.Image.Gtk_New. This will 
  283.    --  allow themes to override the icon you ship with your application. 
  284.    --  The Gtk.Image.Gtk_Image does not assume a reference to the icon set; 
  285.    --  you still need to unref it if you own references. Gtk.Image.Gtk_Image 
  286.    --  will add its own reference rather than adopting yours. 
  287.    --  "icon_set": a Gtk.Icon_Set.Gtk_Icon_Set 
  288.    --  "size": a stock icon size 
  289.  
  290.    function Gtk_Image_New_From_Icon_Set 
  291.       (Icon_Set : Gtk.Icon_Set.Gtk_Icon_Set; 
  292.        Size     : Gtk.Enums.Gtk_Icon_Size) return Gtk_Image; 
  293.    --  Creates a Gtk.Image.Gtk_Image displaying an icon set. Sample stock 
  294.    --  sizes are GTK_ICON_SIZE_MENU, GTK_ICON_SIZE_SMALL_TOOLBAR. Instead of 
  295.    --  using this function, usually it's better to create a 
  296.    --  Gtk.Icon_Factory.Gtk_Icon_Factory, put your icon sets in the icon 
  297.    --  factory, add the icon factory to the list of default factories with 
  298.    --  Gtk.Icon_Factory.Add_Default, and then use Gtk.Image.Gtk_New. This will 
  299.    --  allow themes to override the icon you ship with your application. 
  300.    --  The Gtk.Image.Gtk_Image does not assume a reference to the icon set; 
  301.    --  you still need to unref it if you own references. Gtk.Image.Gtk_Image 
  302.    --  will add its own reference rather than adopting yours. 
  303.    --  "icon_set": a Gtk.Icon_Set.Gtk_Icon_Set 
  304.    --  "size": a stock icon size 
  305.  
  306.    procedure Gtk_New 
  307.       (Image  : out Gtk_Image; 
  308.        Pixbuf : access Gdk.Pixbuf.Gdk_Pixbuf_Record'Class); 
  309.    procedure Initialize 
  310.       (Image  : not null access Gtk_Image_Record'Class; 
  311.        Pixbuf : access Gdk.Pixbuf.Gdk_Pixbuf_Record'Class); 
  312.    --  Creates a new Gtk.Image.Gtk_Image displaying Pixbuf. The 
  313.    --  Gtk.Image.Gtk_Image does not assume a reference to the pixbuf; you still 
  314.    --  need to unref it if you own references. Gtk.Image.Gtk_Image will add its 
  315.    --  own reference rather than adopting yours. 
  316.    --  Note that this function just creates an Gtk.Image.Gtk_Image from the 
  317.    --  pixbuf. The Gtk.Image.Gtk_Image created will not react to state changes. 
  318.    --  Should you want that, you should use Gtk.Image.Gtk_New. 
  319.    --  "pixbuf": a Gdk.Pixbuf.Gdk_Pixbuf, or null 
  320.  
  321.    function Gtk_Image_New_From_Pixbuf 
  322.       (Pixbuf : access Gdk.Pixbuf.Gdk_Pixbuf_Record'Class) return Gtk_Image; 
  323.    --  Creates a new Gtk.Image.Gtk_Image displaying Pixbuf. The 
  324.    --  Gtk.Image.Gtk_Image does not assume a reference to the pixbuf; you still 
  325.    --  need to unref it if you own references. Gtk.Image.Gtk_Image will add its 
  326.    --  own reference rather than adopting yours. 
  327.    --  Note that this function just creates an Gtk.Image.Gtk_Image from the 
  328.    --  pixbuf. The Gtk.Image.Gtk_Image created will not react to state changes. 
  329.    --  Should you want that, you should use Gtk.Image.Gtk_New. 
  330.    --  "pixbuf": a Gdk.Pixbuf.Gdk_Pixbuf, or null 
  331.  
  332.    procedure Gtk_New_From_Resource 
  333.       (Image         : out Gtk_Image; 
  334.        Resource_Path : UTF8_String); 
  335.    procedure Initialize_From_Resource 
  336.       (Image         : not null access Gtk_Image_Record'Class; 
  337.        Resource_Path : UTF8_String); 
  338.    --  Creates a new Gtk.Image.Gtk_Image displaying the resource file 
  339.    --  Resource_Path. If the file isn't found or can't be loaded, the resulting 
  340.    --  Gtk.Image.Gtk_Image will display a "broken image" icon. This function 
  341.    --  never returns null, it always returns a valid Gtk.Image.Gtk_Image 
  342.    --  widget. 
  343.    --  If the file contains an animation, the image will contain an animation. 
  344.    --  If you need to detect failures to load the file, use 
  345.    --  Gdk.Pixbuf.Gdk_New_From_File to load the file yourself, then create the 
  346.    --  Gtk.Image.Gtk_Image from the pixbuf. (Or for animations, use 
  347.    --  Gdk.Pixbuf.Gdk_New_From_File). 
  348.    --  The storage type (gtk_image_get_storage_type) of the returned image is 
  349.    --  not defined, it will be whatever is appropriate for displaying the file. 
  350.    --  Since: gtk+ 3.4 
  351.    --  "resource_path": a resource path 
  352.  
  353.    function Gtk_Image_New_From_Resource 
  354.       (Resource_Path : UTF8_String) return Gtk_Image; 
  355.    --  Creates a new Gtk.Image.Gtk_Image displaying the resource file 
  356.    --  Resource_Path. If the file isn't found or can't be loaded, the resulting 
  357.    --  Gtk.Image.Gtk_Image will display a "broken image" icon. This function 
  358.    --  never returns null, it always returns a valid Gtk.Image.Gtk_Image 
  359.    --  widget. 
  360.    --  If the file contains an animation, the image will contain an animation. 
  361.    --  If you need to detect failures to load the file, use 
  362.    --  Gdk.Pixbuf.Gdk_New_From_File to load the file yourself, then create the 
  363.    --  Gtk.Image.Gtk_Image from the pixbuf. (Or for animations, use 
  364.    --  Gdk.Pixbuf.Gdk_New_From_File). 
  365.    --  The storage type (gtk_image_get_storage_type) of the returned image is 
  366.    --  not defined, it will be whatever is appropriate for displaying the file. 
  367.    --  Since: gtk+ 3.4 
  368.    --  "resource_path": a resource path 
  369.  
  370.    procedure Gtk_New 
  371.       (Image    : out Gtk_Image; 
  372.        Stock_Id : UTF8_String; 
  373.        Size     : Gtk.Enums.Gtk_Icon_Size); 
  374.    procedure Initialize 
  375.       (Image    : not null access Gtk_Image_Record'Class; 
  376.        Stock_Id : UTF8_String; 
  377.        Size     : Gtk.Enums.Gtk_Icon_Size); 
  378.    --  Creates a Gtk.Image.Gtk_Image displaying a stock icon. Sample stock 
  379.    --  icon names are GTK_STOCK_OPEN, GTK_STOCK_QUIT. Sample stock sizes are 
  380.    --  GTK_ICON_SIZE_MENU, GTK_ICON_SIZE_SMALL_TOOLBAR. If the stock icon name 
  381.    --  isn't known, the image will be empty. You can register your own stock 
  382.    --  icon names, see Gtk.Icon_Factory.Add_Default and Gtk.Icon_Factory.Add. 
  383.    --  "stock_id": a stock icon name 
  384.    --  "size": a stock icon size 
  385.  
  386.    function Gtk_Image_New_From_Stock 
  387.       (Stock_Id : UTF8_String; 
  388.        Size     : Gtk.Enums.Gtk_Icon_Size) return Gtk_Image; 
  389.    --  Creates a Gtk.Image.Gtk_Image displaying a stock icon. Sample stock 
  390.    --  icon names are GTK_STOCK_OPEN, GTK_STOCK_QUIT. Sample stock sizes are 
  391.    --  GTK_ICON_SIZE_MENU, GTK_ICON_SIZE_SMALL_TOOLBAR. If the stock icon name 
  392.    --  isn't known, the image will be empty. You can register your own stock 
  393.    --  icon names, see Gtk.Icon_Factory.Add_Default and Gtk.Icon_Factory.Add. 
  394.    --  "stock_id": a stock icon name 
  395.    --  "size": a stock icon size 
  396.  
  397.    function Get_Type return Glib.GType; 
  398.    pragma Import (C, Get_Type, "gtk_image_get_type"); 
  399.  
  400.    ------------- 
  401.    -- Methods -- 
  402.    ------------- 
  403.  
  404.    procedure Clear (Image : not null access Gtk_Image_Record); 
  405.    --  Resets the image to be empty. 
  406.    --  Since: gtk+ 2.8 
  407.  
  408.    function Get 
  409.       (Image : not null access Gtk_Image_Record) 
  410.        return Gdk.Pixbuf.Gdk_Pixbuf_Animation; 
  411.    --  Gets the Gdk_Pixbuf_Animation being displayed by the 
  412.    --  Gtk.Image.Gtk_Image. The storage type of the image must be 
  413.    --  Gtk.Image.Image_Empty or Gtk.Image.Image_Animation (see 
  414.    --  Gtk.Image.Get_Storage_Type). The caller of this function does not own a 
  415.    --  reference to the returned animation. 
  416.  
  417.    procedure Get 
  418.       (Image  : not null access Gtk_Image_Record; 
  419.        G_Icon : out Glib.G_Icon.G_Icon; 
  420.        Size   : out Gtk.Enums.Gtk_Icon_Size); 
  421.    --  Gets the Glib.G_Icon.G_Icon and size being displayed by the 
  422.    --  Gtk.Image.Gtk_Image. The storage type of the image must be 
  423.    --  Gtk.Image.Image_Empty or Gtk.Image.Image_Gicon (see 
  424.    --  Gtk.Image.Get_Storage_Type). The caller of this function does not own a 
  425.    --  reference to the returned Glib.G_Icon.G_Icon. 
  426.    --  Since: gtk+ 2.14 
  427.    --  "gicon": place to store a Glib.G_Icon.G_Icon, or null 
  428.    --  "size": place to store an icon size, or null 
  429.  
  430.    procedure Get 
  431.       (Image    : not null access Gtk_Image_Record; 
  432.        Icon_Set : out Gtk.Icon_Set.Gtk_Icon_Set; 
  433.        Size     : out Gtk.Enums.Gtk_Icon_Size); 
  434.    --  Gets the icon set and size being displayed by the Gtk.Image.Gtk_Image. 
  435.    --  The storage type of the image must be Gtk.Image.Image_Empty or 
  436.    --  Gtk.Image.Image_Icon_Set (see Gtk.Image.Get_Storage_Type). 
  437.    --  "icon_set": location to store a Gtk.Icon_Set.Gtk_Icon_Set, or null 
  438.    --  "size": location to store a stock icon size, or null 
  439.  
  440.    function Get 
  441.       (Image : not null access Gtk_Image_Record) 
  442.        return Gdk.Pixbuf.Gdk_Pixbuf; 
  443.    --  Gets the Gdk.Pixbuf.Gdk_Pixbuf being displayed by the 
  444.    --  Gtk.Image.Gtk_Image. The storage type of the image must be 
  445.    --  Gtk.Image.Image_Empty or Gtk.Image.Image_Pixbuf (see 
  446.    --  Gtk.Image.Get_Storage_Type). The caller of this function does not own a 
  447.    --  reference to the returned pixbuf. 
  448.  
  449.    function Get_Pixel_Size 
  450.       (Image : not null access Gtk_Image_Record) return Gint; 
  451.    --  Gets the pixel size used for named icons. 
  452.    --  Since: gtk+ 2.6 
  453.  
  454.    procedure Set_Pixel_Size 
  455.       (Image      : not null access Gtk_Image_Record; 
  456.        Pixel_Size : Gint); 
  457.    --  Sets the pixel size to use for named icons. If the pixel size is set to 
  458.    --  a value != -1, it is used instead of the icon size set by 
  459.    --  Gtk.Image.Set_From_Icon_Name. 
  460.    --  Since: gtk+ 2.6 
  461.    --  "pixel_size": the new pixel size 
  462.  
  463.    function Get_Storage_Type 
  464.       (Image : not null access Gtk_Image_Record) return Gtk_Image_Type; 
  465.    --  Gets the type of representation being used by the Gtk.Image.Gtk_Image 
  466.    --  to store image data. If the Gtk.Image.Gtk_Image has no image data, the 
  467.    --  return value will be Gtk.Image.Image_Empty. 
  468.  
  469.    procedure Set 
  470.       (Image     : not null access Gtk_Image_Record; 
  471.        Animation : Gdk.Pixbuf.Gdk_Pixbuf_Animation); 
  472.    --  Causes the Gtk.Image.Gtk_Image to display the given animation (or 
  473.    --  display nothing, if you set the animation to null). 
  474.    --  "animation": the Gdk_Pixbuf_Animation 
  475.  
  476.    procedure Set 
  477.       (Image    : not null access Gtk_Image_Record; 
  478.        Filename : UTF8_String := ""); 
  479.    --  See Gtk.Image.Gtk_New for details. 
  480.    --  "filename": a filename or null 
  481.  
  482.    procedure Set 
  483.       (Image : not null access Gtk_Image_Record; 
  484.        Icon  : Glib.G_Icon.G_Icon; 
  485.        Size  : Gtk.Enums.Gtk_Icon_Size); 
  486.    --  See Gtk.Image.Gtk_New_From_Gicon for details. 
  487.    --  Since: gtk+ 2.14 
  488.    --  "icon": an icon 
  489.    --  "size": an icon size 
  490.  
  491.    procedure Set 
  492.       (Image    : not null access Gtk_Image_Record; 
  493.        Icon_Set : Gtk.Icon_Set.Gtk_Icon_Set; 
  494.        Size     : Gtk.Enums.Gtk_Icon_Size); 
  495.    --  See Gtk.Image.Gtk_New for details. 
  496.    --  "icon_set": a Gtk.Icon_Set.Gtk_Icon_Set 
  497.    --  "size": a stock icon size 
  498.  
  499.    procedure Set 
  500.       (Image  : not null access Gtk_Image_Record; 
  501.        Pixbuf : access Gdk.Pixbuf.Gdk_Pixbuf_Record'Class); 
  502.    --  See Gtk.Image.Gtk_New for details. 
  503.    --  "pixbuf": a Gdk.Pixbuf.Gdk_Pixbuf or null 
  504.  
  505.    procedure Set 
  506.       (Image    : not null access Gtk_Image_Record; 
  507.        Stock_Id : UTF8_String; 
  508.        Size     : Gtk.Enums.Gtk_Icon_Size); 
  509.    --  See Gtk.Image.Gtk_New for details. 
  510.    --  "stock_id": a stock icon name 
  511.    --  "size": a stock icon size 
  512.  
  513.    procedure Set_From_Icon_Name 
  514.       (Image     : not null access Gtk_Image_Record; 
  515.        Icon_Name : UTF8_String; 
  516.        Size      : Gtk.Enums.Gtk_Icon_Size); 
  517.    --  See Gtk.Image.Gtk_New_From_Icon_Name for details. 
  518.    --  Since: gtk+ 2.6 
  519.    --  "icon_name": an icon name 
  520.    --  "size": an icon size 
  521.  
  522.    procedure Set_From_Resource 
  523.       (Image         : not null access Gtk_Image_Record; 
  524.        Resource_Path : UTF8_String := ""); 
  525.    --  See Gtk.Image.Gtk_New_From_Resource for details. 
  526.    --  "resource_path": a resource path or null 
  527.  
  528.    ---------------------- 
  529.    -- GtkAda additions -- 
  530.    ---------------------- 
  531.  
  532.    function Get 
  533.      (Image : access Gtk_Image_Record; 
  534.       Size  : access Gtk.Enums.Gtk_Icon_Size) return String; 
  535.    --  Get the stock_id for the image displayed 
  536.  
  537.    procedure Get_Icon_Name 
  538.      (Image : access Gtk_Image_Record; 
  539.       Name  : out GNAT.Strings.String_Access; 
  540.       Size  : out Gtk.Enums.Gtk_Icon_Size); 
  541.  
  542.    ---------------- 
  543.    -- Properties -- 
  544.    ---------------- 
  545.    --  The following properties are defined for this widget. See 
  546.    --  Glib.Properties for more information on properties) 
  547.  
  548.    File_Property : constant Glib.Properties.Property_String; 
  549.  
  550.    G_Icon_Property : constant Glib.Properties.Property_Boxed; 
  551.    --  Type: Glib.G_Icon.G_Icon 
  552.    --  The GIcon displayed in the GtkImage. For themed icons, If the icon 
  553.    --  theme is changed, the image will be updated automatically. 
  554.  
  555.    Icon_Name_Property : constant Glib.Properties.Property_String; 
  556.    --  The name of the icon in the icon theme. If the icon theme is changed, 
  557.    --  the image will be updated automatically. 
  558.  
  559.    Icon_Set_Property : constant Glib.Properties.Property_Object; 
  560.    --  Type: Gtk.Icon_Set.Gtk_Icon_Set 
  561.  
  562.    Icon_Size_Property : constant Glib.Properties.Property_Int; 
  563.  
  564.    Pixbuf_Property : constant Glib.Properties.Property_Object; 
  565.    --  Type: Gdk.Pixbuf.Gdk_Pixbuf 
  566.  
  567.    Pixbuf_Animation_Property : constant Glib.Properties.Property_Boxed; 
  568.    --  Type: Gdk.Pixbuf.Gdk_Pixbuf_Animation 
  569.  
  570.    Pixel_Size_Property : constant Glib.Properties.Property_Int; 
  571.    --  The "pixel-size" property can be used to specify a fixed size 
  572.    --  overriding the Gtk.Image.Gtk_Image:icon-size property for images of type 
  573.    --  Gtk.Image.Image_Icon_Name. 
  574.  
  575.    Resource_Property : constant Glib.Properties.Property_String; 
  576.    --  A path to a resource file to display. 
  577.  
  578.    Stock_Property : constant Glib.Properties.Property_String; 
  579.  
  580.    Storage_Type_Property : constant Gtk.Image.Property_Gtk_Image_Type; 
  581.    --  Type: Gtk_Image_Type 
  582.  
  583.    Use_Fallback_Property : constant Glib.Properties.Property_Boolean; 
  584.    --  Whether the icon displayed in the GtkImage will use standard icon names 
  585.    --  fallback. The value of this property is only relevant for images of type 
  586.    --  Gtk.Image.Image_Icon_Name and Gtk.Image.Image_Gicon. 
  587.  
  588.    ---------------- 
  589.    -- Interfaces -- 
  590.    ---------------- 
  591.    --  This class implements several interfaces. See Glib.Types 
  592.    -- 
  593.    --  - "Buildable" 
  594.  
  595.    package Implements_Gtk_Buildable is new Glib.Types.Implements 
  596.      (Gtk.Buildable.Gtk_Buildable, Gtk_Image_Record, Gtk_Image); 
  597.    function "+" 
  598.      (Widget : access Gtk_Image_Record'Class) 
  599.    return Gtk.Buildable.Gtk_Buildable 
  600.    renames Implements_Gtk_Buildable.To_Interface; 
  601.    function "-" 
  602.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  603.    return Gtk_Image 
  604.    renames Implements_Gtk_Buildable.To_Object; 
  605.  
  606. private 
  607.    Use_Fallback_Property : constant Glib.Properties.Property_Boolean := 
  608.      Glib.Properties.Build ("use-fallback"); 
  609.    Storage_Type_Property : constant Gtk.Image.Property_Gtk_Image_Type := 
  610.      Gtk.Image.Build ("storage-type"); 
  611.    Stock_Property : constant Glib.Properties.Property_String := 
  612.      Glib.Properties.Build ("stock"); 
  613.    Resource_Property : constant Glib.Properties.Property_String := 
  614.      Glib.Properties.Build ("resource"); 
  615.    Pixel_Size_Property : constant Glib.Properties.Property_Int := 
  616.      Glib.Properties.Build ("pixel-size"); 
  617.    Pixbuf_Animation_Property : constant Glib.Properties.Property_Boxed := 
  618.      Glib.Properties.Build ("pixbuf-animation"); 
  619.    Pixbuf_Property : constant Glib.Properties.Property_Object := 
  620.      Glib.Properties.Build ("pixbuf"); 
  621.    Icon_Size_Property : constant Glib.Properties.Property_Int := 
  622.      Glib.Properties.Build ("icon-size"); 
  623.    Icon_Set_Property : constant Glib.Properties.Property_Object := 
  624.      Glib.Properties.Build ("icon-set"); 
  625.    Icon_Name_Property : constant Glib.Properties.Property_String := 
  626.      Glib.Properties.Build ("icon-name"); 
  627.    G_Icon_Property : constant Glib.Properties.Property_Boxed := 
  628.      Glib.Properties.Build ("gicon"); 
  629.    File_Property : constant Glib.Properties.Property_String := 
  630.      Glib.Properties.Build ("file"); 
  631. end Gtk.Image;