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. --  Gtk.Icon_Theme.Gtk_Icon_Theme provides a facility for looking up icons by 
  26. --  name and size. The main reason for using a name rather than simply 
  27. --  providing a filename is to allow different icons to be used depending on 
  28. --  what 'icon theme' is selected by the user. The operation of icon themes on 
  29. --  Linux and Unix follows the <ulink 
  30. --  url="http://www.freedesktop.org/Standards/icon-theme-spec">Icon Theme 
  31. --  Specification</ulink>. There is a default icon theme, named 'hicolor' where 
  32. --  applications should install their icons, but more additional application 
  33. --  themes can be installed as operating system vendors and users choose. 
  34. -- 
  35. --  Named icons are similar to the <xref 
  36. --  linkend="gtk3-Themeable-Stock-Images"/> facility, and the distinction 
  37. --  between the two may be a bit confusing. A few things to keep in mind: 
  38. -- 
  39. --     * Stock images usually are used in conjunction with <xref 
  40. --  linkend="gtk3-Stock-Items"/>, such as GTK_STOCK_OK or GTK_STOCK_OPEN. Named 
  41. --  icons are easier to set up and therefore are more useful for new icons that 
  42. --  an application wants to add, such as application icons or window icons. 
  43. -- 
  44. --     * Stock images can only be loaded at the symbolic sizes defined by the 
  45. --  Gtk.Enums.Gtk_Icon_Size enumeration, or by custom sizes defined by 
  46. --  Gtk.Icon_Factory.Icon_Size_Register, while named icons are more flexible 
  47. --  and any pixel size can be specified. 
  48. -- 
  49. --     * Because stock images are closely tied to stock items, and thus to 
  50. --  actions in the user interface, stock images may come in multiple variants 
  51. --  for different widget states or writing directions. 
  52. -- 
  53. --  A good rule of thumb is that if there is a stock image for what you want 
  54. --  to use, use it, otherwise use a named icon. It turns out that internally 
  55. --  stock images are generally defined in terms of one or more named icons. (An 
  56. --  example of the more than one case is icons that depend on writing 
  57. --  direction; GTK_STOCK_GO_FORWARD uses the two themed icons 
  58. --  "gtk-stock-go-forward-ltr" and "gtk-stock-go-forward-rtl".) 
  59. -- 
  60. --  In many cases, named themes are used indirectly, via Gtk.Image.Gtk_Image 
  61. --  or stock items, rather than directly, but looking up icons directly is also 
  62. --  simple. The Gtk.Icon_Theme.Gtk_Icon_Theme object acts as a database of all 
  63. --  the icons in the current theme. You can create new 
  64. --  Gtk.Icon_Theme.Gtk_Icon_Theme objects, but it's much more efficient to use 
  65. --  the standard icon theme for the Gdk.Screen.Gdk_Screen so that the icon 
  66. --  information is shared with other people looking up icons. In the case where 
  67. --  the default screen is being used, looking up an icon can be as simple as: 
  68. -- 
  69. --    GError *error = NULL; 
  70. --    GtkIconTheme *icon_theme; 
  71. --    GdkPixbuf *pixbuf; 
  72. --    icon_theme = gtk_icon_theme_get_default (); 
  73. --    pixbuf = gtk_icon_theme_load_icon (icon_theme, 
  74. --       "my-icon-name", // icon name 
  75. --       48, // size 
  76. --       0,  // flags 
  77. --       &error); 
  78. --    if (!pixbuf) 
  79. --    { 
  80. --       g_warning ("Couldn't load icon: %s", error->message); 
  81. --       g_error_free (error); 
  82. --    } 
  83. -- else 
  84. --    { 
  85. --       // Use the pixbuf 
  86. --       g_object_unref (pixbuf); 
  87. --    } 
  88. -- 
  89. -- 
  90. --  </description> 
  91. pragma Ada_2005; 
  92.  
  93. pragma Warnings (Off, "*is already use-visible*"); 
  94. with GNAT.Strings;            use GNAT.Strings; 
  95. with Gdk.Pixbuf;              use Gdk.Pixbuf; 
  96. with Gdk.RGBA;                use Gdk.RGBA; 
  97. with Gdk.Rectangle;           use Gdk.Rectangle; 
  98. with Gdk.Screen;              use Gdk.Screen; 
  99. with Gdk.Types;               use Gdk.Types; 
  100. with Glib;                    use Glib; 
  101. with Glib.G_Icon;             use Glib.G_Icon; 
  102. with Glib.Generic_Properties; use Glib.Generic_Properties; 
  103. with Glib.Object;             use Glib.Object; 
  104. with Gtk.Enums;               use Gtk.Enums; 
  105. with Gtk.Style;               use Gtk.Style; 
  106. with Gtk.Style_Context;       use Gtk.Style_Context; 
  107.  
  108. package Gtk.Icon_Theme is 
  109.  
  110.    type Gtk_Icon_Theme_Record is new GObject_Record with null record; 
  111.    type Gtk_Icon_Theme is access all Gtk_Icon_Theme_Record'Class; 
  112.  
  113.    type Gtk_Icon_Lookup_Flags is mod 2 ** Integer'Size; 
  114.    pragma Convention (C, Gtk_Icon_Lookup_Flags); 
  115.    --  Used to specify options for Gtk.Icon_Theme.Lookup_Icon 
  116.  
  117.    Icon_Lookup_No_Svg : constant Gtk_Icon_Lookup_Flags := 1; 
  118.    Icon_Lookup_Force_Svg : constant Gtk_Icon_Lookup_Flags := 2; 
  119.    Icon_Lookup_Use_Builtin : constant Gtk_Icon_Lookup_Flags := 4; 
  120.    Icon_Lookup_Generic_Fallback : constant Gtk_Icon_Lookup_Flags := 8; 
  121.    Icon_Lookup_Force_Size : constant Gtk_Icon_Lookup_Flags := 16; 
  122.  
  123.    type Gtk_Icon_Info_Record is new GObject_Record with null record; 
  124.    type Gtk_Icon_Info is access all Gtk_Icon_Info_Record'Class; 
  125.  
  126.    ---------------------------- 
  127.    -- Enumeration Properties -- 
  128.    ---------------------------- 
  129.  
  130.    package Gtk_Icon_Lookup_Flags_Properties is 
  131.       new Generic_Internal_Discrete_Property (Gtk_Icon_Lookup_Flags); 
  132.    type Property_Gtk_Icon_Lookup_Flags is new Gtk_Icon_Lookup_Flags_Properties.Property; 
  133.  
  134.    ------------------ 
  135.    -- Constructors -- 
  136.    ------------------ 
  137.  
  138.    procedure Gtk_New (Icon_Theme : out Gtk_Icon_Theme); 
  139.    procedure Initialize 
  140.       (Icon_Theme : not null access Gtk_Icon_Theme_Record'Class); 
  141.    --  Creates a new icon theme object. Icon theme objects are used to lookup 
  142.    --  up an icon by name in a particular icon theme. Usually, you'll want to 
  143.    --  use Gtk.Icon_Theme.Get_Default or Gtk.Icon_Theme.Get_For_Screen rather 
  144.    --  than creating a new icon theme object for scratch. 
  145.    --  Since: gtk+ 2.4 
  146.  
  147.    function Gtk_Icon_Theme_New return Gtk_Icon_Theme; 
  148.    --  Creates a new icon theme object. Icon theme objects are used to lookup 
  149.    --  up an icon by name in a particular icon theme. Usually, you'll want to 
  150.    --  use Gtk.Icon_Theme.Get_Default or Gtk.Icon_Theme.Get_For_Screen rather 
  151.    --  than creating a new icon theme object for scratch. 
  152.    --  Since: gtk+ 2.4 
  153.  
  154.    function Get_Type return Glib.GType; 
  155.    pragma Import (C, Get_Type, "gtk_icon_theme_get_type"); 
  156.  
  157.    procedure Gtk_New_For_Pixbuf 
  158.       (Icon_Info  : out Gtk_Icon_Info; 
  159.        Icon_Theme : not null access Gtk_Icon_Theme_Record'Class; 
  160.        Pixbuf     : not null access Gdk.Pixbuf.Gdk_Pixbuf_Record'Class); 
  161.    procedure Initialize_For_Pixbuf 
  162.       (Icon_Info  : not null access Gtk_Icon_Info_Record'Class; 
  163.        Icon_Theme : not null access Gtk_Icon_Theme_Record'Class; 
  164.        Pixbuf     : not null access Gdk.Pixbuf.Gdk_Pixbuf_Record'Class); 
  165.    --  Creates a Gtk.Icon_Theme.Gtk_Icon_Info for a Gdk.Pixbuf.Gdk_Pixbuf. 
  166.    --  Since: gtk+ 2.14 
  167.    --  "icon_theme": a Gtk.Icon_Theme.Gtk_Icon_Theme 
  168.    --  "pixbuf": the pixbuf to wrap in a Gtk.Icon_Theme.Gtk_Icon_Info 
  169.  
  170.    function Gtk_Icon_Info_New_For_Pixbuf 
  171.       (Icon_Theme : not null access Gtk_Icon_Theme_Record'Class; 
  172.        Pixbuf     : not null access Gdk.Pixbuf.Gdk_Pixbuf_Record'Class) 
  173.        return Gtk_Icon_Info; 
  174.    --  Creates a Gtk.Icon_Theme.Gtk_Icon_Info for a Gdk.Pixbuf.Gdk_Pixbuf. 
  175.    --  Since: gtk+ 2.14 
  176.    --  "icon_theme": a Gtk.Icon_Theme.Gtk_Icon_Theme 
  177.    --  "pixbuf": the pixbuf to wrap in a Gtk.Icon_Theme.Gtk_Icon_Info 
  178.  
  179.    function Icon_Info_Get_Type return Glib.GType; 
  180.    pragma Import (C, Icon_Info_Get_Type, "gtk_icon_info_get_type"); 
  181.  
  182.    ------------- 
  183.    -- Methods -- 
  184.    ------------- 
  185.  
  186.    procedure Append_Search_Path 
  187.       (Icon_Theme : not null access Gtk_Icon_Theme_Record; 
  188.        Path       : UTF8_String); 
  189.    --  Appends a directory to the search path. See 
  190.    --  Gtk.Icon_Theme.Set_Search_Path. 
  191.    --  Since: gtk+ 2.4 
  192.    --  "path": directory name to append to the icon path 
  193.  
  194.    function Choose_Icon 
  195.       (Icon_Theme : not null access Gtk_Icon_Theme_Record'Class; 
  196.        Icon_Names : GNAT.Strings.String_List; 
  197.        Size       : Gint; 
  198.        Flags      : Gtk_Icon_Lookup_Flags) return Gtk_Icon_Info; 
  199.    --  Looks up a named icon and returns a structure containing information 
  200.    --  such as the filename of the icon. The icon can then be rendered into a 
  201.    --  pixbuf using Gtk.Icon_Theme.Load_Icon. (gtk_icon_theme_load_icon 
  202.    --  combines these two steps if all you need is the pixbuf.) 
  203.    --  If Icon_Names contains more than one name, this function tries them all 
  204.    --  in the given order before falling back to inherited icon themes. 
  205.    --  Since: gtk+ 2.12 
  206.    --  "icon_names": null-terminated array of icon names to lookup 
  207.    --  "size": desired icon size 
  208.    --  "flags": flags modifying the behavior of the icon lookup 
  209.  
  210.    function Get_Example_Icon_Name 
  211.       (Icon_Theme : not null access Gtk_Icon_Theme_Record) 
  212.        return UTF8_String; 
  213.    --  Gets the name of an icon that is representative of the current theme 
  214.    --  (for instance, to use when presenting a list of themes to the user.) 
  215.    --  Since: gtk+ 2.4 
  216.  
  217.    function Get_Icon_Sizes 
  218.       (Icon_Theme : not null access Gtk_Icon_Theme_Record; 
  219.        Icon_Name  : UTF8_String) return Gint_Array; 
  220.    --  Returns an array of integers describing the sizes at which the icon is 
  221.    --  available without scaling. A size of -1 means that the icon is available 
  222.    --  in a scalable format. The array is zero-terminated. 
  223.    --  Since: gtk+ 2.6 
  224.    --  "icon_name": the name of an icon 
  225.  
  226.    function Get_Search_Path 
  227.       (Icon_Theme : not null access Gtk_Icon_Theme_Record) 
  228.        return GNAT.Strings.String_List; 
  229.    --  Gets the current search path. See Gtk.Icon_Theme.Set_Search_Path. 
  230.    --  Since: gtk+ 2.4 
  231.  
  232.    procedure Set_Search_Path 
  233.       (Icon_Theme : not null access Gtk_Icon_Theme_Record; 
  234.        Path       : GNAT.Strings.String_List); 
  235.    --  Sets the search path for the icon theme object. When looking for an 
  236.    --  icon theme, GTK+ will search for a subdirectory of one or more of the 
  237.    --  directories in Path with the same name as the icon theme. (Themes from 
  238.    --  multiple of the path elements are combined to allow themes to be 
  239.    --  extended by adding icons in the user's home directory.) 
  240.    --  In addition if an icon found isn't found either in the current icon 
  241.    --  theme or the default icon theme, and an image file with the right name 
  242.    --  is found directly in one of the elements of Path, then that image will 
  243.    --  be used for the icon name. (This is legacy feature, and new icons should 
  244.    --  be put into the default icon theme, which is called DEFAULT_THEME_NAME, 
  245.    --  rather than directly on the icon path.) 
  246.    --  Since: gtk+ 2.4 
  247.    --  "path": array of directories that are searched for icon themes 
  248.  
  249.    function Has_Icon 
  250.       (Icon_Theme : not null access Gtk_Icon_Theme_Record; 
  251.        Icon_Name  : UTF8_String) return Boolean; 
  252.    --  Checks whether an icon theme includes an icon for a particular name. 
  253.    --  Since: gtk+ 2.4 
  254.    --  "icon_name": the name of an icon 
  255.  
  256.    function List_Contexts 
  257.       (Icon_Theme : not null access Gtk_Icon_Theme_Record) 
  258.        return Gtk.Enums.String_List.Glist; 
  259.    --  Gets the list of contexts available within the current hierarchy of 
  260.    --  icon themes 
  261.    --  Since: gtk+ 2.12 
  262.  
  263.    function List_Icons 
  264.       (Icon_Theme : not null access Gtk_Icon_Theme_Record; 
  265.        Context    : UTF8_String := "") return Gtk.Enums.String_List.Glist; 
  266.    --  Lists the icons in the current icon theme. Only a subset of the icons 
  267.    --  can be listed by providing a context string. The set of values for the 
  268.    --  context string is system dependent, but will typically include such 
  269.    --  values as "Applications" and "MimeTypes". 
  270.    --  Since: gtk+ 2.4 
  271.    --  "context": a string identifying a particular type of icon, or null to 
  272.    --  list all icons. 
  273.  
  274.    function Load_Icon 
  275.       (Icon_Theme : not null access Gtk_Icon_Theme_Record; 
  276.        Icon_Name  : UTF8_String; 
  277.        Size       : Gint; 
  278.        Flags      : Gtk_Icon_Lookup_Flags) return Gdk.Pixbuf.Gdk_Pixbuf; 
  279.    --  Looks up an icon in an icon theme, scales it to the given size and 
  280.    --  renders it into a pixbuf. This is a convenience function; if more 
  281.    --  details about the icon are needed, use Gtk.Icon_Theme.Lookup_Icon 
  282.    --  followed by Gtk.Icon_Theme.Load_Icon. 
  283.    --  Note that you probably want to listen for icon theme changes and update 
  284.    --  the icon. This is usually done by connecting to the GtkWidget::style-set 
  285.    --  signal. If for some reason you do not want to update the icon when the 
  286.    --  icon theme changes, you should consider using gdk_pixbuf_copy to make a 
  287.    --  private copy of the pixbuf returned by this function. Otherwise GTK+ may 
  288.    --  need to keep the old icon theme loaded, which would be a waste of 
  289.    --  memory. 
  290.    --  Since: gtk+ 2.4 
  291.    --  "icon_name": the name of the icon to lookup 
  292.    --  "size": the desired icon size. The resulting icon may not be exactly 
  293.    --  this size; see Gtk.Icon_Theme.Load_Icon. 
  294.    --  "flags": flags modifying the behavior of the icon lookup 
  295.  
  296.    function Load_Icon 
  297.       (Icon_Info : not null access Gtk_Icon_Info_Record) 
  298.        return Gdk.Pixbuf.Gdk_Pixbuf; 
  299.    --  Renders an icon previously looked up in an icon theme using 
  300.    --  Gtk.Icon_Theme.Lookup_Icon; the size will be based on the size passed to 
  301.    --  Gtk.Icon_Theme.Lookup_Icon. Note that the resulting pixbuf may not be 
  302.    --  exactly this size; an icon theme may have icons that differ slightly 
  303.    --  from their nominal sizes, and in addition GTK+ will avoid scaling icons 
  304.    --  that it considers sufficiently close to the requested size or for which 
  305.    --  the source image would have to be scaled up too far. (This maintains 
  306.    --  sharpness.). This behaviour can be changed by passing the 
  307.    --  Gtk.Icon_Theme.Icon_Lookup_Force_Size flag when obtaining the 
  308.    --  Gtk.Icon_Theme.Gtk_Icon_Info. If this flag has been specified, the 
  309.    --  pixbuf returned by this function will be scaled to the exact size. 
  310.    --  Since: gtk+ 2.4 
  311.  
  312.    function Lookup_By_Gicon 
  313.       (Icon_Theme : not null access Gtk_Icon_Theme_Record'Class; 
  314.        Icon       : Glib.G_Icon.G_Icon; 
  315.        Size       : Gint; 
  316.        Flags      : Gtk_Icon_Lookup_Flags) return Gtk_Icon_Info; 
  317.    --  Looks up an icon and returns a structure containing information such as 
  318.    --  the filename of the icon. The icon can then be rendered into a pixbuf 
  319.    --  using Gtk.Icon_Theme.Load_Icon. 
  320.    --  Since: gtk+ 2.14 
  321.    --  "icon": the Glib.G_Icon.G_Icon to look up 
  322.    --  "size": desired icon size 
  323.    --  "flags": flags modifying the behavior of the icon lookup 
  324.  
  325.    function Lookup_Icon 
  326.       (Icon_Theme : not null access Gtk_Icon_Theme_Record'Class; 
  327.        Icon_Name  : UTF8_String; 
  328.        Size       : Gint; 
  329.        Flags      : Gtk_Icon_Lookup_Flags) return Gtk_Icon_Info; 
  330.    --  Looks up a named icon and returns a structure containing information 
  331.    --  such as the filename of the icon. The icon can then be rendered into a 
  332.    --  pixbuf using Gtk.Icon_Theme.Load_Icon. (gtk_icon_theme_load_icon 
  333.    --  combines these two steps if all you need is the pixbuf.) 
  334.    --  Since: gtk+ 2.4 
  335.    --  "icon_name": the name of the icon to lookup 
  336.    --  "size": desired icon size 
  337.    --  "flags": flags modifying the behavior of the icon lookup 
  338.  
  339.    procedure Prepend_Search_Path 
  340.       (Icon_Theme : not null access Gtk_Icon_Theme_Record; 
  341.        Path       : UTF8_String); 
  342.    --  Prepends a directory to the search path. See 
  343.    --  Gtk.Icon_Theme.Set_Search_Path. 
  344.    --  Since: gtk+ 2.4 
  345.    --  "path": directory name to prepend to the icon path 
  346.  
  347.    function Rescan_If_Needed 
  348.       (Icon_Theme : not null access Gtk_Icon_Theme_Record) return Boolean; 
  349.    --  Checks to see if the icon theme has changed; if it has, any currently 
  350.    --  cached information is discarded and will be reloaded next time 
  351.    --  Icon_Theme is accessed. 
  352.    --  Since: gtk+ 2.4 
  353.  
  354.    procedure Set_Custom_Theme 
  355.       (Icon_Theme : not null access Gtk_Icon_Theme_Record; 
  356.        Theme_Name : UTF8_String := ""); 
  357.    --  Sets the name of the icon theme that the Gtk.Icon_Theme.Gtk_Icon_Theme 
  358.    --  object uses overriding system configuration. This function cannot be 
  359.    --  called on the icon theme objects returned from 
  360.    --  Gtk.Icon_Theme.Get_Default and Gtk.Icon_Theme.Get_For_Screen. 
  361.    --  Since: gtk+ 2.4 
  362.    --  "theme_name": name of icon theme to use instead of configured theme, or 
  363.    --  null to unset a previously set custom theme 
  364.  
  365.    procedure Set_Screen 
  366.       (Icon_Theme : not null access Gtk_Icon_Theme_Record; 
  367.        Screen     : not null access Gdk.Screen.Gdk_Screen_Record'Class); 
  368.    --  Sets the screen for an icon theme; the screen is used to track the 
  369.    --  user's currently configured icon theme, which might be different for 
  370.    --  different screens. 
  371.    --  Since: gtk+ 2.4 
  372.    --  "screen": a Gdk.Screen.Gdk_Screen 
  373.  
  374.    function Copy 
  375.       (Icon_Info : not null access Gtk_Icon_Info_Record) 
  376.        return Gtk_Icon_Info; 
  377.    pragma Obsolescent (Copy); 
  378.    --  Make a copy of a Gtk.Icon_Theme.Gtk_Icon_Info. 
  379.    --  Since: gtk+ 2.4 
  380.    --  Deprecated since 3.8, Use g_object_ref 
  381.  
  382.    procedure Free (Icon_Info : not null access Gtk_Icon_Info_Record); 
  383.    pragma Obsolescent (Free); 
  384.    --  Free a Gtk.Icon_Theme.Gtk_Icon_Info and associated information 
  385.    --  Since: gtk+ 2.4 
  386.    --  Deprecated since 3.8, Use g_object_unref 
  387.  
  388.    function Get_Attach_Points 
  389.       (Icon_Info : not null access Gtk_Icon_Info_Record) 
  390.        return Gdk.Types.Gdk_Points_Array; 
  391.    --  Fetches the set of attach points for an icon. An attach point is a 
  392.    --  location in the icon that can be used as anchor points for attaching 
  393.    --  emblems or overlays to the icon. 
  394.    --  Since: gtk+ 2.4 
  395.  
  396.    function Get_Base_Size 
  397.       (Icon_Info : not null access Gtk_Icon_Info_Record) return Gint; 
  398.    --  Gets the base size for the icon. The base size is a size for the icon 
  399.    --  that was specified by the icon theme creator. This may be different than 
  400.    --  the actual size of image; an example of this is small emblem icons that 
  401.    --  can be attached to a larger icon. These icons will be given the same 
  402.    --  base size as the larger icons to which they are attached. 
  403.    --  Since: gtk+ 2.4 
  404.  
  405.    function Get_Builtin_Pixbuf 
  406.       (Icon_Info : not null access Gtk_Icon_Info_Record) 
  407.        return Gdk.Pixbuf.Gdk_Pixbuf; 
  408.    --  Gets the built-in image for this icon, if any. To allow GTK+ to use 
  409.    --  built in icon images, you must pass the 
  410.    --  Gtk.Icon_Theme.Icon_Lookup_Use_Builtin to Gtk.Icon_Theme.Lookup_Icon. 
  411.    --  Since: gtk+ 2.4 
  412.  
  413.    function Get_Display_Name 
  414.       (Icon_Info : not null access Gtk_Icon_Info_Record) return UTF8_String; 
  415.    --  Gets the display name for an icon. A display name is a string to be 
  416.    --  used in place of the icon name in a user visible context like a list of 
  417.    --  icons. 
  418.    --  Since: gtk+ 2.4 
  419.  
  420.    procedure Get_Embedded_Rect 
  421.       (Icon_Info              : not null access Gtk_Icon_Info_Record; 
  422.        Rectangle              : out Gdk.Rectangle.Gdk_Rectangle; 
  423.        Has_Embedded_Rectangle : out Boolean); 
  424.    --  Gets the coordinates of a rectangle within the icon that can be used 
  425.    --  for display of information such as a preview of the contents of a text 
  426.    --  file. See Gtk.Icon_Theme.Set_Raw_Coordinates for further information 
  427.    --  about the coordinate system. 
  428.    --  Since: gtk+ 2.4 
  429.    --  "rectangle": Gdk.Rectangle.Gdk_Rectangle in which to store embedded 
  430.    --  rectangle coordinates; coordinates are only stored when this function 
  431.    --  returns True. 
  432.  
  433.    function Get_Filename 
  434.       (Icon_Info : not null access Gtk_Icon_Info_Record) return UTF8_String; 
  435.    --  Gets the filename for the icon. If the 
  436.    --  Gtk.Icon_Theme.Icon_Lookup_Use_Builtin flag was passed to 
  437.    --  Gtk.Icon_Theme.Lookup_Icon, there may be no filename if a builtin icon 
  438.    --  is returned; in this case, you should use 
  439.    --  Gtk.Icon_Theme.Get_Builtin_Pixbuf. 
  440.    --  Since: gtk+ 2.4 
  441.  
  442.    function Load_Symbolic 
  443.       (Icon_Info     : not null access Gtk_Icon_Info_Record; 
  444.        Fg            : Gdk.RGBA.Gdk_RGBA; 
  445.        Success_Color : Gdk.RGBA.Gdk_RGBA; 
  446.        Warning_Color : Gdk.RGBA.Gdk_RGBA; 
  447.        Error_Color   : Gdk.RGBA.Gdk_RGBA; 
  448.        Was_Symbolic  : access Boolean) return Gdk.Pixbuf.Gdk_Pixbuf; 
  449.    --  Loads an icon, modifying it to match the system colours for the 
  450.    --  foreground, success, warning and error colors provided. If the icon is 
  451.    --  not a symbolic one, the function will return the result from 
  452.    --  Gtk.Icon_Theme.Load_Icon. 
  453.    --  This allows loading symbolic icons that will match the system theme. 
  454.    --  Unless you are implementing a widget, you will want to use 
  455.    --  g_themed_icon_new_with_default_fallbacks to load the icon. 
  456.    --  As implementation details, the icon loaded needs to be of SVG type, 
  457.    --  contain the "symbolic" term as the last component of the icon name, and 
  458.    --  use the 'fg', 'success', 'warning' and 'error' CSS styles in the SVG 
  459.    --  file itself. 
  460.    --  See the <ulink 
  461.    --  url="http://www.freedesktop.org/wiki/SymbolicIcons">Symbolic Icons 
  462.    --  spec</ulink> for more information about symbolic icons. 
  463.    --  Since: gtk+ 3.0 
  464.    --  "fg": a Gdk.RGBA.Gdk_RGBA representing the foreground color of the icon 
  465.    --  "success_color": a Gdk.RGBA.Gdk_RGBA representing the warning color of 
  466.    --  the icon or null to use the default color 
  467.    --  "warning_color": a Gdk.RGBA.Gdk_RGBA representing the warning color of 
  468.    --  the icon or null to use the default color 
  469.    --  "error_color": a Gdk.RGBA.Gdk_RGBA representing the error color of the 
  470.    --  icon or null to use the default color (allow-none) 
  471.    --  "was_symbolic": a Boolean, returns whether the loaded icon was a 
  472.    --  symbolic one and whether the Fg color was applied to it. 
  473.  
  474.    function Load_Symbolic_For_Context 
  475.       (Icon_Info    : not null access Gtk_Icon_Info_Record; 
  476.        Context      : not null access Gtk.Style_Context.Gtk_Style_Context_Record'Class; 
  477.        Was_Symbolic : access Boolean) return Gdk.Pixbuf.Gdk_Pixbuf; 
  478.    --  Loads an icon, modifying it to match the system colors for the 
  479.    --  foreground, success, warning and error colors provided. If the icon is 
  480.    --  not a symbolic one, the function will return the result from 
  481.    --  Gtk.Icon_Theme.Load_Icon. This function uses the regular foreground 
  482.    --  color and the symbolic colors with the names "success_color", 
  483.    --  "warning_color" and "error_color" from the context. 
  484.    --  This allows loading symbolic icons that will match the system theme. 
  485.    --  See Gtk.Icon_Theme.Load_Symbolic for more details. 
  486.    --  Since: gtk+ 3.0 
  487.    --  "context": a Gtk.Style_Context.Gtk_Style_Context 
  488.    --  "was_symbolic": a Boolean, returns whether the loaded icon was a 
  489.    --  symbolic one and whether the Fg color was applied to it. 
  490.  
  491.    function Load_Symbolic_For_Style 
  492.       (Icon_Info    : not null access Gtk_Icon_Info_Record; 
  493.        Style        : not null access Gtk.Style.Gtk_Style_Record'Class; 
  494.        State        : Gtk.Enums.Gtk_State_Type; 
  495.        Was_Symbolic : access Boolean) return Gdk.Pixbuf.Gdk_Pixbuf; 
  496.    pragma Obsolescent (Load_Symbolic_For_Style); 
  497.    --  Loads an icon, modifying it to match the system colours for the 
  498.    --  foreground, success, warning and error colors provided. If the icon is 
  499.    --  not a symbolic one, the function will return the result from 
  500.    --  Gtk.Icon_Theme.Load_Icon. 
  501.    --  This allows loading symbolic icons that will match the system theme. 
  502.    --  See Gtk.Icon_Theme.Load_Symbolic for more details. 
  503.    --  Since: gtk+ 3.0 
  504.    --  Deprecated since 3.0, Use Gtk.Icon_Theme.Load_Symbolic_For_Context 
  505.    --  instead 
  506.    --  "style": a Gtk.Style.Gtk_Style to take the colors from 
  507.    --  "state": the widget state to use for colors 
  508.    --  "was_symbolic": a Boolean, returns whether the loaded icon was a 
  509.    --  symbolic one and whether the Fg color was applied to it. 
  510.  
  511.    procedure Set_Raw_Coordinates 
  512.       (Icon_Info       : not null access Gtk_Icon_Info_Record; 
  513.        Raw_Coordinates : Boolean); 
  514.    --  Sets whether the coordinates returned by 
  515.    --  Gtk.Icon_Theme.Get_Embedded_Rect and Gtk.Icon_Theme.Get_Attach_Points 
  516.    --  should be returned in their original form as specified in the icon 
  517.    --  theme, instead of scaled appropriately for the pixbuf returned by 
  518.    --  Gtk.Icon_Theme.Load_Icon. 
  519.    --  Raw coordinates are somewhat strange; they are specified to be with 
  520.    --  respect to the unscaled pixmap for PNG and XPM icons, but for SVG icons, 
  521.    --  they are in a 1000x1000 coordinate space that is scaled to the final 
  522.    --  size of the icon. You can determine if the icon is an SVG icon by using 
  523.    --  Gtk.Icon_Theme.Get_Filename, and seeing if it is non-null and ends in 
  524.    --  '.svg'. 
  525.    --  This function is provided primarily to allow compatibility wrappers for 
  526.    --  older API's, and is not expected to be useful for applications. 
  527.    --  Since: gtk+ 2.4 
  528.    --  "raw_coordinates": whether the coordinates of embedded rectangles and 
  529.    --  attached points should be returned in their original (unscaled) form. 
  530.  
  531.    --------------- 
  532.    -- Functions -- 
  533.    --------------- 
  534.  
  535.    procedure Add_Builtin_Icon 
  536.       (Icon_Name : UTF8_String; 
  537.        Size      : Gint; 
  538.        Pixbuf    : not null access Gdk.Pixbuf.Gdk_Pixbuf_Record'Class); 
  539.    --  Registers a built-in icon for icon theme lookups. The idea of built-in 
  540.    --  icons is to allow an application or library that uses themed icons to 
  541.    --  function requiring files to be present in the file system. For instance, 
  542.    --  the default images for all of GTK+'s stock icons are registered as 
  543.    --  built-icons. 
  544.    --  In general, if you use Gtk.Icon_Theme.Add_Builtin_Icon you should also 
  545.    --  install the icon in the icon theme, so that the icon is generally 
  546.    --  available. 
  547.    --  This function will generally be used with pixbufs loaded via 
  548.    --  gdk_pixbuf_new_from_inline. 
  549.    --  Since: gtk+ 2.4 
  550.    --  "icon_name": the name of the icon to register 
  551.    --  "size": the size at which to register the icon (different images can be 
  552.    --  registered for the same icon name at different sizes.) 
  553.    --  "pixbuf": Gdk.Pixbuf.Gdk_Pixbuf that contains the image to use for 
  554.    --  Icon_Name. 
  555.  
  556.    function Get_Default return Gtk_Icon_Theme; 
  557.    --  Gets the icon theme for the default screen. See 
  558.    --  Gtk.Icon_Theme.Get_For_Screen. 
  559.    --  Since: gtk+ 2.4 
  560.  
  561.    function Get_For_Screen 
  562.       (Screen : not null access Gdk.Screen.Gdk_Screen_Record'Class) 
  563.        return Gtk_Icon_Theme; 
  564.    --  Gets the icon theme object associated with Screen; if this function has 
  565.    --  not previously been called for the given screen, a new icon theme object 
  566.    --  will be created and associated with the screen. Icon theme objects are 
  567.    --  fairly expensive to create, so using this function is usually a better 
  568.    --  choice than calling than Gtk.Icon_Theme.Gtk_New and setting the screen 
  569.    --  yourself; by using this function a single icon theme object will be 
  570.    --  shared between users. 
  571.    --  Since: gtk+ 2.4 
  572.    --  "screen": a Gdk.Screen.Gdk_Screen 
  573.  
  574.    ------------- 
  575.    -- Signals -- 
  576.    ------------- 
  577.  
  578.    type Cb_Gtk_Icon_Theme_Void is not null access procedure (Self : access Gtk_Icon_Theme_Record'Class); 
  579.  
  580.    type Cb_GObject_Void is not null access procedure 
  581.      (Self : access Glib.Object.GObject_Record'Class); 
  582.  
  583.    Signal_Changed : constant Glib.Signal_Name := "changed"; 
  584.    procedure On_Changed 
  585.       (Self  : not null access Gtk_Icon_Theme_Record; 
  586.        Call  : Cb_Gtk_Icon_Theme_Void; 
  587.        After : Boolean := False); 
  588.    procedure On_Changed 
  589.       (Self  : not null access Gtk_Icon_Theme_Record; 
  590.        Call  : Cb_GObject_Void; 
  591.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  592.        After : Boolean := False); 
  593.    --  Emitted when the current icon theme is switched or GTK+ detects that a 
  594.    --  change has occurred in the contents of the current icon theme. 
  595.  
  596. end Gtk.Icon_Theme;