-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Handy.Functions
    ( 

 -- * Methods


-- ** easeOutCubic #method:easeOutCubic#

    easeOutCubic                            ,


-- ** enumValueRowName #method:enumValueRowName#

    enumValueRowName                        ,


-- ** getEnableAnimations #method:getEnableAnimations#

    getEnableAnimations                     ,


-- ** init #method:init#

    init                                    ,


-- ** listBoxSeparatorHeader #method:listBoxSeparatorHeader#

    listBoxSeparatorHeader                  ,


-- ** stringUtf8Len #method:stringUtf8Len#

    stringUtf8Len                           ,


-- ** stringUtf8Truncate #method:stringUtf8Truncate#

    stringUtf8Truncate                      ,




    ) 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.GArray as B.GArray
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
import qualified GHC.Records as R

import qualified GI.GLib.Structs.String as GLib.String
import qualified GI.Gtk.Objects.ListBoxRow as Gtk.ListBoxRow
import qualified GI.Gtk.Objects.Widget as Gtk.Widget
import {-# SOURCE #-} qualified GI.Handy.Objects.EnumValueObject as Handy.EnumValueObject

-- function string_utf8_truncate
-- Args: [ Arg
--           { argCName = "string"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "String" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GString" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the new size of the string"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "GLib" , name = "String" })
-- throws : False
-- Skip return : False

foreign import ccall "hdy_string_utf8_truncate" hdy_string_utf8_truncate :: 
    Ptr GLib.String.String ->               -- string : TInterface (Name {namespace = "GLib", name = "String"})
    Word64 ->                               -- len : TBasicType TUInt64
    IO (Ptr GLib.String.String)

-- | Cut of the end of the string /@string@/ so that /@len@/ utf8 characters remain.
stringUtf8Truncate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.String.String
    -- ^ /@string@/: a t'GI.GLib.Structs.String.String'
    -> Word64
    -- ^ /@len@/: the new size of the string
    -> m GLib.String.String
    -- ^ __Returns:__ /@string@/
stringUtf8Truncate :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
String -> Word64 -> m String
stringUtf8Truncate String
string Word64
len = IO String -> m String
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO String -> m String) -> IO String -> m String
forall a b. (a -> b) -> a -> b
$ do
    Ptr String
string' <- String -> IO (Ptr String)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr String
string
    Ptr String
result <- Ptr String -> Word64 -> IO (Ptr String)
hdy_string_utf8_truncate Ptr String
string' Word64
len
    Text -> Ptr String -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"stringUtf8Truncate" Ptr String
result
    String
result' <- ((ManagedPtr String -> String) -> Ptr String -> IO String
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr String -> String
GLib.String.String) Ptr String
result
    String -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr String
string
    String -> IO String
forall (m :: * -> *) a. Monad m => a -> m a
return String
result'


