Portability | portable (depends on GHC) |
---|---|
Stability | provisional |
Maintainer | gtk2hs-users@lists.sourceforge.net |
Safe Haskell | None |
Display an icon in the system tray
- Module available since Gtk+ version 2.10
- 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 :: String -> IO StatusIcon
- statusIconNewFromStock :: StockId -> IO StatusIcon
- statusIconNewFromIconName :: String -> IO StatusIcon
- statusIconSetFromPixbuf :: StatusIconClass self => self -> Pixbuf -> IO ()
- statusIconSetFromFile :: StatusIconClass self => self -> String -> IO ()
- statusIconSetFromStock :: StatusIconClass self => self -> StockId -> IO ()
- statusIconSetFromIconName :: StatusIconClass self => 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 => self -> IO (Maybe String)
- statusIconGetSize :: StatusIconClass self => self -> IO Int
- statusIconSetTooltip :: StatusIconClass self => self -> String -> IO ()
- statusIconSetVisible :: StatusIconClass self => self -> Bool -> IO ()
- statusIconGetVisible :: StatusIconClass self => self -> IO Bool
- statusIconSetBlinking :: StatusIconClass self => self -> Bool -> IO ()
- statusIconGetBlinking :: 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))
- statusIconSetName :: StatusIconClass self => self -> String -> IO ()
- statusIconPixbuf :: StatusIconClass self => Attr self Pixbuf
- statusIconFile :: StatusIconClass self => WriteAttr self (Maybe String)
- statusIconStock :: StatusIconClass self => Attr self (Maybe String)
- statusIconIconName :: StatusIconClass self => Attr self (Maybe String)
- statusIconStorageType :: StatusIconClass self => ReadAttr self ImageType
- statusIconSize :: StatusIconClass self => ReadAttr self Int
- statusIconBlinking :: StatusIconClass self => Attr self Bool
- statusIconVisible :: StatusIconClass self => Attr self Bool
- statusIconSizeChanged :: StatusIconClass self => Signal self (Int -> IO Bool)
- statusIconActivate :: StatusIconClass self => Signal self (IO ())
- statusIconPopupMenu :: StatusIconClass self => Signal self (Maybe MouseButton -> TimeStamp -> IO ())
- onActivate :: StatusIconClass self => self -> IO () -> IO (ConnectId self)
- afterActivate :: StatusIconClass self => self -> IO () -> IO (ConnectId self)
- onPopupMenu :: StatusIconClass self => self -> (Maybe MouseButton -> TimeStamp -> IO ()) -> IO (ConnectId self)
- afterPopupMenu :: StatusIconClass self => self -> (Maybe MouseButton -> TimeStamp -> IO ()) -> IO (ConnectId self)
- onSizeChanged :: StatusIconClass self => self -> (Int -> IO Bool) -> IO (ConnectId self)
- afterSizeChanged :: StatusIconClass self => self -> (Int -> IO Bool) -> IO (ConnectId self)
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 Source
class TooltipClass o => StatusIconClass o Source
castToStatusIcon :: GObjectClass obj => obj -> StatusIconSource
toStatusIcon :: StatusIconClass o => o -> StatusIconSource
Constructors
statusIconNew :: IO StatusIconSource
Creates an empty status icon object.
:: 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.
:: String |
|
-> 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.
:: StockId |
|
-> IO StatusIcon |
statusIconNewFromIconNameSource
:: String |
|
-> 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
:: StatusIconClass self | |
=> self | |
-> Pixbuf |
|
-> IO () |
Makes statusIcon
display pixbuf
. See statusIconNewFromPixbuf
for
details.
:: StatusIconClass self | |
=> self | |
-> String |
|
-> IO () |
Makes statusIcon
display the file filename
. See
statusIconNewFromFile
for details.
:: StatusIconClass self | |
=> self | |
-> StockId |
|
-> IO () |
Makes statusIcon
display the stock icon with the id stockId
. See
statusIconNewFromStock
for details.
statusIconSetFromIconNameSource
:: StatusIconClass self | |
=> self | |
-> String |
|
-> IO () |
Makes statusIcon
display the icon named iconName
from the current
icon theme. See statusIconNewFromIconName
for details.
statusIconGetStorageTypeSource
:: 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
.
:: StatusIconClass self | |
=> self | |
-> IO (Maybe Pixbuf) | returns the displayed pixbuf, or |
:: StatusIconClass self | |
=> self | |
-> IO (Maybe StockId) | returns stock id of the displayed stock icon, or |
:: StatusIconClass self | |
=> self | |
-> IO (Maybe String) | returns name of the displayed icon, or |
:: 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.
:: StatusIconClass self | |
=> self | |
-> String |
|
-> IO () |
Sets the tooltip of the status icon.
:: StatusIconClass self | |
=> self | |
-> Bool |
|
-> IO () |
Shows or hides a status icon.
:: StatusIconClass self | |
=> self | |
-> IO Bool | returns |
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
.
:: StatusIconClass self | |
=> self | |
-> Bool |
|
-> IO () |
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.
:: StatusIconClass self | |
=> self | |
-> IO Bool | returns |
Returns whether the icon is blinking, see statusIconSetBlinking
.
:: StatusIconClass self | |
=> self | |
-> IO Bool | returns |
Returns whether the status icon is embedded in a notification area.
:: (MenuClass menu, StatusIconClass self) | |
=> menu |
|
-> self |
|
-> IO (Int, Int, Bool) |
|
Menu positioning function to use with menuPopup
to position menu
aligned to the status icon userData
.
statusIconGetGeometry :: StatusIconClass self => self -> IO (Maybe (Rectangle, Orientation))Source
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
.
statusIconSetName :: StatusIconClass self => self -> String -> IO ()Source
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 PixbufSource
A Pixbuf
to display.
statusIconFile :: StatusIconClass self => WriteAttr self (Maybe String)Source
Filename to load and display.
Default value: Nothing
statusIconStock :: StatusIconClass self => Attr self (Maybe String)Source
Stock ID for a stock image to display.
Default value: Nothing
statusIconIconName :: StatusIconClass self => Attr self (Maybe String)Source
The name of the icon from the icon theme.
Default value: Nothing
statusIconStorageType :: StatusIconClass self => ReadAttr self ImageTypeSource
The representation being used for image data.
Default value: ImageEmpty
statusIconSize :: StatusIconClass self => ReadAttr self IntSource
The size of the icon.
Allowed values: >= 0
Default value: 0
statusIconBlinking :: StatusIconClass self => Attr self BoolSource
Whether or not the status icon is blinking.
Default value: False
statusIconVisible :: StatusIconClass self => Attr self BoolSource
Whether or not the status icon is visible.
Default value: True
Signals
statusIconSizeChanged :: StatusIconClass self => Signal self (Int -> IO Bool)Source
Gets emitted when the size available for the image changes, e.g. because the notification area got resized.
statusIconActivate :: StatusIconClass self => Signal self (IO ())Source
Gets emitted when the user activates the status icon. If and how status icons can activated is platform-dependent.
statusIconPopupMenu :: StatusIconClass self => Signal self (Maybe MouseButton -> TimeStamp -> IO ())Source
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
onActivate :: StatusIconClass self => self -> IO () -> IO (ConnectId self)Source
Deprecated: instead of 'onActivate obj' use 'on obj activate'
afterActivate :: StatusIconClass self => self -> IO () -> IO (ConnectId self)Source
Deprecated: instead of 'afterActivate obj' use 'after obj activate'
onPopupMenu :: StatusIconClass self => self -> (Maybe MouseButton -> TimeStamp -> IO ()) -> IO (ConnectId self)Source
Deprecated: instead of 'onPopupMenu obj' use 'on obj popupMenu'
afterPopupMenu :: StatusIconClass self => self -> (Maybe MouseButton -> TimeStamp -> IO ()) -> IO (ConnectId self)Source
Deprecated: instead of 'afterPopupMenu obj' use 'after obj popupMenu'
onSizeChanged :: StatusIconClass self => self -> (Int -> IO Bool) -> IO (ConnectId self)Source
Deprecated: instead of 'onSizeChanged obj' use 'on obj sizeChanged'
afterSizeChanged :: StatusIconClass self => self -> (Int -> IO Bool) -> IO (ConnectId self)Source
Deprecated: instead of 'afterSizeChanged obj' use 'after obj sizeChanged'