{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) -} module GI.Gtk.Objects.Tooltip ( -- * Exported types Tooltip(..) , TooltipK , toTooltip , noTooltip , -- * Methods -- ** tooltipSetCustom tooltipSetCustom , -- ** tooltipSetIcon tooltipSetIcon , -- ** tooltipSetIconFromGicon tooltipSetIconFromGicon , -- ** tooltipSetIconFromIconName tooltipSetIconFromIconName , -- ** tooltipSetIconFromStock tooltipSetIconFromStock , -- ** tooltipSetMarkup tooltipSetMarkup , -- ** tooltipSetText tooltipSetText , -- ** tooltipSetTipArea tooltipSetTipArea , -- ** tooltipTriggerTooltipQuery tooltipTriggerTooltipQuery , ) where import Prelude () import Data.GI.Base.ShortPrelude import qualified Data.Text as T import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import GI.Gtk.Types import GI.Gtk.Callbacks import qualified GI.GObject as GObject import qualified GI.Gdk as Gdk import qualified GI.GdkPixbuf as GdkPixbuf import qualified GI.Gio as Gio newtype Tooltip = Tooltip (ForeignPtr Tooltip) foreign import ccall "gtk_tooltip_get_type" c_gtk_tooltip_get_type :: IO GType type instance ParentTypes Tooltip = TooltipParentTypes type TooltipParentTypes = '[GObject.Object] instance GObject Tooltip where gobjectIsInitiallyUnowned _ = False gobjectType _ = c_gtk_tooltip_get_type class GObject o => TooltipK o instance (GObject o, IsDescendantOf Tooltip o) => TooltipK o toTooltip :: TooltipK o => o -> IO Tooltip toTooltip = unsafeCastTo Tooltip noTooltip :: Maybe Tooltip noTooltip = Nothing type instance AttributeList Tooltip = TooltipAttributeList type TooltipAttributeList = ('[ ] :: [(Symbol, *)]) type instance SignalList Tooltip = TooltipSignalList type TooltipSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)]) -- method Tooltip::set_custom -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Tooltip", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "custom_widget", argType = TInterface "Gtk" "Widget", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Tooltip", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "custom_widget", argType = TInterface "Gtk" "Widget", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "gtk_tooltip_set_custom" gtk_tooltip_set_custom :: Ptr Tooltip -> -- _obj : TInterface "Gtk" "Tooltip" Ptr Widget -> -- custom_widget : TInterface "Gtk" "Widget" IO () tooltipSetCustom :: (MonadIO m, TooltipK a, WidgetK b) => a -> -- _obj Maybe (b) -> -- custom_widget m () tooltipSetCustom _obj custom_widget = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj maybeCustom_widget <- case custom_widget of Nothing -> return nullPtr Just jCustom_widget -> do let jCustom_widget' = unsafeManagedPtrCastPtr jCustom_widget return jCustom_widget' gtk_tooltip_set_custom _obj' maybeCustom_widget touchManagedPtr _obj whenJust custom_widget touchManagedPtr return () -- method Tooltip::set_icon -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Tooltip", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "pixbuf", argType = TInterface "GdkPixbuf" "Pixbuf", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Tooltip", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "pixbuf", argType = TInterface "GdkPixbuf" "Pixbuf", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "gtk_tooltip_set_icon" gtk_tooltip_set_icon :: Ptr Tooltip -> -- _obj : TInterface "Gtk" "Tooltip" Ptr GdkPixbuf.Pixbuf -> -- pixbuf : TInterface "GdkPixbuf" "Pixbuf" IO () tooltipSetIcon :: (MonadIO m, TooltipK a, GdkPixbuf.PixbufK b) => a -> -- _obj Maybe (b) -> -- pixbuf m () tooltipSetIcon _obj pixbuf = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj maybePixbuf <- case pixbuf of Nothing -> return nullPtr Just jPixbuf -> do let jPixbuf' = unsafeManagedPtrCastPtr jPixbuf return jPixbuf' gtk_tooltip_set_icon _obj' maybePixbuf touchManagedPtr _obj whenJust pixbuf touchManagedPtr return () -- method Tooltip::set_icon_from_gicon -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Tooltip", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "gicon", argType = TInterface "Gio" "Icon", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "size", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Tooltip", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "gicon", argType = TInterface "Gio" "Icon", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "size", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "gtk_tooltip_set_icon_from_gicon" gtk_tooltip_set_icon_from_gicon :: Ptr Tooltip -> -- _obj : TInterface "Gtk" "Tooltip" Ptr Gio.Icon -> -- gicon : TInterface "Gio" "Icon" Int32 -> -- size : TBasicType TInt32 IO () tooltipSetIconFromGicon :: (MonadIO m, TooltipK a, Gio.IconK b) => a -> -- _obj Maybe (b) -> -- gicon Int32 -> -- size m () tooltipSetIconFromGicon _obj gicon size = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj maybeGicon <- case gicon of Nothing -> return nullPtr Just jGicon -> do let jGicon' = unsafeManagedPtrCastPtr jGicon return jGicon' gtk_tooltip_set_icon_from_gicon _obj' maybeGicon size touchManagedPtr _obj whenJust gicon touchManagedPtr return () -- method Tooltip::set_icon_from_icon_name -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Tooltip", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "size", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Tooltip", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "size", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "gtk_tooltip_set_icon_from_icon_name" gtk_tooltip_set_icon_from_icon_name :: Ptr Tooltip -> -- _obj : TInterface "Gtk" "Tooltip" CString -> -- icon_name : TBasicType TUTF8 Int32 -> -- size : TBasicType TInt32 IO () tooltipSetIconFromIconName :: (MonadIO m, TooltipK a) => a -> -- _obj Maybe (T.Text) -> -- icon_name Int32 -> -- size m () tooltipSetIconFromIconName _obj icon_name size = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj maybeIcon_name <- case icon_name of Nothing -> return nullPtr Just jIcon_name -> do jIcon_name' <- textToCString jIcon_name return jIcon_name' gtk_tooltip_set_icon_from_icon_name _obj' maybeIcon_name size touchManagedPtr _obj freeMem maybeIcon_name return () -- method Tooltip::set_icon_from_stock -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Tooltip", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "stock_id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "size", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Tooltip", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "stock_id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "size", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "gtk_tooltip_set_icon_from_stock" gtk_tooltip_set_icon_from_stock :: Ptr Tooltip -> -- _obj : TInterface "Gtk" "Tooltip" CString -> -- stock_id : TBasicType TUTF8 Int32 -> -- size : TBasicType TInt32 IO () {-# DEPRECATED tooltipSetIconFromStock ["(Since version 3.10)","Use gtk_tooltip_set_icon_from_icon_name() instead."]#-} tooltipSetIconFromStock :: (MonadIO m, TooltipK a) => a -> -- _obj Maybe (T.Text) -> -- stock_id Int32 -> -- size m () tooltipSetIconFromStock _obj stock_id size = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj maybeStock_id <- case stock_id of Nothing -> return nullPtr Just jStock_id -> do jStock_id' <- textToCString jStock_id return jStock_id' gtk_tooltip_set_icon_from_stock _obj' maybeStock_id size touchManagedPtr _obj freeMem maybeStock_id return () -- method Tooltip::set_markup -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Tooltip", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "markup", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Tooltip", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "markup", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "gtk_tooltip_set_markup" gtk_tooltip_set_markup :: Ptr Tooltip -> -- _obj : TInterface "Gtk" "Tooltip" CString -> -- markup : TBasicType TUTF8 IO () tooltipSetMarkup :: (MonadIO m, TooltipK a) => a -> -- _obj Maybe (T.Text) -> -- markup m () tooltipSetMarkup _obj markup = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj maybeMarkup <- case markup of Nothing -> return nullPtr Just jMarkup -> do jMarkup' <- textToCString jMarkup return jMarkup' gtk_tooltip_set_markup _obj' maybeMarkup touchManagedPtr _obj freeMem maybeMarkup return () -- method Tooltip::set_text -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Tooltip", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "text", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Tooltip", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "text", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "gtk_tooltip_set_text" gtk_tooltip_set_text :: Ptr Tooltip -> -- _obj : TInterface "Gtk" "Tooltip" CString -> -- text : TBasicType TUTF8 IO () tooltipSetText :: (MonadIO m, TooltipK a) => a -> -- _obj Maybe (T.Text) -> -- text m () tooltipSetText _obj text = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj maybeText <- case text of Nothing -> return nullPtr Just jText -> do jText' <- textToCString jText return jText' gtk_tooltip_set_text _obj' maybeText touchManagedPtr _obj freeMem maybeText return () -- method Tooltip::set_tip_area -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Tooltip", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rect", argType = TInterface "Gdk" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Tooltip", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rect", argType = TInterface "Gdk" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "gtk_tooltip_set_tip_area" gtk_tooltip_set_tip_area :: Ptr Tooltip -> -- _obj : TInterface "Gtk" "Tooltip" Ptr Gdk.Rectangle -> -- rect : TInterface "Gdk" "Rectangle" IO () tooltipSetTipArea :: (MonadIO m, TooltipK a) => a -> -- _obj Gdk.Rectangle -> -- rect m () tooltipSetTipArea _obj rect = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let rect' = unsafeManagedPtrGetPtr rect gtk_tooltip_set_tip_area _obj' rect' touchManagedPtr _obj touchManagedPtr rect return () -- method Tooltip::trigger_tooltip_query -- method type : MemberFunction -- Args : [Arg {argName = "display", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "display", argType = TInterface "Gdk" "Display", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "gtk_tooltip_trigger_tooltip_query" gtk_tooltip_trigger_tooltip_query :: Ptr Gdk.Display -> -- display : TInterface "Gdk" "Display" IO () tooltipTriggerTooltipQuery :: (MonadIO m, Gdk.DisplayK a) => a -> -- display m () tooltipTriggerTooltipQuery display = liftIO $ do let display' = unsafeManagedPtrCastPtr display gtk_tooltip_trigger_tooltip_query display' touchManagedPtr display return ()