Créer  Editer  FrontPage  Index  Chercher  Changements  History  RSS  Login

Gtk::StatusIcon

class Gtk::StatusIcon

The "system tray" or notification area is normally used for transient icons that indicate some special state. For example, a system tray icon might appear to tell the user that they have new mail, or have an incoming instant message, or something along those lines. The basic idea is that creating an icon in the notification area is less annoying than popping up a dialog.

A Gtk::StatusIcon object can be used to display an icon in a "system tray". The icon can have a tooltip, and the user can interact with it by activating it or popping up a context menu. Critical information should not solely be displayed in a Gtk::StatusIcon, since it may not be visible (e.g. when the user doesn't have a notification area on his panel). This can be checked with Gtk::StatusIcon#embedded?.

On X11, the implementation follows the freedesktop.org "System Tray" specification. Implementations of the "tray" side of this specification can be found e.g. in the GNOME and KDE panel applications.

Note that a Gtk::StatusIcon is not a widget, but just a GLib::Object. Making it a widget would be impractical, since the system tray on Win32 doesn't allow to embed arbitrary widgets.

Since 2.10

Class Methods

Gtk::StatusIcon.new
Creates an empty status icon object. Since 2.10

Instance Methods

file=(file)
Sets the Filename to load and display. Since 2.10
  • file: Filename to load and display
  • Returns: file
set_file(file)
Same as file=. Since 2.10
  • file: Filename to load and display
  • Returns: self
icon_name
Gets the name of the icon from the icon theme. Since 2.10
  • Returns: The name of the icon from the icon theme
icon_name=(icon_name)
Sets the name of the icon from the icon theme. Since 2.10
  • icon_name: The name of the icon from the icon theme
  • Returns: icon_name
set_icon_name(icon_name)
Same as icon_name=. Since 2.10
  • icon_name: The name of the icon from the icon theme
  • Returns: self
pixbuf
Gets the Gdk::Pixbuf to display. Since 2.10
pixbuf=(pixbuf)
Sets a Gdk::Pixbuf to display. Since 2.10
set_pixbuf(pixbuf)
Same as pixbuf=. Since 2.10
stock
Gets the Stock ID for a stock image to display. Since 2.10
  • Returns: Stock ID(Gtk::Stock constant value) for a stock image to display
stock=(stock)
Sets the Stock ID for a stock image to display. Since 2.10
  • stock: Stock ID(Gtk::Stock constant value) for a stock image to display
  • Returns: stock
set_stock(stock)
Same as stock=. Since 2.10
  • stock: Stock ID(Gtk::Stock constant value) for a stock image to display
  • Returns: self
size
Gets the size of the icon. Since 2.10
  • Returns: The size of the icon
storage_type
Gets the type of representation being used by the Gtk::StatusIcon to store image data. If the Gtk::StatusIcon has no image data, the return value will be Gtk::Image::EMPTY. Since 2.10
tooltip=(tooltip_text)
Sets the tooltip of the status icon Since 2.10
  • tooltip_text: the tooltip text, or nil.
  • Returns: tooltip_text
set_tooltip(tooltip_text)
Same as tooltip=. Since 2.10
  • tooltip_text: the tooltip text, or nil.
  • Returns: self
visible?
Gets the value whether the status icon is visible or not. Since 2.10
  • Returns: true if the status icon is visible
visible=(visible)
Sets the value whether the status icon is visible or not. Since 2.10
  • visible: true if the status icon is visible
  • Returns: visible
set_visible(visible)
Same as visible=. Since 2.10
  • visible: true if the status icon is visible
  • Returns: self
blinking?
Gets the value whether the status icon is blinking or not. Since 2.10
  • Returns: true if the status icon is blinking
blinking=(blinking)
Sets the value whether the status icon is blinking or not. Since 2.10
  • blinking: true if the status icon is blinking
  • Returns: blinking
set_blinking(blinking)
Same as blinking=. Since 2.10
  • blinking: true if the status icon is blinking
  • Returns: self
embedded?
Returns whether the status icon is embedded in a notification area. Since 2.10
  • Returns: true if the status icon is embedded in a notification area.
position_menu(menu)
Menu positioning function to use with Gtk::Menu#popup to position menu aligned to the status icon user_data. Since 2.10
  • menu: the Gtk::Menu
  • Returns: [x, y, push_in]
    • x: the x position
    • y: the y position
    • push_in: true if the menu should be pushed in to be completely inside the screen instead of just clamped to the size to the screen.
geometry

Obtains information about the location of the status icon on screen. This information can be used to e.g. position popups like notification bubbles. Since 2.10 See Gtk::StatusIcon#position_menu for a more convenient alternative for positioning menus.

Note that some platforms do not allow GTK+ to provide this information, and even on platforms that do allow it, the information is not reliable unless the status icon is embedded in a notification area, see Gtk::StatusIcon#embedded?.

  • Returns: [screen, area, orientation]
    • screen: the Gdk::Screen, or nil if the information is not needed
    • area: the area(Gdk::Rectangle) occupied by the status icon, or nil
    • orientation: the orientation(Gtk#Orientation) of the panel in which the status icon is embedded, or nil. A panel at the top or bottom of the screen is horizontal, a panel at the left or right is vertical.
activate
Emits an activate signal. Since 2.10
  • Returns: self
popup_menu(button, activate_time)
Emits an popup-menu signal Since 2.10
  • button: the button(Integer) that was pressed, or 0 if the signal is not emitted in response to a button press event
  • activate_time: the timestamp(Integer) of the event that triggered the signal emission
  • Returns: self

Properties

blinking: true or false (Read/Write)
Whether or not the status icon is blinking Since 2.10
  • Default value: false
file: String (Write)
Filename to load and display Since 2.10
  • Default value: nil
icon-name: String (Read/Write)
The name of the icon from the icon theme Since 2.10
  • Default value: nil
pixbuf: Gdk::Pixbuf (Read/Write)
A Gdk::Pixbuf to display Since 2.10
size: Integer (Read)
The size of the icon Since 2.10
  • Allowed values: >= 0
  • Default value: 0
stock: String (Read/Write)
Stock ID(Gtk::Stock constant value) for a stock image to display Since 2.10
  • Default value: nil
storage-type: Gtk::ImageType (Read)
The representation being used for image data Since 2.10
visible: true or false (Read/Write)
Whether or not the status icon is visible Since 2.10
  • Default value: true

Signals

activate: self (Run first / Action)
Gets emitted when the user activates the status icon. If and how status icons can activated is platform-dependent. Since 2.10
popup-menu: self, button , activate_time (Run first / Action)
Gets emitted when the user brings up the context menu of the status icon. Whether status icons can have context menus and how these are activated is platform-dependent. The button and activate_timeout parameters should be passed as the last to arguments to Gtk::Menu#popup. Since 2.10
  • self: the Gtk::StatusIcon
  • button: the button that was pressed, or 0 if the signal is not emitted in response to a button press event
  • activate_time: the timestamp of the event that triggered the signal emission
size-changed: self, size (Run last)
Gets emitted when the size available for the image changes, e.g. because the notification area got resized. Since 2.10
  • self: the Gtk::StatusIcon
  • size: the new size
  • Returns: true if the icon was updated for the new size. Otherwise, GTK+ will scale the icon as necessary.

ChangeLog

  • 2007-02-14 Added. - Masao?
Dernière modification:2011/06/07 21:09:54
Mots clef:
Références:[Gtk::StatusIcon]