-- function string_utf8_len
-- Args: [ Arg
--           { argCName = "string"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "String" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GString" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TLong)
-- throws : False
-- Skip return : False

foreign import ccall "hdy_string_utf8_len" hdy_string_utf8_len :: 
    Ptr GLib.String.String ->               -- string : TInterface (Name {namespace = "GLib", name = "String"})
    IO CLong

-- | Computes the length of the string in utf-8 characters. See @/g_utf8_strlen/@.
stringUtf8Len ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.String.String
    -- ^ /@string@/: a t'GI.GLib.Structs.String.String'
    -> m CLong
    -- ^ __Returns:__ the length of /@string@/ in characters
stringUtf8Len :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
String -> m CLong
stringUtf8Len String
string = IO CLong -> m CLong
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO CLong -> m CLong) -> IO CLong -> m CLong
forall a b. (a -> b) -> a -> b
$ do
    Ptr String
string' <- String -> IO (Ptr String)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr String
string
    CLong
result <- Ptr String -> IO CLong
hdy_string_utf8_len Ptr String
string'
    String -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr String
string
    CLong -> IO CLong
forall (m :: * -> *) a. Monad m => a -> m a
return CLong
result


-- function list_box_separator_header
-- Args: [ Arg
--           { argCName = "row"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "ListBoxRow" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the row to update" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "before"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "ListBoxRow" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the row before @row, or %NULL if it is first"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "unused_user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "unused user data" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "hdy_list_box_separator_header" hdy_list_box_separator_header :: 
    Ptr Gtk.ListBoxRow.ListBoxRow ->        -- row : TInterface (Name {namespace = "Gtk", name = "ListBoxRow"})
    Ptr Gtk.ListBoxRow.ListBoxRow ->        -- before : TInterface (Name {namespace = "Gtk", name = "ListBoxRow"})
    Ptr () ->                               -- unused_user_data : TBasicType TPtr
    IO ()

-- | Separates rows by using t'GI.Gtk.Objects.Separator.Separator' as headers. The first row doesn\'t have
-- a separator as there is no row above it.
-- 
-- /Since: 0.0.6/
listBoxSeparatorHeader ::
    (B.CallStack.HasCallStack, MonadIO m, Gtk.ListBoxRow.IsListBoxRow a, Gtk.ListBoxRow.IsListBoxRow b) =>
    a
    -- ^ /@row@/: the row to update
    -> Maybe (b)
    -- ^ /@before@/: the row before /@row@/, or 'P.Nothing' if it is first
    -> Ptr ()
    -- ^ /@unusedUserData@/: unused user data
    -> m ()
listBoxSeparatorHeader :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsListBoxRow a, IsListBoxRow b) =>
a -> Maybe b -> Ptr () -> m ()
listBoxSeparatorHeader a
row Maybe b
before Ptr ()
unusedUserData = 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 ListBoxRow
row' <- a -> IO (Ptr ListBoxRow)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
row
    Ptr ListBoxRow
maybeBefore <- case Maybe b
before of
        Maybe b
Nothing -> Ptr ListBoxRow -> IO (Ptr ListBoxRow)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ListBoxRow
forall a. Ptr a
nullPtr
        Just b
jBefore -> do
            Ptr ListBoxRow
jBefore' <- b -> IO (Ptr ListBoxRow)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jBefore
            Ptr ListBoxRow -> IO (Ptr ListBoxRow)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ListBoxRow
jBefore'
    Ptr ListBoxRow -> Ptr ListBoxRow -> Ptr () -> IO ()
hdy_list_box_separator_header Ptr ListBoxRow
row' Ptr ListBoxRow
maybeBefore Ptr ()
unusedUserData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
row
    Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
before b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function init
-- Args: [ Arg
--           { argCName = "argc"
--           , argType = TBasicType TInt
--           , direction = DirectionInout
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Address of the <parameter>argc</parameter>\n    parameter of your main() function (or 0 if @argv is %NULL). This will be\n    changed if any arguments were handled."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "argv"
--           , argType = TCArray False (-1) 0 (TBasicType TUTF8)
--           , direction = DirectionInout
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "\n    Address of the <parameter>argv</parameter> parameter of main(), or %NULL.\n    Any options understood by Handy are stripped before return."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "argc"
--              , argType = TBasicType TInt
--              , direction = DirectionInout
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just
--                          "Address of the <parameter>argc</parameter>\n    parameter of your main() function (or 0 if @argv is %NULL). This will be\n    changed if any arguments were handled."
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "hdy_init" hdy_init :: 
    Ptr Int32 ->                            -- argc : TBasicType TInt
    Ptr (Ptr CString) ->                    -- argv : TCArray False (-1) 0 (TBasicType TUTF8)
    IO CInt

-- | Call this function before using any other Handy functions in your
-- GUI applications. If libhandy has already been initialized, the function will
-- simply return without processing the new arguments.
init ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Maybe ([T.Text])
    -- ^ /@argv@/: 
    --     Address of the \<parameter>argv\<\/parameter> parameter of @/main()/@, or 'P.Nothing'.
    --     Any options understood by Handy are stripped before return.
    -> m ((Bool, Maybe [T.Text]))
    -- ^ __Returns:__ 'P.True' if initialization was successful, 'P.False' otherwise.
init :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Maybe [Text] -> m (Bool, Maybe [Text])
init Maybe [Text]
argv = IO (Bool, Maybe [Text]) -> m (Bool, Maybe [Text])
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, Maybe [Text]) -> m (Bool, Maybe [Text]))
-> IO (Bool, Maybe [Text]) -> m (Bool, Maybe [Text])
forall a b. (a -> b) -> a -> b
$ do
    let argc :: Int32
argc = case Maybe [Text]
argv of
            Maybe [Text]
Nothing -> Int32
0
            Just [Text]
jArgv -> Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [Text] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [Text]
jArgv
    Ptr Int32
argc' <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
    Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr Int32
argc' Int32
argc
    Ptr CString
maybeArgv <- case Maybe [Text]
argv of
        Maybe [Text]
Nothing -> Ptr CString -> IO (Ptr CString)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CString
forall a. Ptr a
nullPtr
        Just [Text]
jArgv -> do
            Ptr CString
jArgv' <- [Text] -> IO (Ptr CString)
packUTF8CArray [Text]
jArgv
            Ptr CString -> IO (Ptr CString)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CString
jArgv'
    Ptr (Ptr CString)
maybeArgv' <- IO (Ptr (Ptr CString))
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr (Ptr CString))
    Ptr (Ptr CString) -> Ptr CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (Ptr CString)
maybeArgv' Ptr CString
maybeArgv
    CInt
result <- Ptr Int32 -> Ptr (Ptr CString) -> IO CInt
hdy_init Ptr Int32
argc' Ptr (Ptr CString)
maybeArgv'
    Int32
argc'' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
argc'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Ptr CString
maybeArgv'' <- Ptr (Ptr CString) -> IO (Ptr CString)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr CString)
maybeArgv'
    Maybe [Text]
