Gtk.IconInfo¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gtk.IconInfo(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Contains information found when looking up an icon in an icon theme.
- classmethod new_for_pixbuf(icon_theme, pixbuf)[source]¶
- Parameters:
icon_theme (
Gtk.IconTheme
) – aGtk.IconTheme
pixbuf (
GdkPixbuf.Pixbuf
) – the pixbuf to wrap in aGtk.IconInfo
- Returns:
- Return type:
Creates a
Gtk.IconInfo
for aGdkPixbuf.Pixbuf
.New in version 2.14.
- get_attach_points()[source]¶
- Returns:
- Return type:
This function is deprecated and always returns
False
.New in version 2.4.
Deprecated since version 3.14: Attachment points are deprecated
- get_base_scale()[source]¶
- Returns:
the base scale
- Return type:
Gets the base scale for the icon. The base scale is a scale for the icon that was specified by the icon theme creator. For instance an icon drawn for a high-dpi screen with window scale 2 for a base size of 32 will be 64 pixels tall and have a base scale of 2.
New in version 3.10.
- get_base_size()[source]¶
- Returns:
the base size, or 0, if no base size is known for the icon.
- Return type:
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.
Note that for scaled icons the base size does not include the base scale.
New in version 2.4.
- get_builtin_pixbuf()[source]¶
- Returns:
the built-in image pixbuf, or
None
. No extra reference is added to the returned pixbuf, so if you want to keep it around, you must useGObject.Object.ref
(). The returned image must not be modified.- Return type:
Gets the built-in image for this icon, if any. To allow GTK+ to use built in icon images, you must pass the
Gtk.IconLookupFlags.USE_BUILTIN
toGtk.IconTheme.lookup_icon
().New in version 2.4.
Deprecated since version 3.14: This function is deprecated, use
Gtk.IconTheme.add_resource_path
() instead of builtin icons.
- get_display_name()[source]¶
-
This function is deprecated and always returns
None
.New in version 2.4.
Deprecated since version 3.14:
xlib.Display
names are deprecated
- get_embedded_rect()[source]¶
- Returns:
-
- rectangle:
Gdk.Rectangle
in which to store embedded rectangle coordinates; coordinates are only stored when this function returnsTrue
.
- Return type:
(
bool
, rectangle:Gdk.Rectangle
)
This function is deprecated and always returns
False
.New in version 2.4.
Deprecated since version 3.14: Embedded rectangles are deprecated
- get_filename()[source]¶
- Returns:
the filename for the icon, or
None
ifGtk.IconInfo.get_builtin_pixbuf
() should be used instead. The return value is owned by GTK+ and should not be modified or freed.- Return type:
Gets the filename for the icon. If the
Gtk.IconLookupFlags.USE_BUILTIN
flag was passed toGtk.IconTheme.lookup_icon
(), there may be no filename if a builtin icon is returned; in this case, you should useGtk.IconInfo.get_builtin_pixbuf
().New in version 2.4.
- is_symbolic()[source]¶
-
Checks if the icon is symbolic or not. This currently uses only the file name and not the file contents for determining this. This behaviour may change in the future.
New in version 3.12.
- load_icon()[source]¶
- Raises:
- Returns:
the rendered icon; this may be a newly created icon or a new reference to an internal icon, so you must not modify the icon. Use
GObject.Object.unref
() to release your reference to the icon.- Return type:
Renders an icon previously looked up in an icon theme using
Gtk.IconTheme.lookup_icon
(); the size will be based on the size passed toGtk.IconTheme.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 theGtk.IconLookupFlags.FORCE_SIZE
flag when obtaining theGtk.IconInfo
. If this flag has been specified, the pixbuf returned by this function will be scaled to the exact size.New in version 2.4.
- load_icon_async(cancellable, callback, *user_data)[source]¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfieduser_data (
object
orNone
) – the data to pass to callback function
Asynchronously load, render and scale an icon previously looked up from the icon theme using
Gtk.IconTheme.lookup_icon
().For more details, see
Gtk.IconInfo.load_icon
() which is the synchronous version of this call.New in version 3.8.
- load_icon_finish(res)[source]¶
- Parameters:
res (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
the rendered icon; this may be a newly created icon or a new reference to an internal icon, so you must not modify the icon. Use
GObject.Object.unref
() to release your reference to the icon.- Return type:
Finishes an async icon load, see
Gtk.IconInfo.load_icon_async
().New in version 3.8.
- load_surface(for_window)[source]¶
- Parameters:
for_window (
Gdk.Window
orNone
) –Gdk.Window
to optimize drawing for, orNone
- Raises:
- Returns:
the rendered icon; this may be a newly created icon or a new reference to an internal icon, so you must not modify the icon. Use cairo_surface_destroy() to release your reference to the icon.
- Return type:
Renders an icon previously looked up in an icon theme using
Gtk.IconTheme.lookup_icon
(); the size will be based on the size passed toGtk.IconTheme.lookup_icon
(). Note that the resulting surface 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 theGtk.IconLookupFlags.FORCE_SIZE
flag when obtaining theGtk.IconInfo
. If this flag has been specified, the pixbuf returned by this function will be scaled to the exact size.New in version 3.10.
- load_symbolic(fg, success_color, warning_color, error_color)[source]¶
- Parameters:
fg (
Gdk.RGBA
) – aGdk.RGBA
representing the foreground color of the iconsuccess_color (
Gdk.RGBA
orNone
) – aGdk.RGBA
representing the warning color of the icon orNone
to use the default colorwarning_color (
Gdk.RGBA
orNone
) – aGdk.RGBA
representing the warning color of the icon orNone
to use the default colorerror_color (
Gdk.RGBA
orNone
) – aGdk.RGBA
representing the error color of the icon orNone
to use the default color (allow-none)
- Raises:
- Returns:
a
GdkPixbuf.Pixbuf
representing the loaded icon- was_symbolic:
a
bool
, returns whether the loaded icon was a symbolic one and whether the fg color was applied to it.
- Return type:
(
GdkPixbuf.Pixbuf
, was_symbolic:bool
)
Loads an icon, modifying it to match the system colours for the foreground, success, warning and error colors provided. If the icon is not a symbolic one, the function will return the result from
Gtk.IconInfo.load_icon
().This allows loading symbolic icons that will match the system theme.
Unless you are implementing a widget, you will want to use
Gio.ThemedIcon.new_with_default_fallbacks
() to load the icon.As implementation details, the icon loaded needs to be of SVG type, contain the “symbolic” term as the last component of the icon name, and use the “fg”, “success”, “warning” and “error” CSS styles in the SVG file itself.
See the Symbolic Icons Specification for more information about symbolic icons.
New in version 3.0.
- load_symbolic_async(fg, success_color, warning_color, error_color, cancellable, callback, *user_data)[source]¶
- Parameters:
fg (
Gdk.RGBA
) – aGdk.RGBA
representing the foreground color of the iconsuccess_color (
Gdk.RGBA
orNone
) – aGdk.RGBA
representing the warning color of the icon orNone
to use the default colorwarning_color (
Gdk.RGBA
orNone
) – aGdk.RGBA
representing the warning color of the icon orNone
to use the default colorerror_color (
Gdk.RGBA
orNone
) – aGdk.RGBA
representing the error color of the icon orNone
to use the default color (allow-none)cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfieduser_data (
object
orNone
) – the data to pass to callback function
Asynchronously load, render and scale a symbolic icon previously looked up from the icon theme using
Gtk.IconTheme.lookup_icon
().For more details, see
Gtk.IconInfo.load_symbolic
() which is the synchronous version of this call.New in version 3.8.
- load_symbolic_finish(res)[source]¶
- Parameters:
res (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
the rendered icon; this may be a newly created icon or a new reference to an internal icon, so you must not modify the icon. Use
GObject.Object.unref
() to release your reference to the icon.- was_symbolic:
a
bool
, returns whether the loaded icon was a symbolic one and whether the fg color was applied to it.
- Return type:
(
GdkPixbuf.Pixbuf
, was_symbolic:bool
)
Finishes an async icon load, see
Gtk.IconInfo.load_symbolic_async
().New in version 3.8.
- load_symbolic_for_context(context)[source]¶
- Parameters:
context (
Gtk.StyleContext
) – aGtk.StyleContext
- Raises:
- Returns:
a
GdkPixbuf.Pixbuf
representing the loaded icon- was_symbolic:
a
bool
, returns whether the loaded icon was a symbolic one and whether the fg color was applied to it.
- Return type:
(
GdkPixbuf.Pixbuf
, was_symbolic:bool
)
Loads an icon, modifying it to match the system colors for the foreground, success, warning and error colors provided. If the icon is not a symbolic one, the function will return the result from
Gtk.IconInfo.load_icon
(). This function uses the regular foreground color and the symbolic colors with the names “success_color”, “warning_color” and “error_color” from the context.This allows loading symbolic icons that will match the system theme.
See
Gtk.IconInfo.load_symbolic
() for more details.New in version 3.0.
- load_symbolic_for_context_async(context, cancellable, callback, *user_data)[source]¶
- Parameters:
context (
Gtk.StyleContext
) – aGtk.StyleContext
cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfieduser_data (
object
orNone
) – the data to pass to callback function
Asynchronously load, render and scale a symbolic icon previously looked up from the icon theme using
Gtk.IconTheme.lookup_icon
().For more details, see
Gtk.IconInfo.load_symbolic_for_context
() which is the synchronous version of this call.New in version 3.8.
- load_symbolic_for_context_finish(res)[source]¶
- Parameters:
res (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
the rendered icon; this may be a newly created icon or a new reference to an internal icon, so you must not modify the icon. Use
GObject.Object.unref
() to release your reference to the icon.- was_symbolic:
a
bool
, returns whether the loaded icon was a symbolic one and whether the fg color was applied to it.
- Return type:
(
GdkPixbuf.Pixbuf
, was_symbolic:bool
)
Finishes an async icon load, see
Gtk.IconInfo.load_symbolic_for_context_async
().New in version 3.8.
- load_symbolic_for_style(style, state)[source]¶
- Parameters:
state (
Gtk.StateType
) – the widget state to use for colors
- Raises:
- Returns:
a
GdkPixbuf.Pixbuf
representing the loaded icon- was_symbolic:
a
bool
, returns whether the loaded icon was a symbolic one and whether the fg color was applied to it.
- Return type:
(
GdkPixbuf.Pixbuf
, was_symbolic:bool
)
Loads an icon, modifying it to match the system colours for the foreground, success, warning and error colors provided. If the icon is not a symbolic one, the function will return the result from
Gtk.IconInfo.load_icon
().This allows loading symbolic icons that will match the system theme.
See
Gtk.IconInfo.load_symbolic
() for more details.New in version 3.0.
Deprecated since version 3.0: Use
Gtk.IconInfo.load_symbolic_for_context
() instead
- set_raw_coordinates(raw_coordinates)[source]¶
- Parameters:
raw_coordinates (
bool
) – whether the coordinates of embedded rectangles and attached points should be returned in their original (unscaled) form.
Sets whether the coordinates returned by
Gtk.IconInfo.get_embedded_rect
() andGtk.IconInfo.get_attach_points
() should be returned in their original form as specified in the icon theme, instead of scaled appropriately for the pixbuf returned byGtk.IconInfo.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.IconInfo.get_filename
(), and seeing if it is non-None
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.
New in version 2.4.
Deprecated since version 3.14: Embedded rectangles and attachment points are deprecated