module Graphics.UI.Gtk.Display.StatusIcon (
StatusIcon,
StatusIconClass,
castToStatusIcon, gTypeStatusIcon,
toStatusIcon,
statusIconNew,
statusIconNewFromPixbuf,
statusIconNewFromFile,
statusIconNewFromStock,
statusIconNewFromIconName,
statusIconSetFromPixbuf,
statusIconSetFromFile,
statusIconSetFromStock,
statusIconSetFromIconName,
statusIconGetStorageType,
statusIconGetPixbuf,
statusIconGetStock,
statusIconGetIconName,
statusIconGetSize,
statusIconSetTooltip,
statusIconSetVisible,
statusIconGetVisible,
statusIconSetBlinking,
statusIconGetBlinking,
statusIconIsEmbedded,
statusIconPositionMenu,
statusIconGetGeometry,
statusIconSetName,
statusIconPixbuf,
statusIconFile,
statusIconStock,
statusIconIconName,
statusIconStorageType,
statusIconSize,
statusIconBlinking,
statusIconVisible,
statusIconSizeChanged,
statusIconActivate,
statusIconPopupMenu,
onActivate,
afterActivate,
onPopupMenu,
afterPopupMenu,
onSizeChanged,
afterSizeChanged,
) where
import Control.Monad (liftM)
import System.Glib.FFI
import System.Glib.UTFString
import System.Glib.Attributes
import System.Glib.Properties
import System.Glib.GObject (wrapNewGObject,makeNewGObject)
import Graphics.UI.Gtk.Types
import Graphics.UI.Gtk.General.Enums
import Graphics.UI.Gtk.General.Structs
import Graphics.UI.Gtk.Display.Image (ImageType)
import Graphics.UI.Gtk.Signals
import Graphics.UI.Gtk.General.StockItems
import Graphics.UI.Gtk.Gdk.Events
statusIconNew :: IO StatusIcon
statusIconNew =
wrapNewGObject mkStatusIcon $
gtk_status_icon_new
statusIconNewFromPixbuf ::
Pixbuf
-> IO StatusIcon
statusIconNewFromPixbuf pixbuf =
wrapNewGObject mkStatusIcon $
(\(Pixbuf arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_new_from_pixbuf argPtr1)
pixbuf
statusIconNewFromFile ::
String
-> IO StatusIcon
statusIconNewFromFile filename =
wrapNewGObject mkStatusIcon $
withUTFString filename $ \filenamePtr ->
gtk_status_icon_new_from_file
filenamePtr
statusIconNewFromStock ::
StockId
-> IO StatusIcon
statusIconNewFromStock stockId =
wrapNewGObject mkStatusIcon $
withUTFString stockId $ \stockIdPtr ->
gtk_status_icon_new_from_stock
stockIdPtr
statusIconNewFromIconName ::
String
-> IO StatusIcon
statusIconNewFromIconName iconName =
wrapNewGObject mkStatusIcon $
withUTFString iconName $ \iconNamePtr ->
gtk_status_icon_new_from_icon_name
iconNamePtr
statusIconSetFromPixbuf :: StatusIconClass self => self
-> Pixbuf
-> IO ()
statusIconSetFromPixbuf self pixbuf =
(\(StatusIcon arg1) (Pixbuf arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_status_icon_set_from_pixbuf argPtr1 argPtr2)
(toStatusIcon self)
pixbuf
statusIconSetFromFile :: StatusIconClass self => self
-> String
-> IO ()
statusIconSetFromFile self filename =
withUTFString filename $ \filenamePtr ->
(\(StatusIcon arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_set_from_file argPtr1 arg2)
(toStatusIcon self)
filenamePtr
statusIconSetFromStock :: StatusIconClass self => self
-> StockId
-> IO ()
statusIconSetFromStock self stockId =
withUTFString stockId $ \stockIdPtr ->
(\(StatusIcon arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_set_from_stock argPtr1 arg2)
(toStatusIcon self)
stockIdPtr
statusIconSetFromIconName :: StatusIconClass self => self
-> String
-> IO ()
statusIconSetFromIconName self iconName =
withUTFString iconName $ \iconNamePtr ->
(\(StatusIcon arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_set_from_icon_name argPtr1 arg2)
(toStatusIcon self)
iconNamePtr
statusIconGetStorageType :: StatusIconClass self => self
-> IO ImageType
statusIconGetStorageType self =
liftM (toEnum . fromIntegral) $
(\(StatusIcon arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_get_storage_type argPtr1)
(toStatusIcon self)
statusIconGetPixbuf :: StatusIconClass self => self
-> IO (Maybe Pixbuf)
statusIconGetPixbuf self = do
ptr <- (\(StatusIcon arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_get_pixbuf argPtr1)
(toStatusIcon self)
maybePeek (makeNewGObject mkPixbuf . return) ptr
statusIconGetStock :: StatusIconClass self => self
-> IO (Maybe StockId)
statusIconGetStock self =
(\(StatusIcon arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_get_stock argPtr1)
(toStatusIcon self)
>>= maybePeek peekUTFString
statusIconGetIconName :: StatusIconClass self => self
-> IO (Maybe String)
statusIconGetIconName self =
(\(StatusIcon arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_get_icon_name argPtr1)
(toStatusIcon self)
>>= maybePeek peekUTFString
statusIconGetSize :: StatusIconClass self => self
-> IO Int
statusIconGetSize self =
liftM fromIntegral $
(\(StatusIcon arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_get_size argPtr1)
(toStatusIcon self)
statusIconSetTooltip :: StatusIconClass self => self
-> String
-> IO ()
statusIconSetTooltip self tooltipText =
withUTFString tooltipText $ \tooltipTextPtr ->
(\(StatusIcon arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_set_tooltip argPtr1 arg2)
(toStatusIcon self)
tooltipTextPtr
statusIconSetVisible :: StatusIconClass self => self
-> Bool
-> IO ()
statusIconSetVisible self visible =
(\(StatusIcon arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_set_visible argPtr1 arg2)
(toStatusIcon self)
(fromBool visible)
statusIconGetVisible :: StatusIconClass self => self
-> IO Bool
statusIconGetVisible self =
liftM toBool $
(\(StatusIcon arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_get_visible argPtr1)
(toStatusIcon self)
statusIconSetBlinking :: StatusIconClass self => self
-> Bool
-> IO ()
statusIconSetBlinking self blinking =
(\(StatusIcon arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_set_blinking argPtr1 arg2)
(toStatusIcon self)
(fromBool blinking)
statusIconGetBlinking :: StatusIconClass self => self
-> IO Bool
statusIconGetBlinking self =
liftM toBool $
(\(StatusIcon arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_get_blinking argPtr1)
(toStatusIcon self)
statusIconIsEmbedded :: StatusIconClass self => self
-> IO Bool
statusIconIsEmbedded self =
liftM toBool $
(\(StatusIcon arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_is_embedded argPtr1)
(toStatusIcon self)
statusIconPositionMenu :: (MenuClass menu, StatusIconClass self) =>
menu
-> self
-> IO (Int,Int,Bool)
statusIconPositionMenu menu userData =
alloca $ \xPtr ->
alloca $ \yPtr ->
alloca $ \pushInPtr -> do
(\(Menu arg1) arg2 arg3 arg4 arg5 -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_position_menu argPtr1 arg2 arg3 arg4 arg5)
(toMenu menu)
xPtr
yPtr
pushInPtr
(castPtr . unsafeForeignPtrToPtr . unStatusIcon $ toStatusIcon userData)
x <- peek xPtr
y <- peek yPtr
pushIn <- peek pushInPtr
return (fromIntegral x, fromIntegral y, toBool pushIn)
statusIconGetGeometry :: StatusIconClass self => self -> IO (Maybe (Rectangle,Orientation))
statusIconGetGeometry self =
alloca $ \recPtr ->
alloca $ \orPtr ->
(liftM toBool $ (\(StatusIcon arg1) arg2 arg3 arg4 -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_get_geometry argPtr1 arg2 arg3 arg4)
(toStatusIcon self) nullPtr (castPtr recPtr) orPtr) >>= \b ->
if b
then do
rec_ <- peek recPtr
or <- peek orPtr
return $ Just (rec_,toEnum $ fromIntegral or)
else return Nothing
statusIconSetName :: StatusIconClass self => self -> String -> IO ()
statusIconSetName self name =
withUTFString name $ \ namePtr ->
(\(StatusIcon arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_set_name argPtr1 arg2)
(toStatusIcon self)
namePtr
statusIconPixbuf :: StatusIconClass self => Attr self Pixbuf
statusIconPixbuf = newAttrFromObjectProperty "pixbuf"
gdk_pixbuf_get_type
statusIconFile :: StatusIconClass self => WriteAttr self (Maybe String)
statusIconFile = writeAttrFromMaybeStringProperty "file"
statusIconStock :: StatusIconClass self => Attr self (Maybe String)
statusIconStock = newAttrFromMaybeStringProperty "stock"
statusIconIconName :: StatusIconClass self => Attr self (Maybe String)
statusIconIconName = newAttrFromMaybeStringProperty "icon-name"
statusIconStorageType :: StatusIconClass self => ReadAttr self ImageType
statusIconStorageType = readAttrFromEnumProperty "storage-type"
gtk_image_type_get_type
statusIconSize :: StatusIconClass self => ReadAttr self Int
statusIconSize = readAttrFromIntProperty "size"
statusIconBlinking :: StatusIconClass self => Attr self Bool
statusIconBlinking = newAttrFromBoolProperty "blinking"
statusIconVisible :: StatusIconClass self => Attr self Bool
statusIconVisible = newAttrFromBoolProperty "visible"
statusIconSizeChanged :: StatusIconClass self => Signal self (Int -> IO Bool)
statusIconSizeChanged = Signal (connect_INT__BOOL "size-changed")
statusIconActivate :: StatusIconClass self => Signal self (IO ())
statusIconActivate = Signal (connect_NONE__NONE "activate")
statusIconPopupMenu :: StatusIconClass self => Signal self (Maybe MouseButton -> TimeStamp -> IO ())
statusIconPopupMenu = Signal wrap
wrap flag self f = connect_WORD_WORD__NONE "popup_menu" flag self (\m t -> f (toMB m) (fromIntegral t))
where toMB 0 = Nothing
toMB n = Just . toEnum . fromIntegral $ n
onActivate :: StatusIconClass self => self
-> IO ()
-> IO (ConnectId self)
onActivate = connect_NONE__NONE "activate" False
afterActivate :: StatusIconClass self => self
-> IO ()
-> IO (ConnectId self)
afterActivate = connect_NONE__NONE "activate" True
onPopupMenu :: StatusIconClass self => self
-> (Maybe MouseButton -> TimeStamp -> IO ())
-> IO (ConnectId self)
onPopupMenu = wrap False
afterPopupMenu :: StatusIconClass self => self
-> (Maybe MouseButton -> TimeStamp -> IO ())
-> IO (ConnectId self)
afterPopupMenu = wrap True
onSizeChanged :: StatusIconClass self => self
-> (Int -> IO Bool)
-> IO (ConnectId self)
onSizeChanged = connect_INT__BOOL "size_changed" False
afterSizeChanged :: StatusIconClass self => self
-> (Int -> IO Bool)
-> IO (ConnectId self)
afterSizeChanged = connect_INT__BOOL "size_changed" True
foreign import ccall safe "gtk_status_icon_new"
gtk_status_icon_new :: (IO (Ptr StatusIcon))
foreign import ccall safe "gtk_status_icon_new_from_pixbuf"
gtk_status_icon_new_from_pixbuf :: ((Ptr Pixbuf) -> (IO (Ptr StatusIcon)))
foreign import ccall safe "gtk_status_icon_new_from_file"
gtk_status_icon_new_from_file :: ((Ptr CChar) -> (IO (Ptr StatusIcon)))
foreign import ccall safe "gtk_status_icon_new_from_stock"
gtk_status_icon_new_from_stock :: ((Ptr CChar) -> (IO (Ptr StatusIcon)))
foreign import ccall safe "gtk_status_icon_new_from_icon_name"
gtk_status_icon_new_from_icon_name :: ((Ptr CChar) -> (IO (Ptr StatusIcon)))
foreign import ccall safe "gtk_status_icon_set_from_pixbuf"
gtk_status_icon_set_from_pixbuf :: ((Ptr StatusIcon) -> ((Ptr Pixbuf) -> (IO ())))
foreign import ccall safe "gtk_status_icon_set_from_file"
gtk_status_icon_set_from_file :: ((Ptr StatusIcon) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "gtk_status_icon_set_from_stock"
gtk_status_icon_set_from_stock :: ((Ptr StatusIcon) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "gtk_status_icon_set_from_icon_name"
gtk_status_icon_set_from_icon_name :: ((Ptr StatusIcon) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "gtk_status_icon_get_storage_type"
gtk_status_icon_get_storage_type :: ((Ptr StatusIcon) -> (IO CInt))
foreign import ccall safe "gtk_status_icon_get_pixbuf"
gtk_status_icon_get_pixbuf :: ((Ptr StatusIcon) -> (IO (Ptr Pixbuf)))
foreign import ccall safe "gtk_status_icon_get_stock"
gtk_status_icon_get_stock :: ((Ptr StatusIcon) -> (IO (Ptr CChar)))
foreign import ccall safe "gtk_status_icon_get_icon_name"
gtk_status_icon_get_icon_name :: ((Ptr StatusIcon) -> (IO (Ptr CChar)))
foreign import ccall safe "gtk_status_icon_get_size"
gtk_status_icon_get_size :: ((Ptr StatusIcon) -> (IO CInt))
foreign import ccall safe "gtk_status_icon_set_tooltip"
gtk_status_icon_set_tooltip :: ((Ptr StatusIcon) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "gtk_status_icon_set_visible"
gtk_status_icon_set_visible :: ((Ptr StatusIcon) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_status_icon_get_visible"
gtk_status_icon_get_visible :: ((Ptr StatusIcon) -> (IO CInt))
foreign import ccall safe "gtk_status_icon_set_blinking"
gtk_status_icon_set_blinking :: ((Ptr StatusIcon) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_status_icon_get_blinking"
gtk_status_icon_get_blinking :: ((Ptr StatusIcon) -> (IO CInt))
foreign import ccall safe "gtk_status_icon_is_embedded"
gtk_status_icon_is_embedded :: ((Ptr StatusIcon) -> (IO CInt))
foreign import ccall safe "gtk_status_icon_position_menu"
gtk_status_icon_position_menu :: ((Ptr Menu) -> ((Ptr CInt) -> ((Ptr CInt) -> ((Ptr CInt) -> ((Ptr ()) -> (IO ()))))))
foreign import ccall safe "gtk_status_icon_get_geometry"
gtk_status_icon_get_geometry :: ((Ptr StatusIcon) -> ((Ptr Screen) -> ((Ptr ()) -> ((Ptr CInt) -> (IO CInt)))))
foreign import ccall safe "gtk_status_icon_set_name"
gtk_status_icon_set_name :: ((Ptr StatusIcon) -> ((Ptr CChar) -> (IO ())))
foreign import ccall unsafe "gdk_pixbuf_get_type"
gdk_pixbuf_get_type :: CUInt
foreign import ccall unsafe "gtk_image_type_get_type"
gtk_image_type_get_type :: CUInt