{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

A 'GI.Pango.Structs.LayoutIter.LayoutIter' structure can be used to
iterate over the visual extents of a 'GI.Pango.Objects.Layout.Layout'.

The 'GI.Pango.Structs.LayoutIter.LayoutIter' structure is opaque, and
has no user-visible fields.
-}

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

module GI.Pango.Structs.LayoutIter
    (

-- * Exported types
    LayoutIter(..)                          ,
    noLayoutIter                            ,


 -- * Methods
-- ** atLastLine #method:atLastLine#

#if ENABLE_OVERLOADING
    LayoutIterAtLastLineMethodInfo          ,
#endif
    layoutIterAtLastLine                    ,


-- ** copy #method:copy#

#if ENABLE_OVERLOADING
    LayoutIterCopyMethodInfo                ,
#endif
    layoutIterCopy                          ,


-- ** free #method:free#

#if ENABLE_OVERLOADING
    LayoutIterFreeMethodInfo                ,
#endif
    layoutIterFree                          ,


-- ** getBaseline #method:getBaseline#

#if ENABLE_OVERLOADING
    LayoutIterGetBaselineMethodInfo         ,
#endif
    layoutIterGetBaseline                   ,


-- ** getCharExtents #method:getCharExtents#

#if ENABLE_OVERLOADING
    LayoutIterGetCharExtentsMethodInfo      ,
#endif
    layoutIterGetCharExtents                ,


-- ** getClusterExtents #method:getClusterExtents#

#if ENABLE_OVERLOADING
    LayoutIterGetClusterExtentsMethodInfo   ,
#endif
    layoutIterGetClusterExtents             ,


-- ** getIndex #method:getIndex#

#if ENABLE_OVERLOADING
    LayoutIterGetIndexMethodInfo            ,
#endif
    layoutIterGetIndex                      ,


-- ** getLayout #method:getLayout#

#if ENABLE_OVERLOADING
    LayoutIterGetLayoutMethodInfo           ,
#endif
    layoutIterGetLayout                     ,


-- ** getLayoutExtents #method:getLayoutExtents#

#if ENABLE_OVERLOADING
    LayoutIterGetLayoutExtentsMethodInfo    ,
#endif
    layoutIterGetLayoutExtents              ,


-- ** getLine #method:getLine#

#if ENABLE_OVERLOADING
    LayoutIterGetLineMethodInfo             ,
#endif
    layoutIterGetLine                       ,


-- ** getLineExtents #method:getLineExtents#

#if ENABLE_OVERLOADING
    LayoutIterGetLineExtentsMethodInfo      ,
#endif
    layoutIterGetLineExtents                ,


-- ** getLineReadonly #method:getLineReadonly#

#if ENABLE_OVERLOADING
    LayoutIterGetLineReadonlyMethodInfo     ,
#endif
    layoutIterGetLineReadonly               ,


-- ** getLineYrange #method:getLineYrange#

#if ENABLE_OVERLOADING
    LayoutIterGetLineYrangeMethodInfo       ,
#endif
    layoutIterGetLineYrange                 ,


-- ** getRun #method:getRun#

#if ENABLE_OVERLOADING
    LayoutIterGetRunMethodInfo              ,
#endif
    layoutIterGetRun                        ,


-- ** getRunExtents #method:getRunExtents#

#if ENABLE_OVERLOADING
    LayoutIterGetRunExtentsMethodInfo       ,
#endif
    layoutIterGetRunExtents                 ,


-- ** getRunReadonly #method:getRunReadonly#

#if ENABLE_OVERLOADING
    LayoutIterGetRunReadonlyMethodInfo      ,
#endif
    layoutIterGetRunReadonly                ,


-- ** nextChar #method:nextChar#

#if ENABLE_OVERLOADING
    LayoutIterNextCharMethodInfo            ,
#endif
    layoutIterNextChar                      ,


-- ** nextCluster #method:nextCluster#

#if ENABLE_OVERLOADING
    LayoutIterNextClusterMethodInfo         ,
#endif
    layoutIterNextCluster                   ,


-- ** nextLine #method:nextLine#

#if ENABLE_OVERLOADING
    LayoutIterNextLineMethodInfo            ,
#endif
    layoutIterNextLine                      ,


-- ** nextRun #method:nextRun#

#if ENABLE_OVERLOADING
    LayoutIterNextRunMethodInfo             ,
#endif
    layoutIterNextRun                       ,




    ) 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.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.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 {-# SOURCE #-} qualified GI.Pango.Objects.Layout as Pango.Layout
import {-# SOURCE #-} qualified GI.Pango.Structs.GlyphItem as Pango.GlyphItem
import {-# SOURCE #-} qualified GI.Pango.Structs.LayoutLine as Pango.LayoutLine
import {-# SOURCE #-} qualified GI.Pango.Structs.Rectangle as Pango.Rectangle

-- | Memory-managed wrapper type.
newtype LayoutIter = LayoutIter (ManagedPtr LayoutIter)
foreign import ccall "pango_layout_iter_get_type" c_pango_layout_iter_get_type ::
    IO GType

instance BoxedObject LayoutIter where
    boxedType _ = c_pango_layout_iter_get_type

-- | A convenience alias for `Nothing` :: `Maybe` `LayoutIter`.
noLayoutIter :: Maybe LayoutIter
noLayoutIter = Nothing


#if ENABLE_OVERLOADING
instance O.HasAttributeList LayoutIter
type instance O.AttributeList LayoutIter = LayoutIterAttributeList
type LayoutIterAttributeList = ('[ ] :: [(Symbol, *)])
#endif

-- method LayoutIter::at_last_line
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "iter", argType = TInterface (Name {namespace = "Pango", name = "LayoutIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayoutIter", 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 "pango_layout_iter_at_last_line" pango_layout_iter_at_last_line ::
    Ptr LayoutIter ->                       -- iter : TInterface (Name {namespace = "Pango", name = "LayoutIter"})
    IO CInt

{- |
Determines whether /@iter@/ is on the last line of the layout.
-}
layoutIterAtLastLine ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    LayoutIter
    {- ^ /@iter@/: a 'GI.Pango.Structs.LayoutIter.LayoutIter' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@iter@/ is on the last line. -}
layoutIterAtLastLine iter = liftIO $ do
    iter' <- unsafeManagedPtrGetPtr iter
    result <- pango_layout_iter_at_last_line iter'
    let result' = (/= 0) result
    touchManagedPtr iter
    return result'

#if ENABLE_OVERLOADING
data LayoutIterAtLastLineMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo LayoutIterAtLastLineMethodInfo LayoutIter signature where
    overloadedMethod _ = layoutIterAtLastLine

#endif

-- method LayoutIter::copy
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "iter", argType = TInterface (Name {namespace = "Pango", name = "LayoutIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayoutIter, may be %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Pango", name = "LayoutIter"}))
-- throws : False
-- Skip return : False

foreign import ccall "pango_layout_iter_copy" pango_layout_iter_copy ::
    Ptr LayoutIter ->                       -- iter : TInterface (Name {namespace = "Pango", name = "LayoutIter"})
    IO (Ptr LayoutIter)

{- |
Copies a 'GI.Pango.Structs.LayoutIter.LayoutIter'.

/Since: 1.20/
-}
layoutIterCopy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    LayoutIter
    {- ^ /@iter@/: a 'GI.Pango.Structs.LayoutIter.LayoutIter', may be 'Nothing' -}
    -> m (Maybe LayoutIter)
    {- ^ __Returns:__ the newly allocated 'GI.Pango.Structs.LayoutIter.LayoutIter',
              which should be freed with 'GI.Pango.Structs.LayoutIter.layoutIterFree',
              or 'Nothing' if /@iter@/ was 'Nothing'. -}
layoutIterCopy iter = liftIO $ do
    iter' <- unsafeManagedPtrGetPtr iter
    result <- pango_layout_iter_copy iter'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed LayoutIter) result'
        return result''
    touchManagedPtr iter
    return maybeResult

#if ENABLE_OVERLOADING
data LayoutIterCopyMethodInfo
instance (signature ~ (m (Maybe LayoutIter)), MonadIO m) => O.MethodInfo LayoutIterCopyMethodInfo LayoutIter signature where
    overloadedMethod _ = layoutIterCopy

#endif

-- method LayoutIter::free
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "iter", argType = TInterface (Name {namespace = "Pango", name = "LayoutIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayoutIter, may be %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "pango_layout_iter_free" pango_layout_iter_free ::
    Ptr LayoutIter ->                       -- iter : TInterface (Name {namespace = "Pango", name = "LayoutIter"})
    IO ()

{- |
Frees an iterator that\'s no longer in use.
-}
layoutIterFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    LayoutIter
    {- ^ /@iter@/: a 'GI.Pango.Structs.LayoutIter.LayoutIter', may be 'Nothing' -}
    -> m ()
layoutIterFree iter = liftIO $ do
    iter' <- unsafeManagedPtrGetPtr iter
    pango_layout_iter_free iter'
    touchManagedPtr iter
    return ()

#if ENABLE_OVERLOADING
data LayoutIterFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo LayoutIterFreeMethodInfo LayoutIter signature where
    overloadedMethod _ = layoutIterFree

#endif

-- method LayoutIter::get_baseline
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "iter", argType = TInterface (Name {namespace = "Pango", name = "LayoutIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayoutIter", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "pango_layout_iter_get_baseline" pango_layout_iter_get_baseline ::
    Ptr LayoutIter ->                       -- iter : TInterface (Name {namespace = "Pango", name = "LayoutIter"})
    IO Int32

{- |
Gets the Y position of the current line\'s baseline, in layout
coordinates (origin at top left of the entire layout).
-}
layoutIterGetBaseline ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    LayoutIter
    {- ^ /@iter@/: a 'GI.Pango.Structs.LayoutIter.LayoutIter' -}
    -> m Int32
    {- ^ __Returns:__ baseline of current line. -}
layoutIterGetBaseline iter = liftIO $ do
    iter' <- unsafeManagedPtrGetPtr iter
    result <- pango_layout_iter_get_baseline iter'
    touchManagedPtr iter
    return result

#if ENABLE_OVERLOADING
data LayoutIterGetBaselineMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo LayoutIterGetBaselineMethodInfo LayoutIter signature where
    overloadedMethod _ = layoutIterGetBaseline

#endif

-- method LayoutIter::get_char_extents
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "iter", argType = TInterface (Name {namespace = "Pango", name = "LayoutIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayoutIter", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "logical_rect", argType = TInterface (Name {namespace = "Pango", name = "Rectangle"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "rectangle to fill with\n  logical extents", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "pango_layout_iter_get_char_extents" pango_layout_iter_get_char_extents ::
    Ptr LayoutIter ->                       -- iter : TInterface (Name {namespace = "Pango", name = "LayoutIter"})
    Ptr Pango.Rectangle.Rectangle ->        -- logical_rect : TInterface (Name {namespace = "Pango", name = "Rectangle"})
    IO ()

{- |
Gets the extents of the current character, in layout coordinates
(origin is the top left of the entire layout). Only logical extents
can sensibly be obtained for characters; ink extents make sense only
down to the level of clusters.
-}
layoutIterGetCharExtents ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    LayoutIter
    {- ^ /@iter@/: a 'GI.Pango.Structs.LayoutIter.LayoutIter' -}
    -> m (Pango.Rectangle.Rectangle)
layoutIterGetCharExtents iter = liftIO $ do
    iter' <- unsafeManagedPtrGetPtr iter
    logicalRect <- callocBytes 16 :: IO (Ptr Pango.Rectangle.Rectangle)
    pango_layout_iter_get_char_extents iter' logicalRect
    logicalRect' <- (wrapPtr Pango.Rectangle.Rectangle) logicalRect
    touchManagedPtr iter
    return logicalRect'

#if ENABLE_OVERLOADING
data LayoutIterGetCharExtentsMethodInfo
instance (signature ~ (m (Pango.Rectangle.Rectangle)), MonadIO m) => O.MethodInfo LayoutIterGetCharExtentsMethodInfo LayoutIter signature where
    overloadedMethod _ = layoutIterGetCharExtents

#endif

-- method LayoutIter::get_cluster_extents
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "iter", argType = TInterface (Name {namespace = "Pango", name = "LayoutIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayoutIter", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "ink_rect", argType = TInterface (Name {namespace = "Pango", name = "Rectangle"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "rectangle to fill with ink extents, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "logical_rect", argType = TInterface (Name {namespace = "Pango", name = "Rectangle"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "rectangle to fill with logical extents, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "pango_layout_iter_get_cluster_extents" pango_layout_iter_get_cluster_extents ::
    Ptr LayoutIter ->                       -- iter : TInterface (Name {namespace = "Pango", name = "LayoutIter"})
    Ptr Pango.Rectangle.Rectangle ->        -- ink_rect : TInterface (Name {namespace = "Pango", name = "Rectangle"})
    Ptr Pango.Rectangle.Rectangle ->        -- logical_rect : TInterface (Name {namespace = "Pango", name = "Rectangle"})
    IO ()

{- |
Gets the extents of the current cluster, in layout coordinates
(origin is the top left of the entire layout).
-}
layoutIterGetClusterExtents ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    LayoutIter
    {- ^ /@iter@/: a 'GI.Pango.Structs.LayoutIter.LayoutIter' -}
    -> m ((Pango.Rectangle.Rectangle, Pango.Rectangle.Rectangle))
layoutIterGetClusterExtents iter = liftIO $ do
    iter' <- unsafeManagedPtrGetPtr iter
    inkRect <- callocBytes 16 :: IO (Ptr Pango.Rectangle.Rectangle)
    logicalRect <- callocBytes 16 :: IO (Ptr Pango.Rectangle.Rectangle)
    pango_layout_iter_get_cluster_extents iter' inkRect logicalRect
    inkRect' <- (wrapPtr Pango.Rectangle.Rectangle) inkRect
    logicalRect' <- (wrapPtr Pango.Rectangle.Rectangle) logicalRect
    touchManagedPtr iter
    return (inkRect', logicalRect')

#if ENABLE_OVERLOADING
data LayoutIterGetClusterExtentsMethodInfo
instance (signature ~ (m ((Pango.Rectangle.Rectangle, Pango.Rectangle.Rectangle))), MonadIO m) => O.MethodInfo LayoutIterGetClusterExtentsMethodInfo LayoutIter signature where
    overloadedMethod _ = layoutIterGetClusterExtents

#endif

-- method LayoutIter::get_index
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "iter", argType = TInterface (Name {namespace = "Pango", name = "LayoutIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayoutIter", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "pango_layout_iter_get_index" pango_layout_iter_get_index ::
    Ptr LayoutIter ->                       -- iter : TInterface (Name {namespace = "Pango", name = "LayoutIter"})
    IO Int32

{- |
Gets the current byte index. Note that iterating forward by char
moves in visual order, not logical order, so indexes may not be
sequential. Also, the index may be equal to the length of the text
in the layout, if on the 'Nothing' run (see 'GI.Pango.Structs.LayoutIter.layoutIterGetRun').
-}
layoutIterGetIndex ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    LayoutIter
    {- ^ /@iter@/: a 'GI.Pango.Structs.LayoutIter.LayoutIter' -}
    -> m Int32
    {- ^ __Returns:__ current byte index. -}
layoutIterGetIndex iter = liftIO $ do
    iter' <- unsafeManagedPtrGetPtr iter
    result <- pango_layout_iter_get_index iter'
    touchManagedPtr iter
    return result

#if ENABLE_OVERLOADING
data LayoutIterGetIndexMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo LayoutIterGetIndexMethodInfo LayoutIter signature where
    overloadedMethod _ = layoutIterGetIndex

#endif

-- method LayoutIter::get_layout
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "iter", argType = TInterface (Name {namespace = "Pango", name = "LayoutIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayoutIter", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Pango", name = "Layout"}))
-- throws : False
-- Skip return : False

foreign import ccall "pango_layout_iter_get_layout" pango_layout_iter_get_layout ::
    Ptr LayoutIter ->                       -- iter : TInterface (Name {namespace = "Pango", name = "LayoutIter"})
    IO (Ptr Pango.Layout.Layout)

{- |
Gets the layout associated with a 'GI.Pango.Structs.LayoutIter.LayoutIter'.

/Since: 1.20/
-}
layoutIterGetLayout ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    LayoutIter
    {- ^ /@iter@/: a 'GI.Pango.Structs.LayoutIter.LayoutIter' -}
    -> m Pango.Layout.Layout
    {- ^ __Returns:__ the layout associated with /@iter@/. -}
layoutIterGetLayout iter = liftIO $ do
    iter' <- unsafeManagedPtrGetPtr iter
    result <- pango_layout_iter_get_layout iter'
    checkUnexpectedReturnNULL "layoutIterGetLayout" result
    result' <- (newObject Pango.Layout.Layout) result
    touchManagedPtr iter
    return result'

#if ENABLE_OVERLOADING
data LayoutIterGetLayoutMethodInfo
instance (signature ~ (m Pango.Layout.Layout), MonadIO m) => O.MethodInfo LayoutIterGetLayoutMethodInfo LayoutIter signature where
    overloadedMethod _ = layoutIterGetLayout

#endif

-- method LayoutIter::get_layout_extents
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "iter", argType = TInterface (Name {namespace = "Pango", name = "LayoutIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayoutIter", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "ink_rect", argType = TInterface (Name {namespace = "Pango", name = "Rectangle"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "rectangle to fill with ink extents,\n           or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "logical_rect", argType = TInterface (Name {namespace = "Pango", name = "Rectangle"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "rectangle to fill with logical\n               extents, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "pango_layout_iter_get_layout_extents" pango_layout_iter_get_layout_extents ::
    Ptr LayoutIter ->                       -- iter : TInterface (Name {namespace = "Pango", name = "LayoutIter"})
    Ptr Pango.Rectangle.Rectangle ->        -- ink_rect : TInterface (Name {namespace = "Pango", name = "Rectangle"})
    Ptr Pango.Rectangle.Rectangle ->        -- logical_rect : TInterface (Name {namespace = "Pango", name = "Rectangle"})
    IO ()

{- |
Obtains the extents of the 'GI.Pango.Objects.Layout.Layout' being iterated
over. /@inkRect@/ or /@logicalRect@/ can be 'Nothing' if you
aren\'t interested in them.
-}
layoutIterGetLayoutExtents ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    LayoutIter
    {- ^ /@iter@/: a 'GI.Pango.Structs.LayoutIter.LayoutIter' -}
    -> m ((Pango.Rectangle.Rectangle, Pango.Rectangle.Rectangle))
layoutIterGetLayoutExtents iter = liftIO $ do
    iter' <- unsafeManagedPtrGetPtr iter
    inkRect <- callocBytes 16 :: IO (Ptr Pango.Rectangle.Rectangle)
    logicalRect <- callocBytes 16 :: IO (Ptr Pango.Rectangle.Rectangle)
    pango_layout_iter_get_layout_extents iter' inkRect logicalRect
    inkRect' <- (wrapPtr Pango.Rectangle.Rectangle) inkRect
    logicalRect' <- (wrapPtr Pango.Rectangle.Rectangle) logicalRect
    touchManagedPtr iter
    return (inkRect', logicalRect')

#if ENABLE_OVERLOADING
data LayoutIterGetLayoutExtentsMethodInfo
instance (signature ~ (m ((Pango.Rectangle.Rectangle, Pango.Rectangle.Rectangle))), MonadIO m) => O.MethodInfo LayoutIterGetLayoutExtentsMethodInfo LayoutIter signature where
    overloadedMethod _ = layoutIterGetLayoutExtents

#endif

-- method LayoutIter::get_line
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "iter", argType = TInterface (Name {namespace = "Pango", name = "LayoutIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayoutIter", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Pango", name = "LayoutLine"}))
-- throws : False
-- Skip return : False

foreign import ccall "pango_layout_iter_get_line" pango_layout_iter_get_line ::
    Ptr LayoutIter ->                       -- iter : TInterface (Name {namespace = "Pango", name = "LayoutIter"})
    IO (Ptr Pango.LayoutLine.LayoutLine)

{- |
Gets the current line.

Use the faster 'GI.Pango.Structs.LayoutIter.layoutIterGetLineReadonly' if you do not plan
to modify the contents of the line (glyphs, glyph widths, etc.).
-}
layoutIterGetLine ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    LayoutIter
    {- ^ /@iter@/: a 'GI.Pango.Structs.LayoutIter.LayoutIter' -}
    -> m Pango.LayoutLine.LayoutLine
    {- ^ __Returns:__ the current line. -}
layoutIterGetLine iter = liftIO $ do
    iter' <- unsafeManagedPtrGetPtr iter
    result <- pango_layout_iter_get_line iter'
    checkUnexpectedReturnNULL "layoutIterGetLine" result
    result' <- (newBoxed Pango.LayoutLine.LayoutLine) result
    touchManagedPtr iter
    return result'

#if ENABLE_OVERLOADING
data LayoutIterGetLineMethodInfo
instance (signature ~ (m Pango.LayoutLine.LayoutLine), MonadIO m) => O.MethodInfo LayoutIterGetLineMethodInfo LayoutIter signature where
    overloadedMethod _ = layoutIterGetLine

#endif

-- method LayoutIter::get_line_extents
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "iter", argType = TInterface (Name {namespace = "Pango", name = "LayoutIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayoutIter", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "ink_rect", argType = TInterface (Name {namespace = "Pango", name = "Rectangle"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "rectangle to fill with ink extents, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "logical_rect", argType = TInterface (Name {namespace = "Pango", name = "Rectangle"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "rectangle to fill with logical extents, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "pango_layout_iter_get_line_extents" pango_layout_iter_get_line_extents ::
    Ptr LayoutIter ->                       -- iter : TInterface (Name {namespace = "Pango", name = "LayoutIter"})
    Ptr Pango.Rectangle.Rectangle ->        -- ink_rect : TInterface (Name {namespace = "Pango", name = "Rectangle"})
    Ptr Pango.Rectangle.Rectangle ->        -- logical_rect : TInterface (Name {namespace = "Pango", name = "Rectangle"})
    IO ()

{- |
Obtains the extents of the current line. /@inkRect@/ or /@logicalRect@/
can be 'Nothing' if you aren\'t interested in them. Extents are in layout
coordinates (origin is the top-left corner of the entire
'GI.Pango.Objects.Layout.Layout').  Thus the extents returned by this function will be
the same width\/height but not at the same x\/y as the extents
returned from 'GI.Pango.Structs.LayoutLine.layoutLineGetExtents'.
-}
layoutIterGetLineExtents ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    LayoutIter
    {- ^ /@iter@/: a 'GI.Pango.Structs.LayoutIter.LayoutIter' -}
    -> m ((Pango.Rectangle.Rectangle, Pango.Rectangle.Rectangle))
layoutIterGetLineExtents iter = liftIO $ do
    iter' <- unsafeManagedPtrGetPtr iter
    inkRect <- callocBytes 16 :: IO (Ptr Pango.Rectangle.Rectangle)
    logicalRect <- callocBytes 16 :: IO (Ptr Pango.Rectangle.Rectangle)
    pango_layout_iter_get_line_extents iter' inkRect logicalRect
    inkRect' <- (wrapPtr Pango.Rectangle.Rectangle) inkRect
    logicalRect' <- (wrapPtr Pango.Rectangle.Rectangle) logicalRect
    touchManagedPtr iter
    return (inkRect', logicalRect')

#if ENABLE_OVERLOADING
data LayoutIterGetLineExtentsMethodInfo
instance (signature ~ (m ((Pango.Rectangle.Rectangle, Pango.Rectangle.Rectangle))), MonadIO m) => O.MethodInfo LayoutIterGetLineExtentsMethodInfo LayoutIter signature where
    overloadedMethod _ = layoutIterGetLineExtents

#endif

-- method LayoutIter::get_line_readonly
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "iter", argType = TInterface (Name {namespace = "Pango", name = "LayoutIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayoutIter", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Pango", name = "LayoutLine"}))
-- throws : False
-- Skip return : False

foreign import ccall "pango_layout_iter_get_line_readonly" pango_layout_iter_get_line_readonly ::
    Ptr LayoutIter ->                       -- iter : TInterface (Name {namespace = "Pango", name = "LayoutIter"})
    IO (Ptr Pango.LayoutLine.LayoutLine)

{- |
Gets the current line for read-only access.

This is a faster alternative to 'GI.Pango.Structs.LayoutIter.layoutIterGetLine',
but the user is not expected
to modify the contents of the line (glyphs, glyph widths, etc.).

/Since: 1.16/
-}
layoutIterGetLineReadonly ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    LayoutIter
    {- ^ /@iter@/: a 'GI.Pango.Structs.LayoutIter.LayoutIter' -}
    -> m Pango.LayoutLine.LayoutLine
    {- ^ __Returns:__ the current line, that should not be
modified. -}
layoutIterGetLineReadonly iter = liftIO $ do
    iter' <- unsafeManagedPtrGetPtr iter
    result <- pango_layout_iter_get_line_readonly iter'
    checkUnexpectedReturnNULL "layoutIterGetLineReadonly" result
    result' <- (newBoxed Pango.LayoutLine.LayoutLine) result
    touchManagedPtr iter
    return result'

#if ENABLE_OVERLOADING
data LayoutIterGetLineReadonlyMethodInfo
instance (signature ~ (m Pango.LayoutLine.LayoutLine), MonadIO m) => O.MethodInfo LayoutIterGetLineReadonlyMethodInfo LayoutIter signature where
    overloadedMethod _ = layoutIterGetLineReadonly

#endif

-- method LayoutIter::get_line_yrange
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "iter", argType = TInterface (Name {namespace = "Pango", name = "LayoutIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayoutIter", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "y0_", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "start of line, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "y1_", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "end of line, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "pango_layout_iter_get_line_yrange" pango_layout_iter_get_line_yrange ::
    Ptr LayoutIter ->                       -- iter : TInterface (Name {namespace = "Pango", name = "LayoutIter"})
    Ptr Int32 ->                            -- y0_ : TBasicType TInt
    Ptr Int32 ->                            -- y1_ : TBasicType TInt
    IO ()

{- |
Divides the vertical space in the 'GI.Pango.Objects.Layout.Layout' being iterated over
between the lines in the layout, and returns the space belonging to
the current line.  A line\'s range includes the line\'s logical
extents, plus half of the spacing above and below the line, if
'GI.Pango.Objects.Layout.layoutSetSpacing' has been called to set layout spacing.
The Y positions are in layout coordinates (origin at top left of the
entire layout).
-}
layoutIterGetLineYrange ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    LayoutIter
    {- ^ /@iter@/: a 'GI.Pango.Structs.LayoutIter.LayoutIter' -}
    -> m ((Int32, Int32))
layoutIterGetLineYrange iter = liftIO $ do
    iter' <- unsafeManagedPtrGetPtr iter
    y0_ <- allocMem :: IO (Ptr Int32)
    y1_ <- allocMem :: IO (Ptr Int32)
    pango_layout_iter_get_line_yrange iter' y0_ y1_
    y0_' <- peek y0_
    y1_' <- peek y1_
    touchManagedPtr iter
    freeMem y0_
    freeMem y1_
    return (y0_', y1_')

#if ENABLE_OVERLOADING
data LayoutIterGetLineYrangeMethodInfo
instance (signature ~ (m ((Int32, Int32))), MonadIO m) => O.MethodInfo LayoutIterGetLineYrangeMethodInfo LayoutIter signature where
    overloadedMethod _ = layoutIterGetLineYrange

#endif

-- method LayoutIter::get_run
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "iter", argType = TInterface (Name {namespace = "Pango", name = "LayoutIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayoutIter", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Pango", name = "GlyphItem"}))
-- throws : False
-- Skip return : False

foreign import ccall "pango_layout_iter_get_run" pango_layout_iter_get_run ::
    Ptr LayoutIter ->                       -- iter : TInterface (Name {namespace = "Pango", name = "LayoutIter"})
    IO (Ptr Pango.GlyphItem.GlyphItem)

{- |
Gets the current run. When iterating by run, at the end of each
line, there\'s a position with a 'Nothing' run, so this function can return
'Nothing'. The 'Nothing' run at the end of each line ensures that all lines have
at least one run, even lines consisting of only a newline.

Use the faster 'GI.Pango.Structs.LayoutIter.layoutIterGetRunReadonly' if you do not plan
to modify the contents of the run (glyphs, glyph widths, etc.).
-}
layoutIterGetRun ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    LayoutIter
    {- ^ /@iter@/: a 'GI.Pango.Structs.LayoutIter.LayoutIter' -}
    -> m (Maybe Pango.GlyphItem.GlyphItem)
    {- ^ __Returns:__ the current run. -}
layoutIterGetRun iter = liftIO $ do
    iter' <- unsafeManagedPtrGetPtr iter
    result <- pango_layout_iter_get_run iter'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed Pango.GlyphItem.GlyphItem) result'
        return result''
    touchManagedPtr iter
    return maybeResult

#if ENABLE_OVERLOADING
data LayoutIterGetRunMethodInfo
instance (signature ~ (m (Maybe Pango.GlyphItem.GlyphItem)), MonadIO m) => O.MethodInfo LayoutIterGetRunMethodInfo LayoutIter signature where
    overloadedMethod _ = layoutIterGetRun

#endif

-- method LayoutIter::get_run_extents
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "iter", argType = TInterface (Name {namespace = "Pango", name = "LayoutIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayoutIter", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "ink_rect", argType = TInterface (Name {namespace = "Pango", name = "Rectangle"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "rectangle to fill with ink extents, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "logical_rect", argType = TInterface (Name {namespace = "Pango", name = "Rectangle"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "rectangle to fill with logical extents, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "pango_layout_iter_get_run_extents" pango_layout_iter_get_run_extents ::
    Ptr LayoutIter ->                       -- iter : TInterface (Name {namespace = "Pango", name = "LayoutIter"})
    Ptr Pango.Rectangle.Rectangle ->        -- ink_rect : TInterface (Name {namespace = "Pango", name = "Rectangle"})
    Ptr Pango.Rectangle.Rectangle ->        -- logical_rect : TInterface (Name {namespace = "Pango", name = "Rectangle"})
    IO ()

{- |
Gets the extents of the current run in layout coordinates
(origin is the top left of the entire layout).
-}
layoutIterGetRunExtents ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    LayoutIter
    {- ^ /@iter@/: a 'GI.Pango.Structs.LayoutIter.LayoutIter' -}
    -> m ((Pango.Rectangle.Rectangle, Pango.Rectangle.Rectangle))
layoutIterGetRunExtents iter = liftIO $ do
    iter' <- unsafeManagedPtrGetPtr iter
    inkRect <- callocBytes 16 :: IO (Ptr Pango.Rectangle.Rectangle)
    logicalRect <- callocBytes 16 :: IO (Ptr Pango.Rectangle.Rectangle)
    pango_layout_iter_get_run_extents iter' inkRect logicalRect
    inkRect' <- (wrapPtr Pango.Rectangle.Rectangle) inkRect
    logicalRect' <- (wrapPtr Pango.Rectangle.Rectangle) logicalRect
    touchManagedPtr iter
    return (inkRect', logicalRect')

#if ENABLE_OVERLOADING
data LayoutIterGetRunExtentsMethodInfo
instance (signature ~ (m ((Pango.Rectangle.Rectangle, Pango.Rectangle.Rectangle))), MonadIO m) => O.MethodInfo LayoutIterGetRunExtentsMethodInfo LayoutIter signature where
    overloadedMethod _ = layoutIterGetRunExtents

#endif

-- method LayoutIter::get_run_readonly
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "iter", argType = TInterface (Name {namespace = "Pango", name = "LayoutIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayoutIter", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Pango", name = "GlyphItem"}))
-- throws : False
-- Skip return : False

foreign import ccall "pango_layout_iter_get_run_readonly" pango_layout_iter_get_run_readonly ::
    Ptr LayoutIter ->                       -- iter : TInterface (Name {namespace = "Pango", name = "LayoutIter"})
    IO (Ptr Pango.GlyphItem.GlyphItem)

{- |
Gets the current run. When iterating by run, at the end of each
line, there\'s a position with a 'Nothing' run, so this function can return
'Nothing'. The 'Nothing' run at the end of each line ensures that all lines have
at least one run, even lines consisting of only a newline.

This is a faster alternative to 'GI.Pango.Structs.LayoutIter.layoutIterGetRun',
but the user is not expected
to modify the contents of the run (glyphs, glyph widths, etc.).

/Since: 1.16/
-}
layoutIterGetRunReadonly ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    LayoutIter
    {- ^ /@iter@/: a 'GI.Pango.Structs.LayoutIter.LayoutIter' -}
    -> m (Maybe Pango.GlyphItem.GlyphItem)
    {- ^ __Returns:__ the current run, that
should not be modified. -}
layoutIterGetRunReadonly iter = liftIO $ do
    iter' <- unsafeManagedPtrGetPtr iter
    result <- pango_layout_iter_get_run_readonly iter'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed Pango.GlyphItem.GlyphItem) result'
        return result''
    touchManagedPtr iter
    return maybeResult

#if ENABLE_OVERLOADING
data LayoutIterGetRunReadonlyMethodInfo
instance (signature ~ (m (Maybe Pango.GlyphItem.GlyphItem)), MonadIO m) => O.MethodInfo LayoutIterGetRunReadonlyMethodInfo LayoutIter signature where
    overloadedMethod _ = layoutIterGetRunReadonly

#endif

-- method LayoutIter::next_char
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "iter", argType = TInterface (Name {namespace = "Pango", name = "LayoutIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayoutIter", 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 "pango_layout_iter_next_char" pango_layout_iter_next_char ::
    Ptr LayoutIter ->                       -- iter : TInterface (Name {namespace = "Pango", name = "LayoutIter"})
    IO CInt

{- |
Moves /@iter@/ forward to the next character in visual order. If /@iter@/ was already at
the end of the layout, returns 'False'.
-}
layoutIterNextChar ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    LayoutIter
    {- ^ /@iter@/: a 'GI.Pango.Structs.LayoutIter.LayoutIter' -}
    -> m Bool
    {- ^ __Returns:__ whether motion was possible. -}
layoutIterNextChar iter = liftIO $ do
    iter' <- unsafeManagedPtrGetPtr iter
    result <- pango_layout_iter_next_char iter'
    let result' = (/= 0) result
    touchManagedPtr iter
    return result'

#if ENABLE_OVERLOADING
data LayoutIterNextCharMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo LayoutIterNextCharMethodInfo LayoutIter signature where
    overloadedMethod _ = layoutIterNextChar

#endif

-- method LayoutIter::next_cluster
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "iter", argType = TInterface (Name {namespace = "Pango", name = "LayoutIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayoutIter", 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 "pango_layout_iter_next_cluster" pango_layout_iter_next_cluster ::
    Ptr LayoutIter ->                       -- iter : TInterface (Name {namespace = "Pango", name = "LayoutIter"})
    IO CInt

{- |
Moves /@iter@/ forward to the next cluster in visual order. If /@iter@/
was already at the end of the layout, returns 'False'.
-}
layoutIterNextCluster ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    LayoutIter
    {- ^ /@iter@/: a 'GI.Pango.Structs.LayoutIter.LayoutIter' -}
    -> m Bool
    {- ^ __Returns:__ whether motion was possible. -}
layoutIterNextCluster iter = liftIO $ do
    iter' <- unsafeManagedPtrGetPtr iter
    result <- pango_layout_iter_next_cluster iter'
    let result' = (/= 0) result
    touchManagedPtr iter
    return result'

#if ENABLE_OVERLOADING
data LayoutIterNextClusterMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo LayoutIterNextClusterMethodInfo LayoutIter signature where
    overloadedMethod _ = layoutIterNextCluster

#endif

-- method LayoutIter::next_line
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "iter", argType = TInterface (Name {namespace = "Pango", name = "LayoutIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayoutIter", 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 "pango_layout_iter_next_line" pango_layout_iter_next_line ::
    Ptr LayoutIter ->                       -- iter : TInterface (Name {namespace = "Pango", name = "LayoutIter"})
    IO CInt

{- |
Moves /@iter@/ forward to the start of the next line. If /@iter@/ is
already on the last line, returns 'False'.
-}
layoutIterNextLine ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    LayoutIter
    {- ^ /@iter@/: a 'GI.Pango.Structs.LayoutIter.LayoutIter' -}
    -> m Bool
    {- ^ __Returns:__ whether motion was possible. -}
layoutIterNextLine iter = liftIO $ do
    iter' <- unsafeManagedPtrGetPtr iter
    result <- pango_layout_iter_next_line iter'
    let result' = (/= 0) result
    touchManagedPtr iter
    return result'

#if ENABLE_OVERLOADING
data LayoutIterNextLineMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo LayoutIterNextLineMethodInfo LayoutIter signature where
    overloadedMethod _ = layoutIterNextLine

#endif

-- method LayoutIter::next_run
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "iter", argType = TInterface (Name {namespace = "Pango", name = "LayoutIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayoutIter", 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 "pango_layout_iter_next_run" pango_layout_iter_next_run ::
    Ptr LayoutIter ->                       -- iter : TInterface (Name {namespace = "Pango", name = "LayoutIter"})
    IO CInt

{- |
Moves /@iter@/ forward to the next run in visual order. If /@iter@/ was
already at the end of the layout, returns 'False'.
-}
layoutIterNextRun ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    LayoutIter
    {- ^ /@iter@/: a 'GI.Pango.Structs.LayoutIter.LayoutIter' -}
    -> m Bool
    {- ^ __Returns:__ whether motion was possible. -}
layoutIterNextRun iter = liftIO $ do
    iter' <- unsafeManagedPtrGetPtr iter
    result <- pango_layout_iter_next_run iter'
    let result' = (/= 0) result
    touchManagedPtr iter
    return result'

#if ENABLE_OVERLOADING
data LayoutIterNextRunMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo LayoutIterNextRunMethodInfo LayoutIter signature where
    overloadedMethod _ = layoutIterNextRun

#endif

#if ENABLE_OVERLOADING
type family ResolveLayoutIterMethod (t :: Symbol) (o :: *) :: * where
    ResolveLayoutIterMethod "atLastLine" o = LayoutIterAtLastLineMethodInfo
    ResolveLayoutIterMethod "copy" o = LayoutIterCopyMethodInfo
    ResolveLayoutIterMethod "free" o = LayoutIterFreeMethodInfo
    ResolveLayoutIterMethod "nextChar" o = LayoutIterNextCharMethodInfo
    ResolveLayoutIterMethod "nextCluster" o = LayoutIterNextClusterMethodInfo
    ResolveLayoutIterMethod "nextLine" o = LayoutIterNextLineMethodInfo
    ResolveLayoutIterMethod "nextRun" o = LayoutIterNextRunMethodInfo
    ResolveLayoutIterMethod "getBaseline" o = LayoutIterGetBaselineMethodInfo
    ResolveLayoutIterMethod "getCharExtents" o = LayoutIterGetCharExtentsMethodInfo
    ResolveLayoutIterMethod "getClusterExtents" o = LayoutIterGetClusterExtentsMethodInfo
    ResolveLayoutIterMethod "getIndex" o = LayoutIterGetIndexMethodInfo
    ResolveLayoutIterMethod "getLayout" o = LayoutIterGetLayoutMethodInfo
    ResolveLayoutIterMethod "getLayoutExtents" o = LayoutIterGetLayoutExtentsMethodInfo
    ResolveLayoutIterMethod "getLine" o = LayoutIterGetLineMethodInfo
    ResolveLayoutIterMethod "getLineExtents" o = LayoutIterGetLineExtentsMethodInfo
    ResolveLayoutIterMethod "getLineReadonly" o = LayoutIterGetLineReadonlyMethodInfo
    ResolveLayoutIterMethod "getLineYrange" o = LayoutIterGetLineYrangeMethodInfo
    ResolveLayoutIterMethod "getRun" o = LayoutIterGetRunMethodInfo
    ResolveLayoutIterMethod "getRunExtents" o = LayoutIterGetRunExtentsMethodInfo
    ResolveLayoutIterMethod "getRunReadonly" o = LayoutIterGetRunReadonlyMethodInfo
    ResolveLayoutIterMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveLayoutIterMethod t LayoutIter, O.MethodInfo info LayoutIter p) => OL.IsLabel t (LayoutIter -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif