Graphics.UI.Gtk.Display.StatusIcon

gtk3-0.14.6: Binding to the Gtk+ 3 graphical user interface library

Maintainer | gtk2hs-users@lists.sourceforge.net
Stability | provisional
Portability | portable (depends on GHC)
Safe Haskell | None
Language | Haskell98

Graphics.UI.Gtk.Display.StatusIcon

Contents

- Detail
- Class Hierarchy
- Types
- Constructors
- Methods
- Attributes
- Signals
- Deprecated

Description

Display an icon in the system tray

- Module available since Gtk+ version 2.10

Synopsis

- data StatusIcon
- class TooltipClass o => StatusIconClass o
- castToStatusIcon :: GObjectClass obj => obj -> StatusIcon
- gTypeStatusIcon :: GType
- toStatusIcon :: StatusIconClass o => o -> StatusIcon
- statusIconNew :: IO StatusIcon
- statusIconNewFromPixbuf :: Pixbuf -> IO StatusIcon
- statusIconNewFromFile :: GlibString string => string -> IO StatusIcon
- statusIconNewFromStock :: StockId -> IO StatusIcon
- statusIconNewFromIconName :: GlibString string => string -> IO StatusIcon
- statusIconSetFromPixbuf :: StatusIconClass self => self -> Pixbuf -> IO ()
- statusIconSetFromFile :: (StatusIconClass self, GlibString string) => self -> string -> IO ()
- statusIconSetFromStock :: StatusIconClass self => self -> StockId -> IO ()
- statusIconSetFromIconName :: (StatusIconClass self, GlibString string) => self -> string -> IO ()
- statusIconGetStorageType :: StatusIconClass self => self -> IO ImageType
- statusIconGetPixbuf :: StatusIconClass self => self -> IO (Maybe Pixbuf)
- statusIconGetStock :: StatusIconClass self => self -> IO (Maybe StockId)
- statusIconGetIconName :: (StatusIconClass self, GlibString string) => self -> IO (Maybe string)
- statusIconGetSize :: StatusIconClass self => self -> IO Int
- statusIconSetVisible :: StatusIconClass self => self -> Bool -> IO ()
- statusIconGetVisible :: StatusIconClass self => self -> IO Bool
- statusIconIsEmbedded :: StatusIconClass self => self -> IO Bool
- statusIconPositionMenu :: (MenuClass menu, StatusIconClass self) => menu -> self -> IO (Int, Int, Bool)
- statusIconGetGeometry :: StatusIconClass self => self -> IO (Maybe (Rectangle, Orientation))
- statusIconSetScreen :: (StatusIconClass self, ScreenClass screen) => self -> Maybe screen -> IO ()
- statusIconGetScreen :: StatusIconClass self => self -> IO (Maybe Screen)
- statusIconSetTooltipText :: (StatusIconClass self, GlibString string) => self -> Maybe string -> IO ()
- statusIconGetTooltipText :: (StatusIconClass self, GlibString string) => self -> IO (Maybe string)
- statusIconSetTooltipMarkup :: (StatusIconClass self, GlibString string) => self -> Maybe string -> IO ()
- statusIconGetTooltipMarkup :: (StatusIconClass self, GlibString string) => self -> IO (Maybe string)
- statusIconSetHasTooltip :: StatusIconClass self => self -> Bool -> IO ()
- statusIconGetHasTooltip :: StatusIconClass self => self -> IO Bool
- statusIconSetTitle :: (StatusIconClass self, GlibString string) => self -> Maybe string -> IO ()
- statusIconGetTitle :: (StatusIconClass self, GlibString string) => self -> IO (Maybe string)
- statusIconSetName :: (StatusIconClass self, GlibString string) => self -> string -> IO ()
- statusIconPixbuf :: StatusIconClass self => Attr self Pixbuf
- statusIconFile :: (StatusIconClass self, GlibString string) => WriteAttr self (Maybe string)
- statusIconStock :: (StatusIconClass self, GlibString string) => Attr self (Maybe string)
- statusIconIconName :: (StatusIconClass self, GlibString string) => Attr self (Maybe string)
- statusIconStorageType :: StatusIconClass self => ReadAttr self ImageType
- statusIconSize :: StatusIconClass self => ReadAttr self Int
- statusIconVisible :: StatusIconClass self => Attr self Bool
- statusIconScreen :: StatusIconClass self => Attr self Screen
- statusIconTooltipText :: (StatusIconClass self, GlibString string) => Attr self (Maybe string)
- statusIconTooltipMarkup :: (StatusIconClass self, GlibString string) => Attr self (Maybe string)
- statusIconHasTooltip :: StatusIconClass self => Attr self Bool
- statusIconTitle :: (StatusIconClass self, GlibString string) => Attr self (Maybe string)
- statusIconSizeChanged :: StatusIconClass self => Signal self (Int -> IO Bool)
- statusIconActivated :: StatusIconClass self => Signal self (IO ())
- statusIconActivate :: StatusIconClass self => Signal self (IO ())
- statusIconPopupMenu :: StatusIconClass self => Signal self (Maybe MouseButton -> TimeStamp -> IO ())

# Detail

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

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 `GObject`. Making it a widget would be impractical, since the system tray on Win32 doesn't allow to embed arbitrary widgets.

# Class Hierarchy

    | GObject
    | +----StatusIcon

# Types

data StatusIcon #

Instances

Eq StatusIcon # |
Methods (==) :: StatusIcon -> StatusIcon -> Bool # (/=) :: StatusIcon -> StatusIcon -> Bool #
Ord StatusIcon # |
Methods compare :: StatusIcon -> StatusIcon -> Ordering # (<) :: StatusIcon -> StatusIcon -> Bool # (<=) :: StatusIcon -> StatusIcon -> Bool # (>) :: StatusIcon -> StatusIcon -> Bool # (>=) :: StatusIcon -> StatusIcon -> Bool # max :: StatusIcon -> StatusIcon -> StatusIcon # min :: StatusIcon -> StatusIcon -> StatusIcon #
GObjectClass StatusIcon # |
Methods toGObject :: StatusIcon -> GObject # unsafeCastGObject :: GObject -> StatusIcon #
StatusIconClass StatusIcon # |
TooltipClass StatusIcon # |

class TooltipClass o => StatusIconClass o #

Instances

StatusIconClass StatusIcon # |

castToStatusIcon :: GObjectClass obj => obj -> StatusIcon #

gTypeStatusIcon :: GType #

toStatusIcon :: StatusIconClass o => o -> StatusIcon #

# Constructors

statusIconNew :: IO StatusIcon #

Creates an empty status icon object.

statusIconNewFromPixbuf #

Arguments

:: Pixbuf | `pixbuf` - a `Pixbuf`
-> IO StatusIcon |

Creates a status icon displaying `pixbuf`.

The image will be scaled down to fit in the available space in the notification area, if necessary.

statusIconNewFromFile #

Arguments

:: GlibString string |
=> string | `filename` - a filename
-> IO StatusIcon |

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.

statusIconNewFromStock #

Arguments

:: StockId | `stockId` - a stock icon id
-> IO StatusIcon |

statusIconNewFromIconName #

Arguments

:: GlibString string |
=> string | `iconName` - an icon name
-> IO StatusIcon |

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.

# Methods

statusIconSetFromPixbuf #

Arguments

:: StatusIconClass self |
=> self |
-> Pixbuf | `pixbuf` - a `Pixbuf`
-> IO () |

Makes `statusIcon` display `pixbuf`. See `statusIconNewFromPixbuf` for details.

statusIconSetFromFile #

Arguments

:: (StatusIconClass self, GlibString string) |
=> self |
-> string | `filename` - a filename
-> IO () |

Makes `statusIcon` display the file `filename`. See `statusIconNewFromFile` for details.

statusIconSetFromStock #

Arguments

:: StatusIconClass self |
=> self |
-> StockId | `stockId` - a stock icon id
-> IO () |

Makes `statusIcon` display the stock icon with the id `stockId`. See `statusIconNewFromStock` for details.

statusIconSetFromIconName #

Arguments

:: (StatusIconClass self, GlibString string) |
=> self |
-> string | `iconName` - an icon name
-> IO () |

Makes `statusIcon` display the icon named `iconName` from the current icon theme. See `statusIconNewFromIconName` for details.

statusIconGetStorageType #

Arguments

:: StatusIconClass self |
=> self |
-> IO ImageType | returns the image representation being used

Gets the type of representation being used by the `StatusIcon` to store image data. If the `StatusIcon` has no image data, the return value will be `ImageEmpty`.

statusIconGetPixbuf #

Arguments

:: StatusIconClass self |
=> self |
-> IO (Maybe Pixbuf) | returns the displayed pixbuf, or `Nothing` if the image is empty.

statusIconGetStock #

Arguments

:: StatusIconClass self |
=> self |
-> IO (Maybe StockId) | returns stock id of the displayed stock icon, or `Nothing` if the image is empty.

statusIconGetIconName #

Arguments

:: (StatusIconClass self, GlibString string) |
=> self |
-> IO (Maybe string) | returns name of the displayed icon, or `Nothing` if the image is empty.

statusIconGetSize #

Arguments

:: StatusIconClass self |
=> self |
-> IO Int | returns the size that is available for the image

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 `sizeChanged` signal can be used to react to size changes.

statusIconSetVisible #

Arguments

:: StatusIconClass self |
=> self |
-> Bool | `visible` - `True` to show the status icon, `False` to hide it
-> IO () |

Shows or hides a status icon.

statusIconGetVisible #

Arguments

:: StatusIconClass self |
=> self |
-> IO Bool | returns `True` if the status icon is visible

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

statusIconIsEmbedded #

Arguments

:: StatusIconClass self |
=> self |
-> IO Bool | returns `True` if the status icon is embedded in a notification area.

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

statusIconPositionMenu #

Arguments

:: (MenuClass menu, StatusIconClass self) |
=> menu | `menu` - the `Menu`
-> self | `userData` - the status icon to position the menu on
-> IO (Int, Int, Bool) | `(x,y,pushIn)` - `(x,y)` - coordinates. `pushIn` - whether the menu should be pushed in to be completely inside the screen instead of just clamped to the size to the screen.

Menu positioning function to use with `menuPopup` to position `menu` aligned to the status icon `userData`.

statusIconGetGeometry :: StatusIconClass self => self -> IO (Maybe (Rectangle, 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.

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

statusIconSetScreen :: (StatusIconClass self, ScreenClass screen) => self -> Maybe screen -> IO () #

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

statusIconGetScreen :: StatusIconClass self => self -> IO (Maybe Screen) #

Returns the `Screen` associated with the status icon.

statusIconSetTooltipText :: (StatusIconClass self, GlibString string) => self -> Maybe string -> IO () #

Sets text as the contents of the tooltip.

This function will take care of setting "has-tooltip" to `True` and of the default handler for the "query-tooltip" signal.

See also the "tooltip-text" property and `tooltipSetText`.

statusIconGetTooltipText :: (StatusIconClass self, GlibString string) => self -> IO (Maybe string) #

Gets the contents of the tooltip for status icon.

statusIconSetTooltipMarkup :: (StatusIconClass self, GlibString string) => self -> Maybe string -> IO () #

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

This function will take care of setting `statusIconHasTooltip` to `True` and of the default handler for the `queryTooltip` signal.

See also the `tooltipMarkup` property and `tooltipSetMarkup`.

statusIconGetTooltipMarkup :: (StatusIconClass self, GlibString string) => self -> IO (Maybe string) #

Gets the contents of the tooltip for status icon.

statusIconSetHasTooltip :: StatusIconClass self => self -> Bool -> IO () #

Sets the has-tooltip property on the status icon to `hasTooltip`. See `statusIconHasTooltip` for more information.

statusIconGetHasTooltip :: StatusIconClass self => self -> IO Bool #

Returns the current value of the has-tooltip property. See `statusIconHasTooltip` for more information.

statusIconSetTitle :: (StatusIconClass self, GlibString string) => self -> Maybe string -> IO () #

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.

statusIconGetTitle :: (StatusIconClass self, GlibString string) => self -> IO (Maybe string) #

Gets the title of this tray icon. See `statusIconSetTitle`.

statusIconSetName :: (StatusIconClass self, GlibString string) => self -> string -> IO () #

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.

# Attributes

statusIconPixbuf :: StatusIconClass self => Attr self Pixbuf #

A `Pixbuf` to display.

statusIconFile :: (StatusIconClass self, GlibString string) => WriteAttr self (Maybe string) #

Filename to load and display.

Default value: `Nothing`

statusIconStock :: (StatusIconClass self, GlibString string) => Attr self (Maybe string) #

Stock ID for a stock image to display.

Default value: `Nothing`

statusIconIconName :: (StatusIconClass self, GlibString string) => Attr self (Maybe string) #

The name of the icon from the icon theme.

Default value: `Nothing`

statusIconStorageType :: StatusIconClass self => ReadAttr self ImageType #

The representation being used for image data.

Default value: `ImageEmpty`

statusIconSize :: StatusIconClass self => ReadAttr self Int #

The size of the icon.

Allowed values: >= 0

Default value: 0

statusIconVisible :: StatusIconClass self => Attr self Bool #

Whether or not the status icon is visible.

Default value: `True`

statusIconScreen :: StatusIconClass self => Attr self Screen #

The screen where this status icon will be displayed.

statusIconTooltipText :: (StatusIconClass self, GlibString string) => Attr self (Maybe string) #

Sets the text of tooltip to be the given string.

Also see `tooltipSetText`.

This is a convenience property which will take care of getting the tooltip shown if the given value is not `Nothing`. "has-tooltip" will automatically be set to `True` and the default handler for the "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.

Default value: `Nothing`

statusIconTooltipMarkup :: (StatusIconClass self, GlibString string) => Attr self (Maybe string) #

Sets the text of tooltip to be the given string, which is marked up with the Pango text markup language. Also see `tooltipSetMarkup`.

This is a convenience property which will take care of getting the tooltip shown if the given value is not `Nothing`. "has-tooltip" will automatically be set to `True` and the default handler for the "query-tooltip" signal will take care of displaying the tooltip.

On some platforms, embedded markup will be ignored.

Default value: `Nothing`

statusIconHasTooltip :: StatusIconClass self => Attr self Bool #

Enables or disables the emission of "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 "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 "tooltip-text" in preference.

Default value: `False`

statusIconTitle :: (StatusIconClass self, GlibString string) => Attr self (Maybe string) #

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.

Default value: `Nothing`

# Signals

statusIconSizeChanged :: StatusIconClass self => Signal self (Int -> IO Bool) #

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

statusIconActivated :: StatusIconClass self => Signal self (IO ()) #

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

statusIconActivate :: StatusIconClass self => Signal self (IO ()) #

Deprecated. See `statusIconActivated`.

statusIconPopupMenu :: StatusIconClass self => Signal self (Maybe MouseButton -> TimeStamp -> IO ()) #

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 `MouseButton` and `TimeStamp` parameters should be passed as the last to arguments to `menuPopup`.

# Deprecated