{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Atk.Structs.Range
(
Range(..) ,
#if defined(ENABLE_OVERLOADING)
ResolveRangeMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
RangeCopyMethodInfo ,
#endif
rangeCopy ,
#if defined(ENABLE_OVERLOADING)
RangeFreeMethodInfo ,
#endif
rangeFree ,
#if defined(ENABLE_OVERLOADING)
RangeGetDescriptionMethodInfo ,
#endif
rangeGetDescription ,
#if defined(ENABLE_OVERLOADING)
RangeGetLowerLimitMethodInfo ,
#endif
rangeGetLowerLimit ,
#if defined(ENABLE_OVERLOADING)
RangeGetUpperLimitMethodInfo ,
#endif
rangeGetUpperLimit ,
rangeNew ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
newtype Range = Range (SP.ManagedPtr Range)
deriving (Range -> Range -> Bool
(Range -> Range -> Bool) -> (Range -> Range -> Bool) -> Eq Range
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Range -> Range -> Bool
$c/= :: Range -> Range -> Bool
== :: Range -> Range -> Bool
$c== :: Range -> Range -> Bool
Eq)
instance SP.ManagedPtrNewtype Range where
toManagedPtr :: Range -> ManagedPtr Range
toManagedPtr (Range ManagedPtr Range
p) = ManagedPtr Range
p
foreign import ccall "atk_range_get_type" c_atk_range_get_type ::
IO GType
type instance O.ParentTypes Range = '[]
instance O.HasParentTypes Range
instance B.Types.TypedObject Range where
glibType :: IO GType
glibType = IO GType
c_atk_range_get_type
instance B.Types.GBoxed Range
instance B.GValue.IsGValue Range where
toGValue :: Range -> IO GValue
toGValue Range
o = do
GType
gtype <- IO GType
c_atk_range_get_type
Range -> (Ptr Range -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Range
o (GType -> (GValue -> Ptr Range -> IO ()) -> Ptr Range -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Range -> IO ()
forall a. GValue -> Ptr a -> IO ()
B.GValue.set_boxed)
fromGValue :: GValue -> IO Range
fromGValue GValue
gv = do
Ptr Range
ptr <- GValue -> IO (Ptr Range)
forall b. GValue -> IO (Ptr b)
B.GValue.get_boxed GValue
gv :: IO (Ptr Range)
(ManagedPtr Range -> Range) -> Ptr Range -> IO Range
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr Range -> Range
Range Ptr Range
ptr
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Range
type instance O.AttributeList Range = RangeAttributeList
type RangeAttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "atk_range_new" atk_range_new ::
CDouble ->
CDouble ->
CString ->
IO (Ptr Range)
rangeNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
Double
-> Double
-> T.Text
-> m Range
rangeNew :: Double -> Double -> Text -> m Range
rangeNew Double
lowerLimit Double
upperLimit Text
description = IO Range -> m Range
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Range -> m Range) -> IO Range -> m Range
forall a b. (a -> b) -> a -> b
$ do
let lowerLimit' :: CDouble
lowerLimit' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
lowerLimit
let upperLimit' :: CDouble
upperLimit' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
upperLimit
CString
description' <- Text -> IO CString
textToCString Text
description
Ptr Range
result <- CDouble -> CDouble -> CString -> IO (Ptr Range)
atk_range_new CDouble
lowerLimit' CDouble
upperLimit' CString
description'
Text -> Ptr Range -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"rangeNew" Ptr Range
result
Range
result' <- ((ManagedPtr Range -> Range) -> Ptr Range -> IO Range
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Range -> Range
Range) Ptr Range
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
description'
Range -> IO Range
forall (m :: * -> *) a. Monad m => a -> m a
return Range
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "atk_range_copy" atk_range_copy ::
Ptr Range ->
IO (Ptr Range)
rangeCopy ::
(B.CallStack.HasCallStack, MonadIO m) =>
Range
-> m Range
rangeCopy :: Range -> m Range
rangeCopy Range
src = IO Range -> m Range
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Range -> m Range) -> IO Range -> m Range
forall a b. (a -> b) -> a -> b
$ do
Ptr Range
src' <- Range -> IO (Ptr Range)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Range
src
Ptr Range
result <- Ptr Range -> IO (Ptr Range)
atk_range_copy Ptr Range
src'
Text -> Ptr Range -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"rangeCopy" Ptr Range
result
Range
result' <- ((ManagedPtr Range -> Range) -> Ptr Range -> IO Range
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Range -> Range
Range) Ptr Range
result
Range -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Range
src
Range -> IO Range
forall (m :: * -> *) a. Monad m => a -> m a
return Range
result'
#if defined(ENABLE_OVERLOADING)
data RangeCopyMethodInfo
instance (signature ~ (m Range), MonadIO m) => O.MethodInfo RangeCopyMethodInfo Range signature where
overloadedMethod = rangeCopy
#endif
foreign import ccall "atk_range_free" atk_range_free ::
Ptr Range ->
IO ()
rangeFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
Range
-> m ()
rangeFree :: Range -> m ()
rangeFree Range
range = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Range
range' <- Range -> IO (Ptr Range)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Range
range
Ptr Range -> IO ()
atk_range_free Ptr Range
range'
Range -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Range
range
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data RangeFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo RangeFreeMethodInfo Range signature where
overloadedMethod = rangeFree
#endif
foreign import ccall "atk_range_get_description" atk_range_get_description ::
Ptr Range ->
IO CString
rangeGetDescription ::
(B.CallStack.HasCallStack, MonadIO m) =>
Range
-> m T.Text
rangeGetDescription :: Range -> m Text
rangeGetDescription Range
range = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
Ptr Range
range' <- Range -> IO (Ptr Range)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Range
range
CString
result <- Ptr Range -> IO CString
atk_range_get_description Ptr Range
range'
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"rangeGetDescription" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
Range -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Range
range
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
#if defined(ENABLE_OVERLOADING)
data RangeGetDescriptionMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo RangeGetDescriptionMethodInfo Range signature where
overloadedMethod = rangeGetDescription
#endif
foreign import ccall "atk_range_get_lower_limit" atk_range_get_lower_limit ::
Ptr Range ->
IO CDouble
rangeGetLowerLimit ::
(B.CallStack.HasCallStack, MonadIO m) =>
Range
-> m Double
rangeGetLowerLimit :: Range -> m Double
rangeGetLowerLimit Range
range = IO Double -> m Double
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Double -> m Double) -> IO Double -> m Double
forall a b. (a -> b) -> a -> b
$ do
Ptr Range
range' <- Range -> IO (Ptr Range)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Range
range
CDouble
result <- Ptr Range -> IO CDouble
atk_range_get_lower_limit Ptr Range
range'
let result' :: Double
result' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
result
Range -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Range
range
Double -> IO Double
forall (m :: * -> *) a. Monad m => a -> m a
return Double
result'
#if defined(ENABLE_OVERLOADING)
data RangeGetLowerLimitMethodInfo
instance (signature ~ (m Double), MonadIO m) => O.MethodInfo RangeGetLowerLimitMethodInfo Range signature where
overloadedMethod = rangeGetLowerLimit
#endif
foreign import ccall "atk_range_get_upper_limit" atk_range_get_upper_limit ::
Ptr Range ->
IO CDouble
rangeGetUpperLimit ::
(B.CallStack.HasCallStack, MonadIO m) =>
Range
-> m Double
rangeGetUpperLimit :: Range -> m Double
rangeGetUpperLimit Range
range = IO Double -> m Double
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Double -> m Double) -> IO Double -> m Double
forall a b. (a -> b) -> a -> b
$ do
Ptr Range
range' <- Range -> IO (Ptr Range)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Range
range
CDouble
result <- Ptr Range -> IO CDouble
atk_range_get_upper_limit Ptr Range
range'
let result' :: Double
result' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
result
Range -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Range
range
Double -> IO Double
forall (m :: * -> *) a. Monad m => a -> m a
return Double
result'
#if defined(ENABLE_OVERLOADING)
data RangeGetUpperLimitMethodInfo
instance (signature ~ (m Double), MonadIO m) => O.MethodInfo RangeGetUpperLimitMethodInfo Range signature where
overloadedMethod = rangeGetUpperLimit
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveRangeMethod (t :: Symbol) (o :: *) :: * where
ResolveRangeMethod "copy" o = RangeCopyMethodInfo
ResolveRangeMethod "free" o = RangeFreeMethodInfo
ResolveRangeMethod "getDescription" o = RangeGetDescriptionMethodInfo
ResolveRangeMethod "getLowerLimit" o = RangeGetLowerLimitMethodInfo
ResolveRangeMethod "getUpperLimit" o = RangeGetUpperLimitMethodInfo
ResolveRangeMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveRangeMethod t Range, O.MethodInfo info Range p) => OL.IsLabel t (Range -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif