| |
GTK+ Reference Manual | ||||
---|---|---|---|---|
#include <gtk/gtk.h> GtkStatusIcon* gtk_status_icon_new (void); GtkStatusIcon* gtk_status_icon_new_from_pixbuf (GdkPixbuf *pixbuf); GtkStatusIcon* gtk_status_icon_new_from_file (const gchar *filename); GtkStatusIcon* gtk_status_icon_new_from_stock (const gchar *stock_id); GtkStatusIcon* gtk_status_icon_new_from_icon_name (const gchar *icon_name); void gtk_status_icon_set_from_pixbuf (GtkStatusIcon *status_icon, GdkPixbuf *pixbuf); void gtk_status_icon_set_from_file (GtkStatusIcon *status_icon, const gchar *filename); void gtk_status_icon_set_from_stock (GtkStatusIcon *status_icon, const gchar *stock_id); void gtk_status_icon_set_from_icon_name (GtkStatusIcon *status_icon, const gchar *icon_name); GtkImageType gtk_status_icon_get_storage_type (GtkStatusIcon *status_icon); GdkPixbuf* gtk_status_icon_get_pixbuf (GtkStatusIcon *status_icon); const gchar* gtk_status_icon_get_stock (GtkStatusIcon *status_icon); const gchar* gtk_status_icon_get_icon_name (GtkStatusIcon *status_icon); gint gtk_status_icon_get_size (GtkStatusIcon *status_icon); void gtk_status_icon_set_tooltip (GtkStatusIcon *status_icon, const gchar *tooltip_text); void gtk_status_icon_set_visible (GtkStatusIcon *status_icon, gboolean visible); gboolean gtk_status_icon_get_visible (GtkStatusIcon *status_icon); void gtk_status_icon_set_blinking (GtkStatusIcon *status_icon, gboolean blinking); gboolean gtk_status_icon_get_blinking (GtkStatusIcon *status_icon); gboolean gtk_status_icon_is_embedded (GtkStatusIcon *status_icon);
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 GtkStatusIcon 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 GtkStatusIcon, 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_status_icon_is_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.
GtkStatusIcon* gtk_status_icon_new (void);
Creates an empty status icon object.
Returns : | a new GtkStatusIcon |
Since 2.10
GtkStatusIcon* gtk_status_icon_new_from_pixbuf (GdkPixbuf *pixbuf);
Creates a status icon displaying pixbuf.
The image will be scaled down to fit in the available space in the notification area, if necessary.
pixbuf : | a GdkPixbuf |
Returns : | a new GtkStatusIcon |
Since 2.10
GtkStatusIcon* gtk_status_icon_new_from_file (const gchar *filename);
Creates a status icon displaying the file filename.
The image will be scaled down to fit in the available space in the notification area, if necessary.
filename : | a filename |
Returns : | a new GtkStatusIcon |
Since 2.10
GtkStatusIcon* gtk_status_icon_new_from_stock (const gchar *stock_id);
Creates a status icon displaying a stock icon. Sample stock icon names are GTK_STOCK_OPEN, GTK_STOCK_QUIT. You can register your own stock icon names, see gtk_icon_factory_add_default() and gtk_icon_factory_add().
stock_id : | a stock icon id |
Returns : | a new GtkStatusIcon |
Since 2.10
GtkStatusIcon* gtk_status_icon_new_from_icon_name (const gchar *icon_name);
Creates a status icon displaying an icon from the current icon theme. If the current icon theme is changed, the icon will be updated appropriately.
icon_name : | an icon name |
Returns : | a new GtkStatusIcon |
Since 2.10
void gtk_status_icon_set_from_pixbuf (GtkStatusIcon *status_icon, GdkPixbuf *pixbuf);
Makes status_icon display pixbuf. See gtk_status_icon_new_from_pixbuf() for details.
status_icon : | a GtkStatusIcon |
pixbuf : | a GdkPixbuf or NULL |
Since 2.10
void gtk_status_icon_set_from_file (GtkStatusIcon *status_icon, const gchar *filename);
Makes status_icon display the file filename. See gtk_status_icon_new_from_file() for details.
status_icon : | a GtkStatusIcon |
filename : | a filename |
Since 2.10
void gtk_status_icon_set_from_stock (GtkStatusIcon *status_icon, const gchar *stock_id);
Makes status_icon display the stock icon with the id stock_id. See gtk_status_icon_new_from_stock() for details.
status_icon : | a GtkStatusIcon |
stock_id : | a stock icon id |
Since 2.10
void gtk_status_icon_set_from_icon_name (GtkStatusIcon *status_icon, const gchar *icon_name);
Makes status_icon display the icon named icon_name from the current icon theme. See gtk_status_icon_new_from_icon_name() for details.
status_icon : | a GtkStatusIcon |
icon_name : | an icon name |
Since 2.10
GtkImageType gtk_status_icon_get_storage_type (GtkStatusIcon *status_icon);
Gets the type of representation being used by the GtkStatusIcon to store image data. If the GtkStatusIcon has no image data, the return value will be GTK_IMAGE_EMPTY.
status_icon : | |
Returns : | the image representation being used |
Since 2.10
GdkPixbuf* gtk_status_icon_get_pixbuf (GtkStatusIcon *status_icon);
Gets the GdkPixbuf being displayed by the GtkStatusIcon. The storage type of the status icon must be GTK_IMAGE_EMPTY or GTK_IMAGE_PIXBUF (see gtk_status_icon_get_storage_type()). The caller of this function does not own a reference to the returned pixbuf.
status_icon : | a GtkStatusIcon |
Returns : | the displayed pixbuf, or NULL if the image is empty. |
Since 2.10
const gchar* gtk_status_icon_get_stock (GtkStatusIcon *status_icon);
Gets the id of the stock icon being displayed by the GtkStatusIcon. The storage type of the status icon must be GTK_IMAGE_EMPTY or GTK_IMAGE_STOCK (see gtk_status_icon_get_storage_type()). The returned string is owned by the GtkStatusIcon and should not be freed or modified.
status_icon : | a GtkStatusIcon |
Returns : | stock id of the displayed stock icon, or NULL if the image is empty. |
Since 2.10
const gchar* gtk_status_icon_get_icon_name (GtkStatusIcon *status_icon);
Gets the name of the icon being displayed by the GtkStatusIcon. The storage type of the status icon must be GTK_IMAGE_EMPTY or GTK_IMAGE_ICON_NAME (see gtk_status_icon_get_storage_type()). The returned string is owned by the GtkStatusIcon and should not be freed or modified.
status_icon : | a GtkStatusIcon |
Returns : | name of the displayed icon, or NULL if the image is empty. |
Since 2.10
gint gtk_status_icon_get_size (GtkStatusIcon *status_icon);
Gets the size in pixels that is available for the image. Stock icons and named icons adapt their size automatically if the size of the notification area changes. For other storage types, the size-changed signal can be used to react to size changes.
status_icon : | a GtkStatusIcon |
Returns : | the size that is available for the image |
Since 2.10
void gtk_status_icon_set_tooltip (GtkStatusIcon *status_icon, const gchar *tooltip_text);
Sets the tooltip of the status icon.
status_icon : | a GtkStatusIcon |
tooltip_text : | the tooltip text, or NULL |
Since 2.10
void gtk_status_icon_set_visible (GtkStatusIcon *status_icon, gboolean visible);
Shows or hides a status icon.
status_icon : | a GtkStatusIcon |
visible : | TRUE to show the status icon, FALSE to hide it |
Since 2.10
gboolean gtk_status_icon_get_visible (GtkStatusIcon *status_icon);
Returns wether the status icon is visible or not. Note that being visible does not guarantee that the user can actually see the icon, see also gtk_status_icon_is_embedded().
status_icon : | a GtkStatusIcon |
Returns : | TRUE if the status icon is visible |
Since 2.10
void gtk_status_icon_set_blinking (GtkStatusIcon *status_icon, gboolean blinking);
Makes the status icon start or stop blinking. Note that blinking user interface elements may be problematic for some users, and thus may be turned off, in which case this setting has no effect.
status_icon : | a GtkStatusIcon |
blinking : | TRUE to turn blinking on, FALSE to turn it off |
Since 2.10
gboolean gtk_status_icon_get_blinking (GtkStatusIcon *status_icon);
Returns whether the icon is blinking, see gtk_status_icon_set_blinking().
status_icon : | a GtkStatusIcon |
Returns : | TRUE if the icon is blinking |
Since 2.10
gboolean gtk_status_icon_is_embedded (GtkStatusIcon *status_icon);
Returns whether the status icon is embedded in a notification area.
status_icon : | a GtkStatusIcon |
Returns : | TRUE if the status icon is embedded in a notification area. |
Since 2.10
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |