{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) #AtkRange are used on #AtkValue, in order to represent the full range of a given component (for example an slider or a range control), or to define each individual subrange this full range is splitted if available. See #AtkValue documentation for further details. -} module GI.Atk.Structs.Range ( -- * Exported types Range(..) , noRange , -- * Methods -- ** rangeCopy rangeCopy , -- ** rangeFree rangeFree , -- ** rangeGetDescription rangeGetDescription , -- ** rangeGetLowerLimit rangeGetLowerLimit , -- ** rangeGetUpperLimit rangeGetUpperLimit , -- ** rangeNew rangeNew , ) 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.Atk.Types import GI.Atk.Callbacks newtype Range = Range (ForeignPtr Range) foreign import ccall "atk_range_get_type" c_atk_range_get_type :: IO GType instance BoxedObject Range where boxedType _ = c_atk_range_get_type noRange :: Maybe Range noRange = Nothing -- method Range::new -- method type : Constructor -- Args : [Arg {argName = "lower_limit", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "upper_limit", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "description", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "lower_limit", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "upper_limit", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "description", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Atk" "Range" -- throws : False -- Skip return : False foreign import ccall "atk_range_new" atk_range_new :: CDouble -> -- lower_limit : TBasicType TDouble CDouble -> -- upper_limit : TBasicType TDouble CString -> -- description : TBasicType TUTF8 IO (Ptr Range) rangeNew :: (MonadIO m) => Double -> -- lower_limit Double -> -- upper_limit T.Text -> -- description m Range rangeNew lower_limit upper_limit description = liftIO $ do let lower_limit' = realToFrac lower_limit let upper_limit' = realToFrac upper_limit description' <- textToCString description result <- atk_range_new lower_limit' upper_limit' description' checkUnexpectedReturnNULL "atk_range_new" result result' <- (wrapBoxed Range) result freeMem description' return result' -- method Range::copy -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "Range", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "Range", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Atk" "Range" -- throws : False -- Skip return : False foreign import ccall "atk_range_copy" atk_range_copy :: Ptr Range -> -- _obj : TInterface "Atk" "Range" IO (Ptr Range) rangeCopy :: (MonadIO m) => Range -> -- _obj m Range rangeCopy _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- atk_range_copy _obj' checkUnexpectedReturnNULL "atk_range_copy" result result' <- (wrapBoxed Range) result touchManagedPtr _obj return result' -- method Range::free -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "Range", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "Range", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "atk_range_free" atk_range_free :: Ptr Range -> -- _obj : TInterface "Atk" "Range" IO () rangeFree :: (MonadIO m) => Range -> -- _obj m () rangeFree _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj atk_range_free _obj' touchManagedPtr _obj return () -- method Range::get_description -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "Range", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "Range", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TUTF8 -- throws : False -- Skip return : False foreign import ccall "atk_range_get_description" atk_range_get_description :: Ptr Range -> -- _obj : TInterface "Atk" "Range" IO CString rangeGetDescription :: (MonadIO m) => Range -> -- _obj m T.Text rangeGetDescription _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- atk_range_get_description _obj' checkUnexpectedReturnNULL "atk_range_get_description" result result' <- cstringToText result touchManagedPtr _obj return result' -- method Range::get_lower_limit -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "Range", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "Range", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TDouble -- throws : False -- Skip return : False foreign import ccall "atk_range_get_lower_limit" atk_range_get_lower_limit :: Ptr Range -> -- _obj : TInterface "Atk" "Range" IO CDouble rangeGetLowerLimit :: (MonadIO m) => Range -> -- _obj m Double rangeGetLowerLimit _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- atk_range_get_lower_limit _obj' let result' = realToFrac result touchManagedPtr _obj return result' -- method Range::get_upper_limit -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "Range", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "Range", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TDouble -- throws : False -- Skip return : False foreign import ccall "atk_range_get_upper_limit" atk_range_get_upper_limit :: Ptr Range -> -- _obj : TInterface "Atk" "Range" IO CDouble rangeGetUpperLimit :: (MonadIO m) => Range -> -- _obj m Double rangeGetUpperLimit _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- atk_range_get_upper_limit _obj' let result' = realToFrac result touchManagedPtr _obj return result'