maybeMaybeArgv'' <- Ptr CString -> (Ptr CString -> IO [Text]) -> IO (Maybe [Text])
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr CString
maybeArgv'' ((Ptr CString -> IO [Text]) -> IO (Maybe [Text]))
-> (Ptr CString -> IO [Text]) -> IO (Maybe [Text])
forall a b. (a -> b) -> a -> b
$ \Ptr CString
maybeArgv''' -> do
        [Text]
maybeArgv'''' <- (Int32 -> Ptr CString -> IO [Text]
forall a.
(HasCallStack, Integral a) =>
a -> Ptr CString -> IO [Text]
unpackUTF8CArrayWithLength Int32
argc'') Ptr CString
maybeArgv'''
        [Text] -> IO [Text]
forall (m :: * -> *) a. Monad m => a -> m a
return [Text]
maybeArgv''''
    Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
argc'
    Ptr (Ptr CString) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr CString)
maybeArgv'
    (Bool, Maybe [Text]) -> IO (Bool, Maybe [Text])
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', Maybe [Text]
maybeMaybeArgv'')


-- function get_enable_animations
-- Args: [ Arg
--           { argCName = "widget"
--           , argType = TInterface Name { namespace = "Gtk" , name = "Widget" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkWidget" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "hdy_get_enable_animations" hdy_get_enable_animations :: 
    Ptr Gtk.Widget.Widget ->                -- widget : TInterface (Name {namespace = "Gtk", name = "Widget"})
    IO CInt

-- | Returns whether animations are enabled for that widget. This should be used
-- when implementing an animated widget to know whether to animate it or not.
-- 
-- /Since: 0.0.11/
getEnableAnimations ::
    (B.CallStack.HasCallStack, MonadIO m, Gtk.Widget.IsWidget a) =>
    a
    -- ^ /@widget@/: a t'GI.Gtk.Objects.Widget.Widget'
    -> m Bool
    -- ^ __Returns:__ 'P.True' if animations are enabled for /@widget@/.
getEnableAnimations :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsWidget a) =>
a -> m Bool
getEnableAnimations a
widget = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Widget
widget' <- a -> IO (Ptr Widget)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
widget
    CInt
result <- Ptr Widget -> IO CInt
hdy_get_enable_animations Ptr Widget
widget'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
widget
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function enum_value_row_name
-- Args: [ Arg
--           { argCName = "value"
--           , argType =
--               TInterface Name { namespace = "Handy" , name = "EnumValueObject" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the value from the enum from which to get a name"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "unused user data" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "hdy_enum_value_row_name" hdy_enum_value_row_name :: 
    Ptr Handy.EnumValueObject.EnumValueObject -> -- value : TInterface (Name {namespace = "Handy", name = "EnumValueObject"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO CString

-- | This is a default implementation of t'GI.Handy.Callbacks.ComboRowGetEnumValueNameFunc' to be
-- used with 'GI.Handy.Objects.ComboRow.comboRowSetForEnum'. If the enumeration has a nickname, it
-- will return it, otherwise it will return its name.
-- 
-- /Since: 0.0.6/
enumValueRowName ::
    (B.CallStack.HasCallStack, MonadIO m, Handy.EnumValueObject.IsEnumValueObject a) =>
    a
    -- ^ /@value@/: the value from the enum from which to get a name
    -> Ptr ()
    -- ^ /@userData@/: unused user data
    -> m T.Text
    -- ^ __Returns:__ a newly allocated displayable name that represents /@value@/
enumValueRowName :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsEnumValueObject a) =>
a -> Ptr () -> m Text
enumValueRowName a
value Ptr ()
userData = 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 EnumValueObject
value' <- a -> IO (Ptr EnumValueObject)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
value
    CString
result <- Ptr EnumValueObject -> Ptr () -> IO CString
hdy_enum_value_row_name Ptr EnumValueObject
value' Ptr ()
userData
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"enumValueRowName" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
value
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function ease_out_cubic
-- Args: [ Arg
--           { argCName = "t"
--           , argType = TBasicType TDouble
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the term" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TDouble)
-- throws : False
-- Skip return : False

foreign import ccall "hdy_ease_out_cubic" hdy_ease_out_cubic :: 
    CDouble ->                              -- t : TBasicType TDouble
    IO CDouble

-- | Computes the ease out for /@t@/.
-- 
-- /Since: 0.0.11/
easeOutCubic ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Double
    -- ^ /@t@/: the term
    -> m Double
    -- ^ __Returns:__ the ease out for /@t@/.
easeOutCubic :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Double -> m Double
easeOutCubic Double
t = 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
    let t' :: CDouble
t' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
t
    CDouble
result <- CDouble -> IO CDouble
hdy_ease_out_cubic CDouble
t'
    let result' :: Double
result' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
result
    Double -> IO Double
forall (m :: * -> *) a. Monad m => a -> m a
return Double
result'