gtkmm 3.24.7
Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gtk::StatusIcon Class Reference

The "system tray" or notification area is normally used for transient icons that indicate some special state. More...

#include <gtkmm/statusicon.h>

Inherits Glib::Object.

Public Member Functions

 StatusIcon (StatusIcon && src) noexcept
 
StatusIconoperator= (StatusIcon && src) noexcept
 
 ~StatusIcon () noexcept override
 
GtkStatusIcon * gobj ()
 Provides access to the underlying C GObject. More...
 
const GtkStatusIcon * gobj () const
 Provides access to the underlying C GObject. More...
 
GtkStatusIcon * gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
 
void set (const Glib::RefPtr< Gdk::Pixbuf > & pixbuf)
 Makes status_icon display pixbuf. More...
 
void set_from_file (const Glib::ustring & filename)
 Makes status_icon display the file filename. More...
 
void set (const StockID & stock_id)
 Makes status_icon display the stock icon with the id stock_id. More...
 
void set (const Glib::ustring & icon_name)
 Makes status_icon display the icon named icon_name from the current icon theme. More...
 
void set (const Glib::RefPtr< const Gio::Icon > & icon)
 Makes status_icon display the Gio::Icon. More...
 
ImageType get_storage_type () const
 Gets the type of representation being used by the Gtk::StatusIcon to store image data. More...
 
Glib::RefPtr< Gdk::Pixbufget_pixbuf ()
 Gets the Gdk::Pixbuf being displayed by the Gtk::StatusIcon. More...
 
Glib::RefPtr< const Gdk::Pixbufget_pixbuf () const
 Gets the Gdk::Pixbuf being displayed by the Gtk::StatusIcon. More...
 
StockID get_stock () const
 Gets the id of the stock icon being displayed by the Gtk::StatusIcon. More...
 
Glib::ustring get_icon_name () const
 Gets the name of the icon being displayed by the Gtk::StatusIcon. More...
 
Glib::RefPtr< Gio::Icon > get_icon ()
 Retrieves the Gio::Icon being displayed by the Gtk::StatusIcon. More...
 
Glib::RefPtr< const Gio::Icon > get_icon () const
 Retrieves the Gio::Icon being displayed by the Gtk::StatusIcon. More...
 
int get_size () const
 Gets the size in pixels that is available for the image. More...
 
void set_screen (const Glib::RefPtr< Gdk::Screen > & screen)
 Sets the Gdk::Screen where status_icon is displayed; if the icon is already mapped, it will be unmapped, and then remapped on the new screen. More...
 
Glib::RefPtr< Gdk::Screenget_screen ()
 Returns the Gdk::Screen associated with status_icon. More...
 
Glib::RefPtr< const Gdk::Screenget_screen () const
 Returns the Gdk::Screen associated with status_icon. More...
 
void set_visible (bool visible=true)
 Shows or hides a status icon. More...
 
bool get_visible () const
 Returns whether the status icon is visible or not. More...
 
bool is_embedded () const
 Returns whether the status icon is embedded in a notification area. More...
 
void popup_menu_at_position (Menu & menu, guint button, guint32 activate_time)
 Displays a menu aligned to the status icon, and makes it available for selection. More...
 
bool get_geometry (Glib::RefPtr< Gdk::Screen > & screen, Gdk::Rectangle & area, Orientation & orientation)
 Obtains information about the location of the status icon on screen. More...
 
bool get_has_tooltip () const
 Returns the current value of the has-tooltip property. More...
 
void set_has_tooltip (bool has_tooltip=true)
 Sets the has-tooltip property on status_icon to has_tooltip. More...
 
Glib::ustring get_tooltip_text () const
 Gets the contents of the tooltip for status_icon. More...
 
void set_tooltip_text (const Glib::ustring & text)
 Sets text as the contents of the tooltip. More...
 
Glib::ustring get_tooltip_markup () const
 Gets the contents of the tooltip for status_icon. More...
 
void set_tooltip_markup (const Glib::ustring & markup)
 Sets markup as the contents of the tooltip, which is marked up with the [Pango text markup language][PangoMarkupFormat]. More...
 
void set_title (const Glib::ustring & title)
 Sets the title of this tray icon. More...
 
Glib::ustring get_title () const
 Gets the title of this tray icon. More...
 
void set_name (const Glib::ustring & name)
 Sets the name of this tray icon. More...
 
guint32 get_x11_window_id () const
 This function is only useful on the X11/freedesktop.org platform. More...
 
Glib::PropertyProxy< Glib::RefPtr< Gdk::Pixbuf > > property_pixbuf ()
 A GdkPixbuf to display. More...
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gdk::Pixbuf > > property_pixbuf () const
 A GdkPixbuf to display. More...
 
Glib::PropertyProxy_WriteOnly< std::stringproperty_file ()
 Filename to load and display. More...
 
Glib::PropertyProxy< StockIDproperty_stock ()
 Stock ID for a stock image to display. More...
 
Glib::PropertyProxy_ReadOnly< StockIDproperty_stock () const
 Stock ID for a stock image to display. More...
 
Glib::PropertyProxy< Glib::ustring > property_icon_name ()
 The name of the icon from the icon theme. More...
 
Glib::PropertyProxy_ReadOnly< Glib::ustring > property_icon_name () const
 The name of the icon from the icon theme. More...
 
Glib::PropertyProxy< Glib::RefPtr< Gio::Icon > > property_gicon ()
 The Gio::Icon displayed in the Gtk::StatusIcon. More...
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::Icon > > property_gicon () const
 The Gio::Icon displayed in the Gtk::StatusIcon. More...
 
Glib::PropertyProxy_ReadOnly< ImageTypeproperty_storage_type () const
 The representation being used for image data. More...
 
Glib::PropertyProxy_ReadOnly< int > property_size () const
 The size of the icon. More...
 
Glib::PropertyProxy< Glib::RefPtr< Gdk::Screen > > property_screen ()
 The screen where this status icon will be displayed. More...
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gdk::Screen > > property_screen () const
 The screen where this status icon will be displayed. More...
 
Glib::PropertyProxy< bool > property_visible ()
 Whether the status icon is visible. More...
 
Glib::PropertyProxy_ReadOnly< bool > property_visible () const
 Whether the status icon is visible. More...
 
Glib::PropertyProxy_ReadOnly< bool > property_embedded () const
 true if the statusicon is embedded in a notification area. More...
 
Glib::PropertyProxy_ReadOnly< Orientationproperty_orientation () const
 The orientation of the tray in which the statusicon is embedded. More...
 
Glib::PropertyProxy< bool > property_has_tooltip ()
 Enables or disables the emission of Gtk::StatusIcon::signal_query_tooltip() on status_icon. More...
 
Glib::PropertyProxy_ReadOnly< bool > property_has_tooltip () const
 Enables or disables the emission of Gtk::StatusIcon::signal_query_tooltip() on status_icon. More...
 
Glib::PropertyProxy< Glib::ustring > property_tooltip_text ()
 Sets the text of tooltip to be the given string. More...
 
Glib::PropertyProxy_ReadOnly< Glib::ustring > property_tooltip_text () const
 Sets the text of tooltip to be the given string. More...
 
Glib::PropertyProxy< Glib::ustring > property_tooltip_markup ()
 Sets the text of tooltip to be the given string, which is marked up with the [Pango text markup language][PangoMarkupFormat]. More...
 
Glib::PropertyProxy_ReadOnly< Glib::ustring > property_tooltip_markup () const
 Sets the text of tooltip to be the given string, which is marked up with the [Pango text markup language][PangoMarkupFormat]. More...
 
Glib::PropertyProxy< Glib::ustring > property_title ()
 The title of this tray icon. More...
 
Glib::PropertyProxy_ReadOnly< Glib::ustring > property_title () const
 The title of this tray icon. More...
 
Glib::SignalProxy< bool, int > signal_size_changed ()
 
Glib::SignalProxy< void > signal_activate ()
 
Glib::SignalProxy< void, guint, guint32 > signal_popup_menu ()
 
Glib::SignalProxy< bool, GdkEventButton * > signal_button_press_event ()
 
Glib::SignalProxy< bool, GdkEventButton * > signal_button_release_event ()
 
Glib::SignalProxy< bool, GdkEventScroll * > signal_scroll_event ()
 
Glib::SignalProxy< bool, int, int, bool, const Glib::RefPtr< Tooltip > & > signal_query_tooltip ()
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...
 
static Glib::RefPtr< StatusIconcreate (const Glib::RefPtr< Gdk::Pixbuf > & pixbuf)
 Creates a new Gtk::StatusIcon object. More...
 
static Glib::RefPtr< StatusIconcreate (const StockID & stock_id)
 
static Glib::RefPtr< StatusIconcreate (const Glib::ustring & icon_name)
 
static Glib::RefPtr< StatusIconcreate_from_file (const std::string & filename)
 Creates a status icon displaying the file filename. More...
 

Protected Member Functions

 StatusIcon ()
 
 StatusIcon (const Glib::RefPtr< Gdk::Pixbuf > & pixbuf)
 
 StatusIcon (const StockID & stock)
 
 StatusIcon (const Glib::ustring & icon_name)
 
 StatusIcon (const Glib::RefPtr< const Gio::Icon > & icon)
 
virtual bool on_size_changed (int size)
 This is a default handler for the signal signal_size_changed(). More...
 
virtual void on_activate ()
 This is a default handler for the signal signal_activate(). More...
 
virtual void on_popup_menu (guint button, guint32 activate_time)
 This is a default handler for the signal signal_popup_menu(). More...
 
virtual bool on_button_press_event (GdkEventButton * event)
 This is a default handler for the signal signal_button_press_event(). More...
 
virtual bool on_button_release_event (GdkEventButton * event)
 This is a default handler for the signal signal_button_release_event(). More...
 
virtual bool on_scroll_event (GdkEventScroll * event)
 This is a default handler for the signal signal_scroll_event(). More...
 
virtual bool on_query_tooltip (int x, int y, bool keyboard_mode, const Glib::RefPtr< Tooltip > & tooltip)
 This is a default handler for the signal signal_query_tooltip(). More...
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gtk::StatusIconwrap (GtkStatusIcon * object, bool take_copy=false)
 A Glib::wrap() method for this object. More...
 

Detailed Description

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 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 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 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.

Note that a 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 gtkmm 2.10:
Deprecated:
You should consider using notifications or more modern platform-specific APIs instead.

Constructor & Destructor Documentation

◆ StatusIcon() [1/6]

Gtk::StatusIcon::StatusIcon ( StatusIcon &&  src)
noexcept

◆ ~StatusIcon()

Gtk::StatusIcon::~StatusIcon ( )
overridenoexcept

◆ StatusIcon() [2/6]

Gtk::StatusIcon::StatusIcon ( )
protected

◆ StatusIcon() [3/6]

Gtk::StatusIcon::StatusIcon ( const Glib::RefPtr< Gdk::Pixbuf > &  pixbuf)
explicitprotected

◆ StatusIcon() [4/6]

Gtk::StatusIcon::StatusIcon ( const StockID stock)
explicitprotected
Deprecated:
Use the constructor with the icon_name parameter instead.

◆ StatusIcon() [5/6]

Gtk::StatusIcon::StatusIcon ( const Glib::ustring &  icon_name)
explicitprotected

◆ StatusIcon() [6/6]

Gtk::StatusIcon::StatusIcon ( const Glib::RefPtr< const Gio::Icon > &  icon)
explicitprotected

Member Function Documentation

◆ create() [1/3]

static Glib::RefPtr< StatusIcon > Gtk::StatusIcon::create ( const Glib::RefPtr< Gdk::Pixbuf > &  pixbuf)
static

Creates a new Gtk::StatusIcon object.

Returns
A Glib::RefPtr<> to a newly created Gtk::StatusIcon object.

◆ create() [2/3]

static Glib::RefPtr< StatusIcon > Gtk::StatusIcon::create ( const Glib::ustring &  icon_name)
static

◆ create() [3/3]

static Glib::RefPtr< StatusIcon > Gtk::StatusIcon::create ( const StockID stock_id)
static
Deprecated:
Use create() with the icon_name parameter instead.

◆ create_from_file()

static Glib::RefPtr< StatusIcon > Gtk::StatusIcon::create_from_file ( const std::string filename)
static

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.

Parameters
filenameA filename.
Returns
A new StatusIcon
Since gtkmm 2.10:

◆ get_geometry()

bool Gtk::StatusIcon::get_geometry ( Glib::RefPtr< Gdk::Screen > &  screen,
Gdk::Rectangle area,
Orientation orientation 
)

Obtains information about the location of the status icon on screen.

This information can be used to e.g. position popups like notification bubbles. See popup_menu_at_position() for a more convenient alternative for positioning menus.

Note that some platforms do not allow GTK+ to provide this information.

Parameters
screenThe screen.
areaThe area occupied by the status icon.
orientationThe orientation of the panel in which the status icon is embedded. A panel at the top or bottom of the screen is horizontal, a panel at the left or right is vertical.
Returns
true if the location information has been filled in.
Since gtkmm 2.10:

◆ get_has_tooltip()

bool Gtk::StatusIcon::get_has_tooltip ( ) const

Returns the current value of the has-tooltip property.

See Gtk::StatusIcon::property_has_tooltip() for more information.

Since gtkmm 2.16:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; there is no direct replacement for this function

Returns
Current value of has-tooltip on status_icon.

◆ get_icon() [1/2]

Glib::RefPtr< Gio::Icon > Gtk::StatusIcon::get_icon ( )

Retrieves the Gio::Icon being displayed by the Gtk::StatusIcon.

The storage type of the status icon must be Gtk::IMAGE_EMPTY or Gtk::IMAGE_GICON (see get_storage_type()). The caller of this function does not own a reference to the returned Gio::Icon.

If this function fails, icon is left unchanged;

Since gtkmm 2.14:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; there is no direct replacement for this function

Returns
The displayed icon, or nullptr if the image is empty.

◆ get_icon() [2/2]

Glib::RefPtr< const Gio::Icon > Gtk::StatusIcon::get_icon ( ) const

Retrieves the Gio::Icon being displayed by the Gtk::StatusIcon.

The storage type of the status icon must be Gtk::IMAGE_EMPTY or Gtk::IMAGE_GICON (see get_storage_type()). The caller of this function does not own a reference to the returned Gio::Icon.

If this function fails, icon is left unchanged;

Since gtkmm 2.14:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; there is no direct replacement for this function

Returns
The displayed icon, or nullptr if the image is empty.

◆ get_icon_name()

Glib::ustring Gtk::StatusIcon::get_icon_name ( ) const

Gets the name of the icon being displayed by the Gtk::StatusIcon.

The storage type of the status icon must be Gtk::IMAGE_EMPTY or Gtk::IMAGE_ICON_NAME (see get_storage_type()). The returned string is owned by the Gtk::StatusIcon and should not be freed or modified.

Since gtkmm 2.10:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; there is no direct replacement for this function

Returns
Name of the displayed icon, or nullptr if the image is empty.

◆ get_pixbuf() [1/2]

