{- | 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.Interfaces.Scrollable ( -- * Exported types Scrollable(..) , noScrollable , ScrollableK , toScrollable , -- * Methods -- ** scrollableGetBorder scrollableGetBorder , -- ** scrollableGetHadjustment scrollableGetHadjustment , -- ** scrollableGetHscrollPolicy scrollableGetHscrollPolicy , -- ** scrollableGetVadjustment scrollableGetVadjustment , -- ** scrollableGetVscrollPolicy scrollableGetVscrollPolicy , -- ** scrollableSetHadjustment scrollableSetHadjustment , -- ** scrollableSetHscrollPolicy scrollableSetHscrollPolicy , -- ** scrollableSetVadjustment scrollableSetVadjustment , -- ** scrollableSetVscrollPolicy scrollableSetVscrollPolicy , -- * Properties -- ** Hadjustment ScrollableHadjustmentPropertyInfo , constructScrollableHadjustment , getScrollableHadjustment , setScrollableHadjustment , -- ** HscrollPolicy ScrollableHscrollPolicyPropertyInfo , constructScrollableHscrollPolicy , getScrollableHscrollPolicy , setScrollableHscrollPolicy , -- ** Vadjustment ScrollableVadjustmentPropertyInfo , constructScrollableVadjustment , getScrollableVadjustment , setScrollableVadjustment , -- ** VscrollPolicy ScrollableVscrollPolicyPropertyInfo , constructScrollableVscrollPolicy , getScrollableVscrollPolicy , setScrollableVscrollPolicy , ) 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 -- interface Scrollable newtype Scrollable = Scrollable (ForeignPtr Scrollable) noScrollable :: Maybe Scrollable noScrollable = Nothing -- VVV Prop "hadjustment" -- Type: TInterface "Gtk" "Adjustment" -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct] getScrollableHadjustment :: (MonadIO m, ScrollableK o) => o -> m Adjustment getScrollableHadjustment obj = liftIO $ getObjectPropertyObject obj "hadjustment" Adjustment setScrollableHadjustment :: (MonadIO m, ScrollableK o, AdjustmentK a) => o -> a -> m () setScrollableHadjustment obj val = liftIO $ setObjectPropertyObject obj "hadjustment" val constructScrollableHadjustment :: (AdjustmentK a) => a -> IO ([Char], GValue) constructScrollableHadjustment val = constructObjectPropertyObject "hadjustment" val data ScrollableHadjustmentPropertyInfo instance AttrInfo ScrollableHadjustmentPropertyInfo where type AttrAllowedOps ScrollableHadjustmentPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint ScrollableHadjustmentPropertyInfo = AdjustmentK type AttrBaseTypeConstraint ScrollableHadjustmentPropertyInfo = ScrollableK type AttrGetType ScrollableHadjustmentPropertyInfo = Adjustment type AttrLabel ScrollableHadjustmentPropertyInfo = "Scrollable::hadjustment" attrGet _ = getScrollableHadjustment attrSet _ = setScrollableHadjustment attrConstruct _ = constructScrollableHadjustment -- VVV Prop "hscroll-policy" -- Type: TInterface "Gtk" "ScrollablePolicy" -- Flags: [PropertyReadable,PropertyWritable] getScrollableHscrollPolicy :: (MonadIO m, ScrollableK o) => o -> m ScrollablePolicy getScrollableHscrollPolicy obj = liftIO $ getObjectPropertyEnum obj "hscroll-policy" setScrollableHscrollPolicy :: (MonadIO m, ScrollableK o) => o -> ScrollablePolicy -> m () setScrollableHscrollPolicy obj val = liftIO $ setObjectPropertyEnum obj "hscroll-policy" val constructScrollableHscrollPolicy :: ScrollablePolicy -> IO ([Char], GValue) constructScrollableHscrollPolicy val = constructObjectPropertyEnum "hscroll-policy" val data ScrollableHscrollPolicyPropertyInfo instance AttrInfo ScrollableHscrollPolicyPropertyInfo where type AttrAllowedOps ScrollableHscrollPolicyPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint ScrollableHscrollPolicyPropertyInfo = (~) ScrollablePolicy type AttrBaseTypeConstraint ScrollableHscrollPolicyPropertyInfo = ScrollableK type AttrGetType ScrollableHscrollPolicyPropertyInfo = ScrollablePolicy type AttrLabel ScrollableHscrollPolicyPropertyInfo = "Scrollable::hscroll-policy" attrGet _ = getScrollableHscrollPolicy attrSet _ = setScrollableHscrollPolicy attrConstruct _ = constructScrollableHscrollPolicy -- VVV Prop "vadjustment" -- Type: TInterface "Gtk" "Adjustment" -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct] getScrollableVadjustment :: (MonadIO m, ScrollableK o) => o -> m Adjustment getScrollableVadjustment obj = liftIO $ getObjectPropertyObject obj "vadjustment" Adjustment setScrollableVadjustment :: (MonadIO m, ScrollableK o, AdjustmentK a) => o -> a -> m () setScrollableVadjustment obj val = liftIO $ setObjectPropertyObject obj "vadjustment" val constructScrollableVadjustment :: (AdjustmentK a) => a -> IO ([Char], GValue) constructScrollableVadjustment val = constructObjectPropertyObject "vadjustment" val data ScrollableVadjustmentPropertyInfo instance AttrInfo ScrollableVadjustmentPropertyInfo where type AttrAllowedOps ScrollableVadjustmentPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint ScrollableVadjustmentPropertyInfo = AdjustmentK type AttrBaseTypeConstraint ScrollableVadjustmentPropertyInfo = ScrollableK type AttrGetType ScrollableVadjustmentPropertyInfo = Adjustment type AttrLabel ScrollableVadjustmentPropertyInfo = "Scrollable::vadjustment" attrGet _ = getScrollableVadjustment attrSet _ = setScrollableVadjustment attrConstruct _ = constructScrollableVadjustment -- VVV Prop "vscroll-policy" -- Type: TInterface "Gtk" "ScrollablePolicy" -- Flags: [PropertyReadable,PropertyWritable] getScrollableVscrollPolicy :: (MonadIO m, ScrollableK o) => o -> m ScrollablePolicy getScrollableVscrollPolicy obj = liftIO $ getObjectPropertyEnum obj "vscroll-policy" setScrollableVscrollPolicy :: (MonadIO m, ScrollableK o) => o -> ScrollablePolicy -> m () setScrollableVscrollPolicy obj val = liftIO $ setObjectPropertyEnum obj "vscroll-policy" val constructScrollableVscrollPolicy :: ScrollablePolicy -> IO ([Char], GValue) constructScrollableVscrollPolicy val = constructObjectPropertyEnum "vscroll-policy" val data ScrollableVscrollPolicyPropertyInfo instance AttrInfo ScrollableVscrollPolicyPropertyInfo where type AttrAllowedOps ScrollableVscrollPolicyPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint ScrollableVscrollPolicyPropertyInfo = (~) ScrollablePolicy type AttrBaseTypeConstraint ScrollableVscrollPolicyPropertyInfo = ScrollableK type AttrGetType ScrollableVscrollPolicyPropertyInfo = ScrollablePolicy type AttrLabel ScrollableVscrollPolicyPropertyInfo = "Scrollable::vscroll-policy" attrGet _ = getScrollableVscrollPolicy attrSet _ = setScrollableVscrollPolicy attrConstruct _ = constructScrollableVscrollPolicy type instance AttributeList Scrollable = ScrollableAttributeList type ScrollableAttributeList = ('[ '("hadjustment", ScrollableHadjustmentPropertyInfo), '("hscroll-policy", ScrollableHscrollPolicyPropertyInfo), '("vadjustment", ScrollableVadjustmentPropertyInfo), '("vscroll-policy", ScrollableVscrollPolicyPropertyInfo)] :: [(Symbol, *)]) type instance SignalList Scrollable = ScrollableSignalList type ScrollableSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)]) foreign import ccall "gtk_scrollable_get_type" c_gtk_scrollable_get_type :: IO GType type instance ParentTypes Scrollable = ScrollableParentTypes type ScrollableParentTypes = '[GObject.Object] instance GObject Scrollable where gobjectIsInitiallyUnowned _ = False gobjectType _ = c_gtk_scrollable_get_type class GObject o => ScrollableK o instance (GObject o, IsDescendantOf Scrollable o) => ScrollableK o toScrollable :: ScrollableK o => o -> IO Scrollable toScrollable = unsafeCastTo Scrollable -- method Scrollable::get_border -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Scrollable", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "border", argType = TInterface "Gtk" "Border", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Scrollable", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "border", argType = TInterface "Gtk" "Border", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "gtk_scrollable_get_border" gtk_scrollable_get_border :: Ptr Scrollable -> -- _obj : TInterface "Gtk" "Scrollable" Ptr Border -> -- border : TInterface "Gtk" "Border" IO CInt scrollableGetBorder :: (MonadIO m, ScrollableK a) => a -> -- _obj Border -> -- border m Bool scrollableGetBorder _obj border = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let border' = unsafeManagedPtrGetPtr border result <- gtk_scrollable_get_border _obj' border' let result' = (/= 0) result touchManagedPtr _obj touchManagedPtr border return result' -- method Scrollable::get_hadjustment -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Scrollable", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Scrollable", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gtk" "Adjustment" -- throws : False -- Skip return : False foreign import ccall "gtk_scrollable_get_hadjustment" gtk_scrollable_get_hadjustment :: Ptr Scrollable -> -- _obj : TInterface "Gtk" "Scrollable" IO (Ptr Adjustment) scrollableGetHadjustment :: (MonadIO m, ScrollableK a) => a -> -- _obj m Adjustment scrollableGetHadjustment _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- gtk_scrollable_get_hadjustment _obj' checkUnexpectedReturnNULL "gtk_scrollable_get_hadjustment" result result' <- (newObject Adjustment) result touchManagedPtr _obj return result' -- method Scrollable::get_hscroll_policy -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Scrollable", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Scrollable", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gtk" "ScrollablePolicy" -- throws : False -- Skip return : False foreign import ccall "gtk_scrollable_get_hscroll_policy" gtk_scrollable_get_hscroll_policy :: Ptr Scrollable -> -- _obj : TInterface "Gtk" "Scrollable" IO CUInt scrollableGetHscrollPolicy :: (MonadIO m, ScrollableK a) => a -> -- _obj m ScrollablePolicy scrollableGetHscrollPolicy _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- gtk_scrollable_get_hscroll_policy _obj' let result' = (toEnum . fromIntegral) result touchManagedPtr _obj return result' -- method Scrollable::get_vadjustment -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Scrollable", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Scrollable", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gtk" "Adjustment" -- throws : False -- Skip return : False foreign import ccall "gtk_scrollable_get_vadjustment" gtk_scrollable_get_vadjustment :: Ptr Scrollable -> -- _obj : TInterface "Gtk" "Scrollable" IO (Ptr Adjustment) scrollableGetVadjustment :: (MonadIO m, ScrollableK a) => a -> -- _obj m Adjustment scrollableGetVadjustment _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- gtk_scrollable_get_vadjustment _obj' checkUnexpectedReturnNULL "gtk_scrollable_get_vadjustment" result result' <- (newObject Adjustment) result touchManagedPtr _obj return result' -- method Scrollable::get_vscroll_policy -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Scrollable", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Scrollable", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gtk" "ScrollablePolicy" -- throws : False -- Skip return : False foreign import ccall "gtk_scrollable_get_vscroll_policy" gtk_scrollable_get_vscroll_policy :: Ptr Scrollable -> -- _obj : TInterface "Gtk" "Scrollable" IO CUInt scrollableGetVscrollPolicy :: (MonadIO m, ScrollableK a) => a -> -- _obj m ScrollablePolicy scrollableGetVscrollPolicy _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- gtk_scrollable_get_vscroll_policy _obj' let result' = (toEnum . fromIntegral) result touchManagedPtr _obj return result' -- method Scrollable::set_hadjustment -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Scrollable", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "hadjustment", argType = TInterface "Gtk" "Adjustment", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Scrollable", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "hadjustment", argType = TInterface "Gtk" "Adjustment", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "gtk_scrollable_set_hadjustment" gtk_scrollable_set_hadjustment :: Ptr Scrollable -> -- _obj : TInterface "Gtk" "Scrollable" Ptr Adjustment -> -- hadjustment : TInterface "Gtk" "Adjustment" IO () scrollableSetHadjustment :: (MonadIO m, ScrollableK a, AdjustmentK b) => a -> -- _obj Maybe (b) -> -- hadjustment m () scrollableSetHadjustment _obj hadjustment = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj maybeHadjustment <- case hadjustment of Nothing -> return nullPtr Just jHadjustment -> do let jHadjustment' = unsafeManagedPtrCastPtr jHadjustment return jHadjustment' gtk_scrollable_set_hadjustment _obj' maybeHadjustment touchManagedPtr _obj whenJust hadjustment touchManagedPtr return () -- method Scrollable::set_hscroll_policy -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Scrollable", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "policy", argType = TInterface "Gtk" "ScrollablePolicy", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Scrollable", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "policy", argType = TInterface "Gtk" "ScrollablePolicy", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "gtk_scrollable_set_hscroll_policy" gtk_scrollable_set_hscroll_policy :: Ptr Scrollable -> -- _obj : TInterface "Gtk" "Scrollable" CUInt -> -- policy : TInterface "Gtk" "ScrollablePolicy" IO () scrollableSetHscrollPolicy :: (MonadIO m, ScrollableK a) => a -> -- _obj ScrollablePolicy -> -- policy m () scrollableSetHscrollPolicy _obj policy = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let policy' = (fromIntegral . fromEnum) policy gtk_scrollable_set_hscroll_policy _obj' policy' touchManagedPtr _obj return () -- method Scrollable::set_vadjustment -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Scrollable", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "vadjustment", argType = TInterface "Gtk" "Adjustment", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Scrollable", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "vadjustment", argType = TInterface "Gtk" "Adjustment", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "gtk_scrollable_set_vadjustment" gtk_scrollable_set_vadjustment :: Ptr Scrollable -> -- _obj : TInterface "Gtk" "Scrollable" Ptr Adjustment -> -- vadjustment : TInterface "Gtk" "Adjustment" IO () scrollableSetVadjustment :: (MonadIO m, ScrollableK a, AdjustmentK b) => a -> -- _obj Maybe (b) -> -- vadjustment m () scrollableSetVadjustment _obj vadjustment = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj maybeVadjustment <- case vadjustment of Nothing -> return nullPtr Just jVadjustment -> do let jVadjustment' = unsafeManagedPtrCastPtr jVadjustment return jVadjustment' gtk_scrollable_set_vadjustment _obj' maybeVadjustment touchManagedPtr _obj whenJust vadjustment touchManagedPtr return () -- method Scrollable::set_vscroll_policy -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Scrollable", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "policy", argType = TInterface "Gtk" "ScrollablePolicy", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Scrollable", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "policy", argType = TInterface "Gtk" "ScrollablePolicy", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "gtk_scrollable_set_vscroll_policy" gtk_scrollable_set_vscroll_policy :: Ptr Scrollable -> -- _obj : TInterface "Gtk" "Scrollable" CUInt -> -- policy : TInterface "Gtk" "ScrollablePolicy" IO () scrollableSetVscrollPolicy :: (MonadIO m, ScrollableK a) => a -> -- _obj ScrollablePolicy -> -- policy m () scrollableSetVscrollPolicy _obj policy = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let policy' = (fromIntegral . fromEnum) policy gtk_scrollable_set_vscroll_policy _obj' policy' touchManagedPtr _obj return ()