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,
statusIconSetVisible,
statusIconGetVisible,
statusIconIsEmbedded,
statusIconPositionMenu,
statusIconGetGeometry,
statusIconSetScreen,
statusIconGetScreen,
statusIconSetTooltipText,
statusIconGetTooltipText,
statusIconSetTooltipMarkup,
statusIconGetTooltipMarkup,
statusIconSetHasTooltip,
statusIconGetHasTooltip,
statusIconSetTitle,
statusIconGetTitle,
statusIconSetName,
statusIconPixbuf,
statusIconFile,
statusIconStock,
statusIconIconName,
statusIconStorageType,
statusIconSize,
statusIconVisible,
statusIconScreen,
statusIconTooltipText,
statusIconTooltipMarkup,
statusIconHasTooltip,
statusIconTitle,
statusIconSizeChanged,
statusIconActivated,
statusIconActivate,
statusIconPopupMenu,
) where
import Control.Monad (liftM)
import System.Glib.FFI
import System.Glib.UTFString
import System.Glib.Attributes
import System.Glib.Properties
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 :: GlibString string
=> 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 :: GlibString string
=> 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, GlibString string) => 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, GlibString string) => 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, GlibString string) => 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)
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)
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
statusIconSetScreen :: (StatusIconClass self, ScreenClass screen) => self
-> Maybe screen
-> IO ()
statusIconSetScreen self screen =
(\(StatusIcon arg1) (Screen arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_status_icon_set_screen argPtr1 argPtr2)
(toStatusIcon self)
(maybe (Screen nullForeignPtr) toScreen screen)
statusIconGetScreen :: StatusIconClass self => self
-> IO (Maybe Screen)
statusIconGetScreen self =
maybeNull (makeNewGObject mkScreen) $
(\(StatusIcon arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_get_screen argPtr1)
(toStatusIcon self)
statusIconSetTooltipText :: (StatusIconClass self, GlibString string) => self
-> Maybe string
-> IO ()
statusIconSetTooltipText self text =
maybeWith withUTFString text $ \textPtr ->
(\(StatusIcon arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_set_tooltip_text argPtr1 arg2)
(toStatusIcon self)
textPtr
statusIconGetTooltipText :: (StatusIconClass self, GlibString string) => self
-> IO (Maybe string)
statusIconGetTooltipText self =
(\(StatusIcon arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_get_tooltip_text argPtr1)
(toStatusIcon self)
>>= maybePeek peekUTFString
statusIconSetTooltipMarkup :: (StatusIconClass self, GlibString string) => self
-> Maybe string
-> IO ()
statusIconSetTooltipMarkup self markup =
maybeWith withUTFString markup $ \markupPtr ->
(\(StatusIcon arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_set_tooltip_markup argPtr1 arg2)
(toStatusIcon self)
markupPtr
statusIconGetTooltipMarkup :: (StatusIconClass self, GlibString string) => self
-> IO (Maybe string)
statusIconGetTooltipMarkup self =
(\(StatusIcon arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_get_tooltip_markup argPtr1)
(toStatusIcon self)
>>= maybePeek peekUTFString
statusIconSetHasTooltip :: StatusIconClass self => self
-> Bool
-> IO ()
statusIconSetHasTooltip self hasTooltip =
(\(StatusIcon arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_set_has_tooltip argPtr1 arg2)
(toStatusIcon self)
(fromBool hasTooltip)
statusIconGetHasTooltip :: StatusIconClass self => self
-> IO Bool
statusIconGetHasTooltip self =
liftM toBool $
(\(StatusIcon arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_get_has_tooltip argPtr1)
(toStatusIcon self)
statusIconSetTitle :: (StatusIconClass self, GlibString string) => self
-> Maybe string
-> IO ()
statusIconSetTitle self title =
maybeWith withUTFString title $ \titlePtr ->
(\(StatusIcon arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_set_title argPtr1 arg2)
(toStatusIcon self)
titlePtr
statusIconGetTitle :: (StatusIconClass self, GlibString string) => self
-> IO (Maybe string)
statusIconGetTitle self =
(\(StatusIcon arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_status_icon_get_title argPtr1)
(toStatusIcon self)
>>= maybePeek peekUTFString
statusIconSetName :: (StatusIconClass self, GlibString string) => 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, GlibString string) => WriteAttr self (Maybe string)
statusIconFile = writeAttrFromMaybeStringProperty "file"
statusIconStock :: (StatusIconClass self, GlibString string) => Attr self (Maybe string)
statusIconStock = newAttrFromMaybeStringProperty "stock"
statusIconIconName :: (StatusIconClass self, GlibString string) => 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"
statusIconVisible :: StatusIconClass self => Attr self Bool
statusIconVisible = newAttrFromBoolProperty "visible"
statusIconScreen :: StatusIconClass self => Attr self Screen
statusIconScreen = newAttrFromObjectProperty "screen"
gdk_screen_get_type
statusIconTooltipText :: (StatusIconClass self, GlibString string) => Attr self (Maybe string)
statusIconTooltipText = newAttrFromMaybeStringProperty "tooltip-text"
statusIconTooltipMarkup :: (StatusIconClass self, GlibString string) => Attr self (Maybe string)
statusIconTooltipMarkup = newAttrFromMaybeStringProperty "tooltip-markup"
statusIconHasTooltip :: StatusIconClass self => Attr self Bool
statusIconHasTooltip = newAttrFromBoolProperty "has-tooltip"
statusIconTitle :: (StatusIconClass self, GlibString string) => Attr self (Maybe string)
statusIconTitle = newAttrFromMaybeStringProperty "title"
statusIconSizeChanged :: StatusIconClass self => Signal self (Int -> IO Bool)
statusIconSizeChanged = Signal (connect_INT__BOOL "size-changed")
statusIconActivated :: StatusIconClass self => Signal self (IO ())
statusIconActivated = Signal (connect_NONE__NONE "activate")
statusIconActivate :: StatusIconClass self => Signal self (IO ())
statusIconActivate = statusIconActivated
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
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_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_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_screen"
gtk_status_icon_set_screen :: ((Ptr StatusIcon) -> ((Ptr Screen) -> (IO ())))
foreign import ccall safe "gtk_status_icon_get_screen"
gtk_status_icon_get_screen :: ((Ptr StatusIcon) -> (IO (Ptr Screen)))
foreign import ccall safe "gtk_status_icon_set_tooltip_text"
gtk_status_icon_set_tooltip_text :: ((Ptr StatusIcon) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "gtk_status_icon_get_tooltip_text"
gtk_status_icon_get_tooltip_text :: ((Ptr StatusIcon) -> (IO (Ptr CChar)))
foreign import ccall safe "gtk_status_icon_set_tooltip_markup"
gtk_status_icon_set_tooltip_markup :: ((Ptr StatusIcon) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "gtk_status_icon_get_tooltip_markup"
gtk_status_icon_get_tooltip_markup :: ((Ptr StatusIcon) -> (IO (Ptr CChar)))
foreign import ccall safe "gtk_status_icon_set_has_tooltip"
gtk_status_icon_set_has_tooltip :: ((Ptr StatusIcon) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_status_icon_get_has_tooltip"
gtk_status_icon_get_has_tooltip :: ((Ptr StatusIcon) -> (IO CInt))
foreign import ccall safe "gtk_status_icon_set_title"
gtk_status_icon_set_title :: ((Ptr StatusIcon) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "gtk_status_icon_get_title"
gtk_status_icon_get_title :: ((Ptr StatusIcon) -> (IO (Ptr CChar)))
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 :: CULong
foreign import ccall unsafe "gtk_image_type_get_type"
gtk_image_type_get_type :: CULong
foreign import ccall unsafe "gdk_screen_get_type"
gdk_screen_get_type :: CULong