Glib::RefPtr< Gdk::Pixbuf > Gtk::StatusIcon::get_pixbuf ( )

Gets the Gdk::Pixbuf being displayed by the Gtk::StatusIcon.

The storage type of the status icon must be Gtk::IMAGE_EMPTY or Gtk::IMAGE_PIXBUF (see get_storage_type()). The caller of this function does not own a reference to the returned pixbuf.

Since gtkmm 2.10:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; there is no direct replacement for this function

Returns
The displayed pixbuf, or nullptr if the image is empty.

◆ get_pixbuf() [2/2]

Glib::RefPtr< const Gdk::Pixbuf > Gtk::StatusIcon::get_pixbuf ( ) const

Gets the Gdk::Pixbuf being displayed by the Gtk::StatusIcon.

The storage type of the status icon must be Gtk::IMAGE_EMPTY or Gtk::IMAGE_PIXBUF (see get_storage_type()). The caller of this function does not own a reference to the returned pixbuf.

Since gtkmm 2.10:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; there is no direct replacement for this function

Returns
The displayed pixbuf, or nullptr if the image is empty.

◆ get_screen() [1/2]

Glib::RefPtr< Gdk::Screen > Gtk::StatusIcon::get_screen ( )

Returns the Gdk::Screen associated with status_icon.

Since gtkmm 2.12:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; there is no direct replacement for this function, as notifications are managed by the platform

Returns
A Gdk::Screen.

◆ get_screen() [2/2]

Glib::RefPtr< const Gdk::Screen > Gtk::StatusIcon::get_screen ( ) const

Returns the Gdk::Screen associated with status_icon.

Since gtkmm 2.12:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; there is no direct replacement for this function, as notifications are managed by the platform

Returns
A Gdk::Screen.

◆ get_size()

int Gtk::StatusIcon::get_size ( ) const

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.

Note that the returned size is only meaningful while the status icon is embedded (see is_embedded()).

Since gtkmm 2.10:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; there is no direct replacement for this function, as the representation of a notification is left to the platform

Returns
The size that is available for the image.

◆ get_stock()

StockID Gtk::StatusIcon::get_stock ( ) const

Gets the id of the stock icon being displayed by the Gtk::StatusIcon.

The storage type of the status icon must be Gtk::IMAGE_EMPTY or Gtk::IMAGE_STOCK (see get_storage_type()). The returned string is owned by the Gtk::StatusIcon and should not be freed or modified.

Since gtkmm 2.10:

Deprecated: 3.10: Use get_icon_name() instead.

Deprecated:
Use the get_icon_name() instead.
Returns
Stock id of the displayed stock icon, or nullptr if the image is empty.

◆ get_storage_type()

ImageType Gtk::StatusIcon::get_storage_type ( ) const

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 gtkmm 2.10:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; there is no direct replacement for this function, and Notification only supports Gio::Icon instances

Returns
The image representation being used.

◆ get_title()

Glib::ustring Gtk::StatusIcon::get_title ( ) const

Gets the title of this tray icon.

See set_title().

Since gtkmm 2.18:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; there is no direct replacement for this function

Returns
The title of the status icon.

◆ get_tooltip_markup()

Glib::ustring Gtk::StatusIcon::get_tooltip_markup ( ) const

Gets the contents of the tooltip for status_icon.

Since gtkmm 2.16:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; there is no direct replacement for this function

Returns
The tooltip text, or nullptr.

◆ get_tooltip_text()

Glib::ustring Gtk::StatusIcon::get_tooltip_text ( ) const

Gets the contents of the tooltip for status_icon.

Since gtkmm 2.16:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; there is no direct replacement for this function

Returns
The tooltip text, or nullptr.

◆ get_type()

static GType Gtk::StatusIcon::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

◆ get_visible()

bool Gtk::StatusIcon::get_visible ( ) const

Returns whether the status icon is visible or not.

Note that being visible does not guarantee that the user can actually see the icon, see also is_embedded().

Since gtkmm 2.10:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; there is no direct replacement for this function

Returns
true if the status icon is visible.

◆ get_x11_window_id()

guint32 Gtk::StatusIcon::get_x11_window_id ( ) const

This function is only useful on the X11/freedesktop.org platform.

It returns a window ID for the widget in the underlying status icon implementation. This is useful for the Galago notification service, which can send a window ID in the protocol in order for the server to position notification windows pointing to a status icon reliably.

This function is not intended for other use cases which are more likely to be met by one of the non-X11 specific methods, such as position_menu().

Since gtkmm 2.14:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; there is no direct replacement for this function

Returns
An 32 bit unsigned integer identifier for the underlying X11 Window.

◆ gobj() [1/2]

GtkStatusIcon * Gtk::StatusIcon::gobj ( )
inline

Provides access to the underlying C GObject.

◆ gobj() [2/2]

const GtkStatusIcon * Gtk::StatusIcon::gobj ( ) const
inline

Provides access to the underlying C GObject.

◆ gobj_copy()

GtkStatusIcon * Gtk::StatusIcon::gobj_copy ( )

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

◆ is_embedded()

bool Gtk::StatusIcon::is_embedded ( ) const

Returns whether the status icon is embedded in a notification area.

Since gtkmm 2.10:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; there is no direct replacement for this function

Returns
true if the status icon is embedded in a notification area.

◆ on_activate()

virtual void Gtk::StatusIcon::on_activate ( )
protectedvirtual

This is a default handler for the signal signal_activate().

◆ on_button_press_event()

virtual bool Gtk::StatusIcon::on_button_press_event ( GdkEventButton *  event)
protectedvirtual

This is a default handler for the signal signal_button_press_event().

◆ on_button_release_event()

virtual bool Gtk::StatusIcon::on_button_release_event ( GdkEventButton *  event)
protectedvirtual

This is a default handler for the signal signal_button_release_event().

◆ on_popup_menu()

virtual void Gtk::StatusIcon::on_popup_menu ( guint  button,
guint32  activate_time 
)
protectedvirtual

This is a default handler for the signal signal_popup_menu().

◆ on_query_tooltip()

virtual bool Gtk::StatusIcon::on_query_tooltip ( int  x,
int  y,
bool  keyboard_mode,
const Glib::RefPtr< Tooltip > &  tooltip 
)
protectedvirtual

This is a default handler for the signal signal_query_tooltip().

◆ on_scroll_event()

virtual bool Gtk::StatusIcon::on_scroll_event ( GdkEventScroll *  event)
protectedvirtual

This is a default handler for the signal signal_scroll_event().

◆ on_size_changed()

virtual bool Gtk::StatusIcon::on_size_changed ( int  size)
protectedvirtual

This is a default handler for the signal signal_size_changed().

◆ operator=()

StatusIcon & Gtk::StatusIcon::operator= ( StatusIcon &&  src)
noexcept

◆ popup_menu_at_position()

void Gtk::StatusIcon::popup_menu_at_position ( Menu menu,
guint  button,
guint32  activate_time 
)

Displays a menu aligned to the status icon, and makes it available for selection.

Applications can use this function to display context-sensitive menus.

This is equivalent to the gtk_status_icon_position_menu() helper callback in GTK+, which can be provided to gtk_menu_popup().

See Gtk::Menu::popup() for more details.

Parameters
menuThe menu to popup for the status icon.
buttonThe mouse button which was pressed to initiate the event.
activate_timeThe time at which the activation event occurred.
Since gtkmm 2.12:

◆ property_embedded()

Glib::PropertyProxy_ReadOnly< bool > Gtk::StatusIcon::property_embedded ( ) const

true if the statusicon is embedded in a notification area.

Since gtkmm 2.12:

Default value: false

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_file()

Glib::PropertyProxy_WriteOnly< std::string > Gtk::StatusIcon::property_file ( )

Filename to load and display.

Default value: ""

Returns
A PropertyProxy_WriteOnly that allows you to set the value of the property, or receive notification when the value of the property changes.

◆ property_gicon() [1/2]

Glib::PropertyProxy< Glib::RefPtr< Gio::Icon > > Gtk::StatusIcon::property_gicon ( )

The Gio::Icon displayed in the Gtk::StatusIcon.

For themed icons, the image will be updated automatically if the theme changes.

Since gtkmm 2.14:
Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_gicon() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::Icon > > Gtk::StatusIcon::property_gicon ( ) const

The Gio::Icon displayed in the Gtk::StatusIcon.

For themed icons, the image will be updated automatically if the theme changes.

Since gtkmm 2.14:
Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_has_tooltip() [1/2]

Glib::PropertyProxy< bool > Gtk::StatusIcon::property_has_tooltip ( )

Enables or disables the emission of Gtk::StatusIcon::signal_query_tooltip() on status_icon.

A value of true indicates that status_icon can have a tooltip, in this case the status icon will be queried using Gtk::StatusIcon::signal_query_tooltip() to determine whether it will provide a tooltip or not.

Note that setting this property to true for the first time will change the event masks of the windows of this status icon to include leave-notify and motion-notify events. This will not be undone when the property is set to false again.

Whether this property is respected is platform dependent. For plain text tooltips, use Gtk::StatusIcon::property_tooltip_text() in preference.

Since gtkmm 2.16:

Default value: false

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_has_tooltip() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::StatusIcon::property_has_tooltip ( ) const

Enables or disables the emission of Gtk::StatusIcon::signal_query_tooltip() on status_icon.

A value of true indicates that status_icon can have a tooltip, in this case the status icon will be queried using Gtk::StatusIcon::signal_query_tooltip() to determine whether it will provide a tooltip or not.

Note that setting this property to true for the first time will change the event masks of the windows of this status icon to include leave-notify and motion-notify events. This will not be undone when the property is set to false again.

Whether this property is respected is platform dependent. For plain text tooltips, use Gtk::StatusIcon::property_tooltip_text() in preference.

Since gtkmm 2.16:

Default value: false

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_icon_name() [1/2]

Glib::PropertyProxy< Glib::ustring > Gtk::StatusIcon::property_icon_name ( )

The name of the icon from the icon theme.

Default value: ""

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_icon_name() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::StatusIcon::property_icon_name ( ) const

The name of the icon from the icon theme.

Default value: ""

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_orientation()

Glib::PropertyProxy_ReadOnly< Orientation > Gtk::StatusIcon::property_orientation ( ) const

The orientation of the tray in which the statusicon is embedded.

Since gtkmm 2.12:

Default value: Gtk::ORIENTATION_HORIZONTAL

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_pixbuf() [1/2]

Glib::PropertyProxy< Glib::RefPtr< Gdk::Pixbuf > > Gtk::StatusIcon::property_pixbuf ( )

A GdkPixbuf to display.

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_pixbuf() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gdk::Pixbuf > > Gtk::StatusIcon::property_pixbuf ( ) const

A GdkPixbuf to display.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_screen() [1/2]

Glib::PropertyProxy< Glib::RefPtr< Gdk::Screen > > Gtk::StatusIcon::property_screen ( )

The screen where this status icon will be displayed.

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_screen() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gdk::Screen > > Gtk::StatusIcon::property_screen ( ) const

The screen where this status icon will be displayed.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_size()

Glib::PropertyProxy_ReadOnly< int > Gtk::StatusIcon::property_size ( ) const

The size of the icon.

Default value: 0

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_stock() [1/2]

Glib::PropertyProxy< StockID > Gtk::StatusIcon::property_stock ( )

Stock ID for a stock image to display.

Deprecated: 3.10: Use Gtk::StatusIcon::property_icon_name() instead.

Deprecated:
Use property_icon_name() instead.

Default value: ""

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_stock() [2/2]

Glib::PropertyProxy_ReadOnly< StockID > Gtk::StatusIcon::property_stock ( ) const

Stock ID for a stock image to display.

Deprecated: 3.10: Use Gtk::StatusIcon::property_icon_name() instead.

Deprecated:
Use property_icon_name() instead.

Default value: ""

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_storage_type()

Glib::PropertyProxy_ReadOnly< ImageType > Gtk::StatusIcon::property_storage_type ( ) const

The representation being used for image data.

Default value: Gtk::IMAGE_EMPTY

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_title() [1/2]

Glib::PropertyProxy< Glib::ustring > Gtk::StatusIcon::property_title ( )

The title of this tray icon.

This should be a short, human-readable, localized string describing the tray icon. It may be used by tools like screen readers to render the tray icon.

Since gtkmm 2.18:

Default value: ""

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_title() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::StatusIcon::property_title ( ) const

The title of this tray icon.

This should be a short, human-readable, localized string describing the tray icon. It may be used by tools like screen readers to render the tray icon.

Since gtkmm 2.18:

Default value: ""

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_tooltip_markup() [1/2]

Glib::PropertyProxy< Glib::ustring > Gtk::StatusIcon::property_tooltip_markup ( )

Sets the text of tooltip to be the given string, which is marked up with the [Pango text markup language][PangoMarkupFormat].

Also see Gtk::Tooltip::set_markup().

This is a convenience property which will take care of getting the tooltip shown if the given string is not nullptr. Gtk::StatusIcon::property_has_tooltip() will automatically be set to true and the default handler for the Gtk::StatusIcon::signal_query_tooltip() signal will take care of displaying the tooltip.

On some platforms, embedded markup will be ignored.

Since gtkmm 2.16:

Default value: ""

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_tooltip_markup() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::StatusIcon::property_tooltip_markup ( ) const

Sets the text of tooltip to be the given string, which is marked up with the [Pango text markup language][PangoMarkupFormat].

Also see Gtk::Tooltip::set_markup().

This is a convenience property which will take care of getting the tooltip shown if the given string is not nullptr. Gtk::StatusIcon::property_has_tooltip() will automatically be set to true and the default handler for the Gtk::StatusIcon::signal_query_tooltip() signal will take care of displaying the tooltip.

On some platforms, embedded markup will be ignored.

Since gtkmm 2.16:

Default value: ""

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_tooltip_text() [1/2]

Glib::PropertyProxy< Glib::ustring > Gtk::StatusIcon::property_tooltip_text ( )

Sets the text of tooltip to be the given string.

Also see Gtk::Tooltip::set_text().

This is a convenience property which will take care of getting the tooltip shown if the given string is not nullptr. Gtk::StatusIcon::property_has_tooltip() will automatically be set to true and the default handler for the Gtk::StatusIcon::signal_query_tooltip() signal will take care of displaying the tooltip.

Note that some platforms have limitations on the length of tooltips that they allow on status icons, e.g. Windows only shows the first 64 characters.

Since gtkmm 2.16:

Default value: ""

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_tooltip_text() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::StatusIcon::property_tooltip_text ( ) const

Sets the text of tooltip to be the given string.

Also see Gtk::Tooltip::set_text().

This is a convenience property which will take care of getting the tooltip shown if the given string is not nullptr. Gtk::StatusIcon::property_has_tooltip() will automatically be set to true and the default handler for the Gtk::StatusIcon::signal_query_tooltip() signal will take care of displaying the tooltip.

Note that some platforms have limitations on the length of tooltips that they allow on status icons, e.g. Windows only shows the first 64 characters.

Since gtkmm 2.16:

