Criar  Editar  FrontPage  Índices  Buscar  Alterações  History  RSS  Back  Login

Gtk::IconSource Diff - Ruby-GNOME2 Project Website

  • Added parts are displayed like this.
  • Deleted parts are displayed like this.

= class Gtk::IconSource
A Gtk::IconSource contains a Gdk::Pixbuf (or image filename) that serves as the base image for one or more of the icons in a Gtk::IconSet, along with a specification for which icons in the icon set will be based on that pixbuf or image file. An icon set contains a set of icons that represent "the same" logical concept in different states, different global text directions, and different sizes.

So for example a web browser's "Back to Previous Page" icon might point in a different direction in Hebrew and in English; it might look different when insensitive; and it might change size depending on toolbar mode (small/large icons). So a single icon set would contain all those variants of the icon. Gtk::IconSet contains a list of Gtk::IconSource from which it can derive specific icon variants in the set.

In the simplest case, Gtk::IconSet contains one source pixbuf from which it derives all variants. The convenience method Gtk::IconSet.new handles this case; if you only have one source pixbuf, just use that method.

If you want to use a different base pixbuf for different icon variants, you create multiple icon sources, mark which variants they'll be used to create, and add them to the icon set with Gtk::IconSet#add_source.

By default, the icon source has all parameters wildcarded. That is, the icon source will be used as the base icon for any desired text direction, widget state, or icon size.

== Object Hierarchy
* Object
  * GLib::Boxed
    * Gtk::IconSource

== Class Methods
--- Gtk::IconSource.new
    Creates a new Gtk::IconSource.
    * Returns: a new Gtk::IconSource

== Instance Methods
--- direction
    Obtains the text direction this icon source applies to. The return value is only useful/meaningful if the text direction is not wildcarded.
    * Returns: text direction this source matches
--- direction=(direction)
    Sets the text direction this icon source is intended to be used with.
    Setting the text direction on an icon source makes no difference if the text direction is wildcarded. Therefore, you should usually call Gtk::IconSource#direction_wildcarded= to un-wildcard it in addition to calling this method.
    * direction: text direction(((<GtkTextDirection|Gtk::Widget#GtkTextDirection>))) this source applies to
    * Returns: direction
--- set_direction(direction)
    Same as Gtk::IconSource#direction=.
    * direction: text direction(((<GtkTextDirection|Gtk::Widget#GtkTextDirection>))) this source applies to
    * Returns: self

--- direction_wildcarded?
    Gets the value set by Gtk::IconSource#direction_wildcarded=.
    * Returns: true if this icon source is a base for any text direction variant
--- direction_wildcarded=(setting)
    If the text direction is wildcarded, this source can be used as the base image for an icon in any Gtk::TextDirection. If the text direction is not wildcarded, then the text direction the icon source applies to should be set with Gtk::IconSource#direction=, and the icon source will only be used with that text direction.
    Gtk::IconSet prefers non-wildcarded sources (exact matches) over wildcarded sources, and will use an exact match when possible.
    * setting: true to wildcard the text direction
    * Returns: setting
--- set_direction_wildcarded(setting)
    Same as Gtk::IconSource#direction_wildcarded=.
    * setting: true to wildcard the text direction
    * Returns: self

--- filename
    Retrieves the source filename, or nil if none is set. The filename is not a copy, and should not be modified or expected to persist beyond the lifetime of the icon source.
    * Returns : image filename or nil
--- filename=(filename)
    Sets the name of an image file to use as a base image when creating icon variants for Gtk::IconSet. The filename must be absolute.
    * filename: image file to use
    * Returns: filename
--- set_filename(filename)
    Same as Gtk::IconSource#filename=.
    * filename: image file to use
    * Returns: self

--- pixbuf
    Retrieves the source pixbuf, or nil if none is set. The reference count on the pixbuf is not incremented.
    * Returns : source pixbuf
--- pixbuf=(pixbuf)
    Sets a pixbuf to use as a base image when creating icon variants for Gtk::IconSet. If an icon source has both a filename and a pixbuf set, the pixbuf will take priority.
    * pixbuf: Gdk::Pixbuf to use as a source
    * Returns: pixbuf

--- set_pixbuf(pixbuf)
    Same as Gtk::IconSource#pixbuf=.
    * pixbuf: Gdk::Pixbuf to use as a source
    * Returns: self

--- size
    Obtains the icon size this source applies to. The return value is only useful/meaningful if the icon size is not wildcarded.
    * Returns: icon size(((<GtkIconSize|Gtk::IconSize#GtkIconSize>))) this source matches.
--- size=(size)
    Sets the icon size this icon source is intended to be used with.
    Setting the icon size on an icon source makes no difference if the size is wildcarded. Therefore, you should usually call Gtk::IconSource#size_wildcarded= to un-wildcard it in addition to calling this function.
    * size: icon size(((<GtkIconSize|Gtk::IconSize#GtkIconSize>))) this source applies to.
    * Returns: size
--- set_size(size)
    Same as Gtk::IconSource#size=.
    * size: icon size(((<GtkIconSize|Gtk::IconSize#GtkIconSize>))) this source applies to.
    * Returns: self

--- size_wildcarded?
    Gets the value set by Gtk::IconSource#size_wildcarded=.
    * Returns: true if this icon source is a base for any icon size variant
--- size_wildcarded=(setting)
    If the icon size is wildcarded, this source can be used as the base image for an icon of any size. If the size is not wildcarded, then the size the source applies to should be set with Gtk::IconSource#size= and the icon source will only be used with that specific size.
    Gtk::IconSet prefers non-wildcarded sources (exact matches) over wildcarded sources, and will use an exact match when possible.
    Gtk::IconSet will normally scale wildcarded source images to produce an appropriate icon at a given size, but will not change the size of source images that match exactly.
    * setting: true to wildcard the widget state
    * Returns: setting
--- set_size_wildcarded(setting)
    Same as Gtk::IconSource#size_wildcarded=.
    * setting: true to wildcard the widget state
    * Returns: self
    
--- state
    Obtains the widget state this icon source applies to. The return value is only useful/meaningful if the widget state is not wildcarded.
    * Returns: widget state this source matches(((<GtkStateType|Gtk#GtkStateType>)))
--- state=(state)
    Sets the widget state this icon source is intended to be used with.
    Setting the widget state on an icon source makes no difference if the state is wildcarded. Therefore, you should usually call Gtk::IconSource#state_wildcarded= to un-wildcard it in addition to calling this function.
    * state: widget state(((<GtkStateType|Gtk#GtkStateType>))) this source applies to
    * Returns: state
--- set_state(state)
    Same as Gtk::IconSource#state=.
    * state: widget state(((<GtkStateType|Gtk#GtkStateType>))) this source applies to
    * Returns: self

--- state_wildcarded?
    Gets the value set by Gtk::IconSource#state_wildcarded=.
    * Returns: true if this icon source is a base for any widget state variant
--- state_wildcarded=(setting)
    If the widget state is wildcarded, this source can be used as the base image for an icon in any ((<GtkStateType|Gtk#GtkStateType>)). If the widget state is not wildcarded, then the state the source applies to should be set with Gtk::IconSource#state= and the icon source will only be used with that specific state.
    Gtk::IconSet prefers non-wildcarded sources (exact matches) over wildcarded sources, and will use an exact match when possible.
    Gtk::IconSet will normally transform wildcarded source images to produce an appropriate icon for a given state, for example lightening an image on prelight, but will not modify source images that match exactly.
    * setting: true to wildcard the widget state
    * Returns: setting
--- set_state_wildcarded(setting)
    Same as Gtk::IconSource#state_wildcarder=.
    * setting: true to wildcard the widget state
    * Returns: self

== See Also
Gtk::IconFactory, Gtk::IconSet, Gtk::IconSize


- ((<Masao>))