IconInfo

Description GtkIconTheme provides a facility for looking up icons by name and size. The main reason for using a name rather than simply providing a filename is to allow different icons to be used depending on what icon theme is selected by the user. The operation of icon themes on Linux and Unix follows the Icon Theme Specification. There is a default icon theme, named hicolor where applications should install their icons, but more additional application themes can be installed as operating system vendors and users choose. Named icons are similar to the Themeable Stock Images(3) facility, and the distinction between the two may be a bit confusing. A few things to keep in mind: Stock images usually are used in conjunction with Stock Items(3)., such as GTK_STOCK_OK or GTK_STOCK_OPEN. Named icons are easier to set up and therefore are more useful for new icons that an application wants to add, such as application icons or window icons. Stock images can only be loaded at the symbolic sizes defined by the GtkIconSize enumeration, or by custom sizes defined by gtk_icon_size_register(), while named icons are more flexible and any pixel size can be specified. Because stock images are closely tied to stock items, and thus to actions in the user interface, stock images may come in multiple variants for different widget states or writing directions. A good rule of thumb is that if there is a stock image for what you want to use, use it, otherwise use a named icon. It turns out that internally stock images are generally defined in terms of one or more named icons. (An example of the more than one case is icons that depend on writing direction; GTK_STOCK_GO_FORWARD uses the two themed icons "gtk-stock-go-forward-ltr" and "gtk-stock-go-forward-rtl".) In many cases, named themes are used indirectly, via GtkImage or stock items, rather than directly, but looking up icons directly is also simple. The GtkIconTheme object acts as a database of all the icons in the current theme. You can create new GtkIconTheme objects, but its much more efficient to use the standard icon theme for the GdkScreen so that the icon information is shared with other people looking up icons. In the case where the default screen is being used, looking up an icon can be as simple as:

Constructors

this
this(GtkIconInfo* gtkIconInfo)

Sets our main struct and passes it to the parent class

this
this(IconTheme iconTheme, Pixbuf pixbuf)

Creates a GtkIconInfo for a GdkPixbuf. Since 2.14

Members

Functions

addOnChanged
void addOnChanged(void delegate(IconInfo) dlg, ConnectFlags connectFlags)

Emitted when the current icon theme is switched or GTK+ detects that a change has occurred in the contents of the current icon theme.

copy
IconInfo copy()

Make a copy of a GtkIconInfo. Since 2.4

free
void free()

Free a GtkIconInfo and associated information Since 2.4

getAttachPoints
int getAttachPoints(GdkPoint[] points)

Fetches the set of attach points for an icon. An attach point is a location in the icon that can be used as anchor points for attaching emblems or overlays to the icon. Since 2.4

getBaseSize
int getBaseSize()

Gets the base size for the icon. The base size is a size for the icon that was specified by the icon theme creator. This may be different than the actual size of image; an example of this is small emblem icons that can be attached to a larger icon. These icons will be given the same base size as the larger icons to which they are attached. Since 2.4

getBuiltinPixbuf
Pixbuf getBuiltinPixbuf()

Gets the built-in image for this icon, if any. To allow GTK+ to use built in icon images, you must pass the GTK_ICON_LOOKUP_USE_BUILTIN to gtk_icon_theme_lookup_icon(). Since 2.4

getDisplayName
string getDisplayName()

Gets the display name for an icon. A display name is a string to be used in place of the icon name in a user visible context like a list of icons. Since 2.4 Signal Details The "changed" signal void user_function (GtkIconTheme *icon_theme, gpointer user_data) : Run Last Emitted when the current icon theme is switched or GTK+ detects that a change has occurred in the contents of the current icon theme.

getEmbeddedRect
int getEmbeddedRect(GdkRectangle rectangle)

Gets the coordinates of a rectangle within the icon that can be used for display of information such as a preview of the contents of a text file. See gtk_icon_info_set_raw_coordinates() for further information about the coordinate system. Since 2.4

getFilename
string getFilename()

Gets the filename for the icon. If the GTK_ICON_LOOKUP_USE_BUILTIN flag was passed to gtk_icon_theme_lookup_icon(), there may be no filename if a builtin icon is returned; in this case, you should use gtk_icon_info_get_builtin_pixbuf(). Since 2.4

getIconInfoStruct
GtkIconInfo* getIconInfoStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

loadIcon
Pixbuf loadIcon()

Renders an icon previously looked up in an icon theme using gtk_icon_theme_lookup_icon(); the size will be based on the size passed to gtk_icon_theme_lookup_icon(). Note that the resulting pixbuf may not be exactly this size; an icon theme may have icons that differ slightly from their nominal sizes, and in addition GTK+ will avoid scaling icons that it considers sufficiently close to the requested size or for which the source image would have to be scaled up too far. (This maintains sharpness.). This behaviour can be changed by passing the GTK_ICON_LOOKUP_FORCE_SIZE flag when obtaining the GtkIconInfo. If this flag has been specified, the pixbuf returned by this function will be scaled to the exact size. Since 2.4

setRawCoordinates
void setRawCoordinates(int rawCoordinates)

Sets whether the coordinates returned by gtk_icon_info_get_embedded_rect() and gtk_icon_info_get_attach_points() should be returned in their original form as specified in the icon theme, instead of scaled appropriately for the pixbuf returned by gtk_icon_info_load_icon(). Raw coordinates are somewhat strange; they are specified to be with respect to the unscaled pixmap for PNG and XPM icons, but for SVG icons, they are in a 1000x1000 coordinate space that is scaled to the final size of the icon. You can determine if the icon is an SVG icon by using gtk_icon_info_get_filename(), and seeing if it is non-NULL and ends in '.svg'. This function is provided primarily to allow compatibility wrappers for older API's, and is not expected to be useful for applications. Since 2.4

Static functions

callBackChanged
void callBackChanged(GtkIconTheme* iconThemeStruct, IconInfo _iconInfo)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

connectedSignals
int[string] connectedSignals;
gtkIconInfo
GtkIconInfo* gtkIconInfo;

the main Gtk struct

onChangedListeners
void delegate(IconInfo)[] onChangedListeners;
Undocumented in source.

Meta