Default value: ""

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_visible() [1/2]

Glib::PropertyProxy< bool > Gtk::StatusIcon::property_visible ( )

Whether the status icon is visible.

Default value: true

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_visible() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::StatusIcon::property_visible ( ) const

Whether the status icon is visible.

Default value: true

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ set() [1/4]

void Gtk::StatusIcon::set ( const Glib::RefPtr< const Gio::Icon > &  icon)

Makes status_icon display the Gio::Icon.

See new_from_gicon() for details.

Since gtkmm 2.14:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; you can use Glib::notification_set_icon() to associate a Gio::Icon with a notification

Parameters
iconA GIcon.

◆ set() [2/4]

void Gtk::StatusIcon::set ( const Glib::RefPtr< Gdk::Pixbuf > &  pixbuf)

Makes status_icon display pixbuf.

See new_from_pixbuf() for details.

Since gtkmm 2.10:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; you can use Glib::notification_set_icon() to associate a Gio::Icon with a notification

Parameters
pixbufA Gdk::Pixbuf or nullptr.

◆ set() [3/4]

void Gtk::StatusIcon::set ( const Glib::ustring &  icon_name)

Makes status_icon display the icon named icon_name from the current icon theme.

See new_from_icon_name() for details.

Since gtkmm 2.10:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; you can use Glib::notification_set_icon() to associate a Gio::Icon with a notification

Parameters
icon_nameAn icon name.

◆ set() [4/4]

void Gtk::StatusIcon::set ( const StockID stock_id)

Makes status_icon display the stock icon with the id stock_id.

See new_from_stock() for details.

Since gtkmm 2.10:

Deprecated: 3.10: Use set_from_icon_name() instead.

Deprecated:
Use the set() with the icon_name parameter instead.
Parameters
stock_idA stock icon id.

◆ set_from_file()

void Gtk::StatusIcon::set_from_file ( const Glib::ustring &  filename)

Makes status_icon display the file filename.

See new_from_file() for details.

Since gtkmm 2.10:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; you can use Glib::notification_set_icon() to associate a Gio::Icon with a notification

Parameters
filenameA filename.

◆ set_has_tooltip()

void Gtk::StatusIcon::set_has_tooltip ( bool  has_tooltip = true)

Sets the has-tooltip property on status_icon to has_tooltip.

See Gtk::StatusIcon::property_has_tooltip() for more information.

Since gtkmm 2.16:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; there is no direct replacement for this function, but notifications can display an arbitrary amount of text using Glib::notification_set_body()

Parameters
has_tooltipWhether or not status_icon has a tooltip.

◆ set_name()

void Gtk::StatusIcon::set_name ( const Glib::ustring &  name)

Sets the name of this tray icon.

This should be a string identifying this icon. It is may be used for sorting the icons in the tray and will not be shown to the user.

Since gtkmm 2.20:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; there is no direct replacement for this function, as notifications are associated with a unique application identifier by Gio::Application

Parameters
nameThe name.

◆ set_screen()

void Gtk::StatusIcon::set_screen ( const Glib::RefPtr< Gdk::Screen > &  screen)

Sets the Gdk::Screen where status_icon is displayed; if the icon is already mapped, it will be unmapped, and then remapped on the new screen.

Since gtkmm 2.12:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; there is no direct replacement for this function, as GTK typically only has one Gdk::Screen and notifications are managed by the platform

Parameters
screenA Gdk::Screen.

◆ set_title()

void Gtk::StatusIcon::set_title ( const Glib::ustring &  title)

Sets the title of this tray icon.

This should be a short, human-readable, localized string describing the tray icon. It may be used by tools like screen readers to render the tray icon.

Since gtkmm 2.18:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; you should use Glib::notification_set_title() and Glib::notification_set_body() to present text inside your notification

Parameters
titleThe title.

◆ set_tooltip_markup()

void Gtk::StatusIcon::set_tooltip_markup ( const Glib::ustring &  markup)

Sets markup as the contents of the tooltip, which is marked up with the [Pango text markup language][PangoMarkupFormat].

This function will take care of setting Gtk::StatusIcon::property_has_tooltip() to true and of the default handler for the Gtk::StatusIcon::signal_query_tooltip() signal.

See also the Gtk::StatusIcon::property_tooltip_markup() property and Gtk::Tooltip::set_markup().

Since gtkmm 2.16:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; there is no direct replacement for this function

Parameters
markupThe contents of the tooltip for status_icon, or nullptr.

◆ set_tooltip_text()

void Gtk::StatusIcon::set_tooltip_text ( const Glib::ustring &  text)

Sets text as the contents of the tooltip.

This function will take care of setting Gtk::StatusIcon::property_has_tooltip() to true and of the default handler for the Gtk::StatusIcon::signal_query_tooltip() signal.

See also the Gtk::StatusIcon::property_tooltip_text() property and Gtk::Tooltip::set_text().

Since gtkmm 2.16:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; there is no direct replacement for this function

Parameters
textThe contents of the tooltip for status_icon.

◆ set_visible()

void Gtk::StatusIcon::set_visible ( bool  visible = true)

Shows or hides a status icon.

Since gtkmm 2.10:

Deprecated: 3.14: Use Notification and Gtk::Application to provide status notifications; there is no direct replacement for this function, as notifications are managed by the platform

Parameters
visibletrue to show the status icon, false to hide it.

◆ signal_activate()

Glib::SignalProxy< void > Gtk::StatusIcon::signal_activate ( )
Slot Prototype:
void on_my_activate()

Flags: Run First, Action

Gets emitted when the user activates the status icon. If and how status icons can activated is platform-dependent.

Unlike most G_SIGNAL_ACTION signals, this signal is meant to be used by applications and should be wrapped by language bindings.

Since gtkmm 2.10:

◆ signal_button_press_event()

Glib::SignalProxy< bool, GdkEventButton * > Gtk::StatusIcon::signal_button_press_event ( )
Slot Prototype:
bool on_my_button_press_event(GdkEventButton* event)

Flags: Run Last

The signal_button_press_event() signal will be emitted when a button (typically from a mouse) is pressed.

Whether this event is emitted is platform-dependent. Use the signal_activate() and signal_popup_menu() signals in preference.

Since gtkmm 2.14:
Parameters
eventThe Gdk::EventButton which triggered this signal.
Returns
true to stop other handlers from being invoked for the event. false to propagate the event further.

◆ signal_button_release_event()

Glib::SignalProxy< bool, GdkEventButton * > Gtk::StatusIcon::signal_button_release_event ( )
Slot Prototype:
bool on_my_button_release_event(GdkEventButton* event)

Flags: Run Last

The signal_button_release_event() signal will be emitted when a button (typically from a mouse) is released.

Whether this event is emitted is platform-dependent. Use the signal_activate() and signal_popup_menu() signals in preference.

Since gtkmm 2.14:
Parameters
eventThe Gdk::EventButton which triggered this signal.
Returns
true to stop other handlers from being invoked for the event. false to propagate the event further.

◆ signal_popup_menu()

Glib::SignalProxy< void, guint, guint32 > Gtk::StatusIcon::signal_popup_menu ( )
Slot Prototype:
void on_my_popup_menu(guint button, guint32 activate_time)

Flags: 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_time parameters should be passed as the last to arguments to Gtk::Menu::popup().

Unlike most G_SIGNAL_ACTION signals, this signal is meant to be used by applications and should be wrapped by language bindings.

Since gtkmm 2.10:
Parameters
buttonThe button that was pressed, or 0 if the signal is not emitted in response to a button press event.
activate_timeThe timestamp of the event that triggered the signal emission.

◆ signal_query_tooltip()

Glib::SignalProxy< bool, int, int, bool, const Glib::RefPtr< Tooltip > & > Gtk::StatusIcon::signal_query_tooltip ( )
Slot Prototype:
bool on_my_query_tooltip(int x, int y, bool keyboard_mode, const Glib::RefPtr<Tooltip>& tooltip)

Flags: Run Last

Emitted when the hover timeout has expired with the cursor hovering above status_icon; or emitted when status_icon got focus in keyboard mode.

Using the given coordinates, the signal handler should determine whether a tooltip should be shown for status_icon. If this is the case true should be returned, false otherwise. Note that if keyboard_mode is true, the values of x and y are undefined and should not be used.

The signal handler is free to manipulate tooltip with the therefore destined function calls.

Whether this signal is emitted is platform-dependent. For plain text tooltips, use Gtk::StatusIcon::property_tooltip_text() in preference.

Since gtkmm 2.16:
Parameters
xThe x coordinate of the cursor position where the request has been emitted, relative to status_icon.
yThe y coordinate of the cursor position where the request has been emitted, relative to status_icon.
keyboard_modetrue if the tooltip was trigged using the keyboard.
tooltipA Gtk::Tooltip.
Returns
true if tooltip should be shown right now, false otherwise.

◆ signal_scroll_event()

Glib::SignalProxy< bool, GdkEventScroll * > Gtk::StatusIcon::signal_scroll_event ( )
Slot Prototype:
bool on_my_scroll_event(GdkEventScroll* event)

Flags: Run Last

The signal_scroll_event() signal is emitted when a button in the 4 to 7 range is pressed. Wheel mice are usually configured to generate button press events for buttons 4 and 5 when the wheel is turned.

Whether this event is emitted is platform-dependent.

Since gtkmm 2.16:
Parameters
eventThe Gdk::EventScroll which triggered this signal.
Returns
true to stop other handlers from being invoked for the event. false to propagate the event further.

◆ signal_size_changed()

Glib::SignalProxy< bool, int > Gtk::StatusIcon::signal_size_changed ( )
Slot Prototype:
bool on_my_size_changed(int size)

Flags: Run Last

Gets emitted when the size available for the image changes, e.g. because the notification area got resized.

Since gtkmm 2.10:
Parameters
sizeThe new size.
Returns
true if the icon was updated for the new size. Otherwise, GTK+ will scale the icon as necessary.

Friends And Related Function Documentation

◆ wrap()

Glib::RefPtr< Gtk::StatusIcon > wrap ( GtkStatusIcon *  object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.