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

The 'GI.Pango.Objects.Layout.Layout' structure represents an entire paragraph
of text. It is initialized with a 'GI.Pango.Objects.Context.Context', UTF-8 string
and set of attributes for that string. Once that is done, the
set of formatted lines can be extracted from the object,
the layout can be rendered, and conversion between logical
character positions within the layout\'s text, and the physical
position of the resulting glyphs can be made.

There are also a number of parameters to adjust the formatting
of a 'GI.Pango.Objects.Layout.Layout', which are illustrated in \<xref linkend=\"parameters\"\/>.
It is possible, as well, to ignore the 2-D setup, and simply
treat the results of a 'GI.Pango.Objects.Layout.Layout' as a list of lines.

\<figure id=\"parameters\">
\<title>Adjustable parameters for a PangoLayout\<\/title>
\<graphic fileref=\"layout.gif\" format=\"GIF\">\<\/graphic>
\<\/figure>

The 'GI.Pango.Objects.Layout.Layout' 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.Objects.Layout
    (
#if ENABLE_OVERLOADING
    LayoutSetMarkupWithAccelMethodInfo      ,
#endif

-- * Exported types
    Layout(..)                              ,
    IsLayout                                ,
    toLayout                                ,
    noLayout                                ,


 -- * Methods
-- ** contextChanged #method:contextChanged#

#if ENABLE_OVERLOADING
    LayoutContextChangedMethodInfo          ,
#endif
    layoutContextChanged                    ,


-- ** copy #method:copy#

#if ENABLE_OVERLOADING
    LayoutCopyMethodInfo                    ,
#endif
    layoutCopy                              ,


-- ** getAlignment #method:getAlignment#

#if ENABLE_OVERLOADING
    LayoutGetAlignmentMethodInfo            ,
#endif
    layoutGetAlignment                      ,


-- ** getAttributes #method:getAttributes#

#if ENABLE_OVERLOADING
    LayoutGetAttributesMethodInfo           ,
#endif
    layoutGetAttributes                     ,


-- ** getAutoDir #method:getAutoDir#

#if ENABLE_OVERLOADING
    LayoutGetAutoDirMethodInfo              ,
#endif
    layoutGetAutoDir                        ,


-- ** getBaseline #method:getBaseline#

#if ENABLE_OVERLOADING
    LayoutGetBaselineMethodInfo             ,
#endif
    layoutGetBaseline                       ,


-- ** getCharacterCount #method:getCharacterCount#

#if ENABLE_OVERLOADING
    LayoutGetCharacterCountMethodInfo       ,
#endif
    layoutGetCharacterCount                 ,


-- ** getContext #method:getContext#

#if ENABLE_OVERLOADING
    LayoutGetContextMethodInfo              ,
#endif
    layoutGetContext                        ,


-- ** getCursorPos #method:getCursorPos#

#if ENABLE_OVERLOADING
    LayoutGetCursorPosMethodInfo            ,
#endif
    layoutGetCursorPos                      ,


-- ** getEllipsize #method:getEllipsize#

#if ENABLE_OVERLOADING
    LayoutGetEllipsizeMethodInfo            ,
#endif
    layoutGetEllipsize                      ,


-- ** getExtents #method:getExtents#

#if ENABLE_OVERLOADING
    LayoutGetExtentsMethodInfo              ,
#endif
    layoutGetExtents                        ,


-- ** getFontDescription #method:getFontDescription#

#if ENABLE_OVERLOADING
    LayoutGetFontDescriptionMethodInfo      ,
#endif
    layoutGetFontDescription                ,


-- ** getHeight #method:getHeight#

#if ENABLE_OVERLOADING
    LayoutGetHeightMethodInfo               ,
#endif
    layoutGetHeight                         ,


-- ** getIndent #method:getIndent#

#if ENABLE_OVERLOADING
    LayoutGetIndentMethodInfo               ,
#endif
    layoutGetIndent                         ,


-- ** getIter #method:getIter#

#if ENABLE_OVERLOADING
    LayoutGetIterMethodInfo                 ,
#endif
    layoutGetIter                           ,


-- ** getJustify #method:getJustify#

#if ENABLE_OVERLOADING
    LayoutGetJustifyMethodInfo              ,
#endif
    layoutGetJustify                        ,


-- ** getLine #method:getLine#

#if ENABLE_OVERLOADING
    LayoutGetLineMethodInfo                 ,
#endif
    layoutGetLine                           ,


-- ** getLineCount #method:getLineCount#

#if ENABLE_OVERLOADING
    LayoutGetLineCountMethodInfo            ,
#endif
    layoutGetLineCount                      ,


-- ** getLineReadonly #method:getLineReadonly#

#if ENABLE_OVERLOADING
    LayoutGetLineReadonlyMethodInfo         ,
#endif
    layoutGetLineReadonly                   ,


-- ** getLines #method:getLines#

#if ENABLE_OVERLOADING
    LayoutGetLinesMethodInfo                ,
#endif
    layoutGetLines                          ,


-- ** getLinesReadonly #method:getLinesReadonly#

#if ENABLE_OVERLOADING
    LayoutGetLinesReadonlyMethodInfo        ,
#endif
    layoutGetLinesReadonly                  ,


-- ** getLogAttrs #method:getLogAttrs#

#if ENABLE_OVERLOADING
    LayoutGetLogAttrsMethodInfo             ,
#endif
    layoutGetLogAttrs                       ,


-- ** getLogAttrsReadonly #method:getLogAttrsReadonly#

#if ENABLE_OVERLOADING
    LayoutGetLogAttrsReadonlyMethodInfo     ,
#endif
    layoutGetLogAttrsReadonly               ,


-- ** getPixelExtents #method:getPixelExtents#

#if ENABLE_OVERLOADING
    LayoutGetPixelExtentsMethodInfo         ,
#endif
    layoutGetPixelExtents                   ,


-- ** getPixelSize #method:getPixelSize#

#if ENABLE_OVERLOADING
    LayoutGetPixelSizeMethodInfo            ,
#endif
    layoutGetPixelSize                      ,


-- ** getSerial #method:getSerial#

#if ENABLE_OVERLOADING
    LayoutGetSerialMethodInfo               ,
#endif
    layoutGetSerial                         ,


-- ** getSingleParagraphMode #method:getSingleParagraphMode#

#if ENABLE_OVERLOADING
    LayoutGetSingleParagraphModeMethodInfo  ,
#endif
    layoutGetSingleParagraphMode            ,


-- ** getSize #method:getSize#

#if ENABLE_OVERLOADING
    LayoutGetSizeMethodInfo                 ,
#endif
    layoutGetSize                           ,


-- ** getSpacing #method:getSpacing#

#if ENABLE_OVERLOADING
    LayoutGetSpacingMethodInfo              ,
#endif
    layoutGetSpacing                        ,


-- ** getTabs #method:getTabs#

#if ENABLE_OVERLOADING
    LayoutGetTabsMethodInfo                 ,
#endif
    layoutGetTabs                           ,


-- ** getText #method:getText#

#if ENABLE_OVERLOADING
    LayoutGetTextMethodInfo                 ,
#endif
    layoutGetText                           ,


-- ** getUnknownGlyphsCount #method:getUnknownGlyphsCount#

#if ENABLE_OVERLOADING
    LayoutGetUnknownGlyphsCountMethodInfo   ,
#endif
    layoutGetUnknownGlyphsCount             ,


-- ** getWidth #method:getWidth#

#if ENABLE_OVERLOADING
    LayoutGetWidthMethodInfo                ,
#endif
    layoutGetWidth                          ,


-- ** getWrap #method:getWrap#

#if ENABLE_OVERLOADING
    LayoutGetWrapMethodInfo                 ,
#endif
    layoutGetWrap                           ,


-- ** indexToLineX #method:indexToLineX#

#if ENABLE_OVERLOADING
    LayoutIndexToLineXMethodInfo            ,
#endif
    layoutIndexToLineX                      ,


-- ** indexToPos #method:indexToPos#

#if ENABLE_OVERLOADING
    LayoutIndexToPosMethodInfo              ,
#endif
    layoutIndexToPos                        ,


-- ** isEllipsized #method:isEllipsized#

#if ENABLE_OVERLOADING
    LayoutIsEllipsizedMethodInfo            ,
#endif
    layoutIsEllipsized                      ,


-- ** isWrapped #method:isWrapped#

#if ENABLE_OVERLOADING
    LayoutIsWrappedMethodInfo               ,
#endif
    layoutIsWrapped                         ,


-- ** moveCursorVisually #method:moveCursorVisually#

#if ENABLE_OVERLOADING
    LayoutMoveCursorVisuallyMethodInfo      ,
#endif
    layoutMoveCursorVisually                ,


-- ** new #method:new#

    layoutNew                               ,


-- ** setAlignment #method:setAlignment#

#if ENABLE_OVERLOADING
    LayoutSetAlignmentMethodInfo            ,
#endif
    layoutSetAlignment                      ,


-- ** setAttributes #method:setAttributes#

#if ENABLE_OVERLOADING
    LayoutSetAttributesMethodInfo           ,
#endif
    layoutSetAttributes                     ,


-- ** setAutoDir #method:setAutoDir#

#if ENABLE_OVERLOADING
    LayoutSetAutoDirMethodInfo              ,
#endif
    layoutSetAutoDir                        ,


-- ** setEllipsize #method:setEllipsize#

#if ENABLE_OVERLOADING
    LayoutSetEllipsizeMethodInfo            ,
#endif
    layoutSetEllipsize                      ,


-- ** setFontDescription #method:setFontDescription#

#if ENABLE_OVERLOADING
    LayoutSetFontDescriptionMethodInfo      ,
#endif
    layoutSetFontDescription                ,


-- ** setHeight #method:setHeight#

#if ENABLE_OVERLOADING
    LayoutSetHeightMethodInfo               ,
#endif
    layoutSetHeight                         ,


-- ** setIndent #method:setIndent#

#if ENABLE_OVERLOADING
    LayoutSetIndentMethodInfo               ,
#endif
    layoutSetIndent                         ,


-- ** setJustify #method:setJustify#

#if ENABLE_OVERLOADING
    LayoutSetJustifyMethodInfo              ,
#endif
    layoutSetJustify                        ,


-- ** setMarkup #method:setMarkup#

#if ENABLE_OVERLOADING
    LayoutSetMarkupMethodInfo               ,
#endif
    layoutSetMarkup                         ,


-- ** setSingleParagraphMode #method:setSingleParagraphMode#

#if ENABLE_OVERLOADING
    LayoutSetSingleParagraphModeMethodInfo  ,
#endif
    layoutSetSingleParagraphMode            ,


-- ** setSpacing #method:setSpacing#

#if ENABLE_OVERLOADING
    LayoutSetSpacingMethodInfo              ,
#endif
    layoutSetSpacing                        ,


-- ** setTabs #method:setTabs#

#if ENABLE_OVERLOADING
    LayoutSetTabsMethodInfo                 ,
#endif
    layoutSetTabs                           ,


-- ** setText #method:setText#

#if ENABLE_OVERLOADING
    LayoutSetTextMethodInfo                 ,
#endif
    layoutSetText                           ,


-- ** setWidth #method:setWidth#

#if ENABLE_OVERLOADING
    LayoutSetWidthMethodInfo                ,
#endif
    layoutSetWidth                          ,


-- ** setWrap #method:setWrap#

#if ENABLE_OVERLOADING
    LayoutSetWrapMethodInfo                 ,
#endif
    layoutSetWrap                           ,


-- ** xyToIndex #method:xyToIndex#

#if ENABLE_OVERLOADING
    LayoutXyToIndexMethodInfo               ,
#endif
    layoutXyToIndex                         ,




    ) 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 qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Pango.Enums as Pango.Enums
import {-# SOURCE #-} qualified GI.Pango.Objects.Context as Pango.Context
import {-# SOURCE #-} qualified GI.Pango.Structs.AttrList as Pango.AttrList
import {-# SOURCE #-} qualified GI.Pango.Structs.FontDescription as Pango.FontDescription
import {-# SOURCE #-} qualified GI.Pango.Structs.LayoutIter as Pango.LayoutIter
import {-# SOURCE #-} qualified GI.Pango.Structs.LayoutLine as Pango.LayoutLine
import {-# SOURCE #-} qualified GI.Pango.Structs.LogAttr as Pango.LogAttr
import {-# SOURCE #-} qualified GI.Pango.Structs.Rectangle as Pango.Rectangle
import {-# SOURCE #-} qualified GI.Pango.Structs.TabArray as Pango.TabArray

-- | Memory-managed wrapper type.
newtype Layout = Layout (ManagedPtr Layout)
foreign import ccall "pango_layout_get_type"
    c_pango_layout_get_type :: IO GType

instance GObject Layout where
    gobjectType = c_pango_layout_get_type


-- | Type class for types which can be safely cast to `Layout`, for instance with `toLayout`.
class (GObject o, O.IsDescendantOf Layout o) => IsLayout o
instance (GObject o, O.IsDescendantOf Layout o) => IsLayout o

instance O.HasParentTypes Layout
type instance O.ParentTypes Layout = '[GObject.Object.Object]

-- | Cast to `Layout`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toLayout :: (MonadIO m, IsLayout o) => o -> m Layout
toLayout = liftIO . unsafeCastTo Layout

-- | A convenience alias for `Nothing` :: `Maybe` `Layout`.
noLayout :: Maybe Layout
noLayout = Nothing

#if ENABLE_OVERLOADING
type family ResolveLayoutMethod (t :: Symbol) (o :: *) :: * where
    ResolveLayoutMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveLayoutMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveLayoutMethod "contextChanged" o = LayoutContextChangedMethodInfo
    ResolveLayoutMethod "copy" o = LayoutCopyMethodInfo
    ResolveLayoutMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveLayoutMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveLayoutMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveLayoutMethod "indexToLineX" o = LayoutIndexToLineXMethodInfo
    ResolveLayoutMethod "indexToPos" o = LayoutIndexToPosMethodInfo
    ResolveLayoutMethod "isEllipsized" o = LayoutIsEllipsizedMethodInfo
    ResolveLayoutMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveLayoutMethod "isWrapped" o = LayoutIsWrappedMethodInfo
    ResolveLayoutMethod "moveCursorVisually" o = LayoutMoveCursorVisuallyMethodInfo
    ResolveLayoutMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveLayoutMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveLayoutMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveLayoutMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveLayoutMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveLayoutMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveLayoutMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveLayoutMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveLayoutMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveLayoutMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveLayoutMethod "xyToIndex" o = LayoutXyToIndexMethodInfo
    ResolveLayoutMethod "getAlignment" o = LayoutGetAlignmentMethodInfo
    ResolveLayoutMethod "getAttributes" o = LayoutGetAttributesMethodInfo
    ResolveLayoutMethod "getAutoDir" o = LayoutGetAutoDirMethodInfo
    ResolveLayoutMethod "getBaseline" o = LayoutGetBaselineMethodInfo
    ResolveLayoutMethod "getCharacterCount" o = LayoutGetCharacterCountMethodInfo
    ResolveLayoutMethod "getContext" o = LayoutGetContextMethodInfo
    ResolveLayoutMethod "getCursorPos" o = LayoutGetCursorPosMethodInfo
    ResolveLayoutMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveLayoutMethod "getEllipsize" o = LayoutGetEllipsizeMethodInfo
    ResolveLayoutMethod "getExtents" o = LayoutGetExtentsMethodInfo
    ResolveLayoutMethod "getFontDescription" o = LayoutGetFontDescriptionMethodInfo
    ResolveLayoutMethod "getHeight" o = LayoutGetHeightMethodInfo
    ResolveLayoutMethod "getIndent" o = LayoutGetIndentMethodInfo
    ResolveLayoutMethod "getIter" o = LayoutGetIterMethodInfo
    ResolveLayoutMethod "getJustify" o = LayoutGetJustifyMethodInfo
    ResolveLayoutMethod "getLine" o = LayoutGetLineMethodInfo
    ResolveLayoutMethod "getLineCount" o = LayoutGetLineCountMethodInfo
    ResolveLayoutMethod "getLineReadonly" o = LayoutGetLineReadonlyMethodInfo
    ResolveLayoutMethod "getLines" o = LayoutGetLinesMethodInfo
    ResolveLayoutMethod "getLinesReadonly" o = LayoutGetLinesReadonlyMethodInfo
    ResolveLayoutMethod "getLogAttrs" o = LayoutGetLogAttrsMethodInfo
    ResolveLayoutMethod "getLogAttrsReadonly" o = LayoutGetLogAttrsReadonlyMethodInfo
    ResolveLayoutMethod "getPixelExtents" o = LayoutGetPixelExtentsMethodInfo
    ResolveLayoutMethod "getPixelSize" o = LayoutGetPixelSizeMethodInfo
    ResolveLayoutMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveLayoutMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveLayoutMethod "getSerial" o = LayoutGetSerialMethodInfo
    ResolveLayoutMethod "getSingleParagraphMode" o = LayoutGetSingleParagraphModeMethodInfo
    ResolveLayoutMethod "getSize" o = LayoutGetSizeMethodInfo
    ResolveLayoutMethod "getSpacing" o = LayoutGetSpacingMethodInfo
    ResolveLayoutMethod "getTabs" o = LayoutGetTabsMethodInfo
    ResolveLayoutMethod "getText" o = LayoutGetTextMethodInfo
    ResolveLayoutMethod "getUnknownGlyphsCount" o = LayoutGetUnknownGlyphsCountMethodInfo
    ResolveLayoutMethod "getWidth" o = LayoutGetWidthMethodInfo
    ResolveLayoutMethod "getWrap" o = LayoutGetWrapMethodInfo
    ResolveLayoutMethod "setAlignment" o = LayoutSetAlignmentMethodInfo
    ResolveLayoutMethod "setAttributes" o = LayoutSetAttributesMethodInfo
    ResolveLayoutMethod "setAutoDir" o = LayoutSetAutoDirMethodInfo
    ResolveLayoutMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveLayoutMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveLayoutMethod "setEllipsize" o = LayoutSetEllipsizeMethodInfo
    ResolveLayoutMethod "setFontDescription" o = LayoutSetFontDescriptionMethodInfo
    ResolveLayoutMethod "setHeight" o = LayoutSetHeightMethodInfo
    ResolveLayoutMethod "setIndent" o = LayoutSetIndentMethodInfo
    ResolveLayoutMethod "setJustify" o = LayoutSetJustifyMethodInfo
    ResolveLayoutMethod "setMarkup" o = LayoutSetMarkupMethodInfo
    ResolveLayoutMethod "setMarkupWithAccel" o = LayoutSetMarkupWithAccelMethodInfo
    ResolveLayoutMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveLayoutMethod "setSingleParagraphMode" o = LayoutSetSingleParagraphModeMethodInfo
    ResolveLayoutMethod "setSpacing" o = LayoutSetSpacingMethodInfo
    ResolveLayoutMethod "setTabs" o = LayoutSetTabsMethodInfo
    ResolveLayoutMethod "setText" o = LayoutSetTextMethodInfo
    ResolveLayoutMethod "setWidth" o = LayoutSetWidthMethodInfo
    ResolveLayoutMethod "setWrap" o = LayoutSetWrapMethodInfo
    ResolveLayoutMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveLayoutMethod t Layout, O.MethodInfo info Layout p) => OL.IsLabel t (Layout -> 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

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

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
type instance O.SignalList Layout = LayoutSignalList
type LayoutSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method Layout::new
-- method type : Constructor
-- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Pango", name = "Context"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoContext", 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_new" pango_layout_new ::
    Ptr Pango.Context.Context ->            -- context : TInterface (Name {namespace = "Pango", name = "Context"})
    IO (Ptr Layout)

{- |
Create a new 'GI.Pango.Objects.Layout.Layout' object with attributes initialized to
default values for a particular 'GI.Pango.Objects.Context.Context'.
-}
layoutNew ::
    (B.CallStack.HasCallStack, MonadIO m, Pango.Context.IsContext a) =>
    a
    {- ^ /@context@/: a 'GI.Pango.Objects.Context.Context' -}
    -> m Layout
    {- ^ __Returns:__ the newly allocated 'GI.Pango.Objects.Layout.Layout', with a reference
              count of one, which should be freed with
              'GI.GObject.Objects.Object.objectUnref'. -}
layoutNew context = liftIO $ do
    context' <- unsafeManagedPtrCastPtr context
    result <- pango_layout_new context'
    checkUnexpectedReturnNULL "layoutNew" result
    result' <- (wrapObject Layout) result
    touchManagedPtr context
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Layout::context_changed
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", 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_context_changed" pango_layout_context_changed ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO ()

{- |
Forces recomputation of any state in the 'GI.Pango.Objects.Layout.Layout' that
might depend on the layout\'s context. This function should
be called if you make changes to the context subsequent
to creating the layout.
-}
layoutContextChanged ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m ()
layoutContextChanged layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    pango_layout_context_changed layout'
    touchManagedPtr layout
    return ()

#if ENABLE_OVERLOADING
data LayoutContextChangedMethodInfo
instance (signature ~ (m ()), MonadIO m, IsLayout a) => O.MethodInfo LayoutContextChangedMethodInfo a signature where
    overloadedMethod _ = layoutContextChanged

#endif

-- method Layout::copy
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", 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_copy" pango_layout_copy ::
    Ptr Layout ->                           -- src : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO (Ptr Layout)

{- |
Does a deep copy-by-value of the /@src@/ layout. The attribute list,
tab array, and text from the original layout are all copied by
value.
-}
layoutCopy ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@src@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m Layout
    {- ^ __Returns:__ the newly allocated 'GI.Pango.Objects.Layout.Layout',
              with a reference count of one, which should be freed
              with 'GI.GObject.Objects.Object.objectUnref'. -}
layoutCopy src = liftIO $ do
    src' <- unsafeManagedPtrCastPtr src
    result <- pango_layout_copy src'
    checkUnexpectedReturnNULL "layoutCopy" result
    result' <- (wrapObject Layout) result
    touchManagedPtr src
    return result'

#if ENABLE_OVERLOADING
data LayoutCopyMethodInfo
instance (signature ~ (m Layout), MonadIO m, IsLayout a) => O.MethodInfo LayoutCopyMethodInfo a signature where
    overloadedMethod _ = layoutCopy

#endif

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

foreign import ccall "pango_layout_get_alignment" pango_layout_get_alignment ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO CUInt

{- |
Gets the alignment for the layout: how partial lines are
positioned within the horizontal space available.
-}
layoutGetAlignment ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m Pango.Enums.Alignment
    {- ^ __Returns:__ the alignment. -}
layoutGetAlignment layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_alignment layout'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr layout
    return result'

#if ENABLE_OVERLOADING
data LayoutGetAlignmentMethodInfo
instance (signature ~ (m Pango.Enums.Alignment), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetAlignmentMethodInfo a signature where
    overloadedMethod _ = layoutGetAlignment

#endif

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

foreign import ccall "pango_layout_get_attributes" pango_layout_get_attributes ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO (Ptr Pango.AttrList.AttrList)

{- |
Gets the attribute list for the layout, if any.
-}
layoutGetAttributes ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m Pango.AttrList.AttrList
    {- ^ __Returns:__ a 'GI.Pango.Structs.AttrList.AttrList'. -}
layoutGetAttributes layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_attributes layout'
    checkUnexpectedReturnNULL "layoutGetAttributes" result
    result' <- (newBoxed Pango.AttrList.AttrList) result
    touchManagedPtr layout
    return result'

#if ENABLE_OVERLOADING
data LayoutGetAttributesMethodInfo
instance (signature ~ (m Pango.AttrList.AttrList), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetAttributesMethodInfo a signature where
    overloadedMethod _ = layoutGetAttributes

#endif

-- method Layout::get_auto_dir
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", 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_get_auto_dir" pango_layout_get_auto_dir ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO CInt

{- |
Gets whether to calculate the bidirectional base direction
for the layout according to the contents of the layout.
See 'GI.Pango.Objects.Layout.layoutSetAutoDir'.

/Since: 1.4/
-}
layoutGetAutoDir ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the bidirectional base direction
  is computed from the layout\'s contents, 'False' otherwise. -}
layoutGetAutoDir layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_auto_dir layout'
    let result' = (/= 0) result
    touchManagedPtr layout
    return result'

#if ENABLE_OVERLOADING
data LayoutGetAutoDirMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetAutoDirMethodInfo a signature where
    overloadedMethod _ = layoutGetAutoDir

#endif

-- method Layout::get_baseline
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", 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_get_baseline" pango_layout_get_baseline ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO Int32

{- |
Gets the Y position of baseline of the first line in /@layout@/.

/Since: 1.22/
-}
layoutGetBaseline ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m Int32
    {- ^ __Returns:__ baseline of first line, from top of /@layout@/. -}
layoutGetBaseline layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_baseline layout'
    touchManagedPtr layout
    return result

#if ENABLE_OVERLOADING
data LayoutGetBaselineMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetBaselineMethodInfo a signature where
    overloadedMethod _ = layoutGetBaseline

#endif

-- method Layout::get_character_count
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", 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_get_character_count" pango_layout_get_character_count ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO Int32

{- |
Returns the number of Unicode characters in the
the text of /@layout@/.

/Since: 1.30/
-}
layoutGetCharacterCount ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m Int32
    {- ^ __Returns:__ the number of Unicode characters
    in the text of /@layout@/ -}
layoutGetCharacterCount layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_character_count layout'
    touchManagedPtr layout
    return result

#if ENABLE_OVERLOADING
data LayoutGetCharacterCountMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetCharacterCountMethodInfo a signature where
    overloadedMethod _ = layoutGetCharacterCount

#endif

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

foreign import ccall "pango_layout_get_context" pango_layout_get_context ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO (Ptr Pango.Context.Context)

{- |
Retrieves the 'GI.Pango.Objects.Context.Context' used for this layout.
-}
layoutGetContext ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m Pango.Context.Context
    {- ^ __Returns:__ the 'GI.Pango.Objects.Context.Context' for the layout.
This does not have an additional refcount added, so if you want to
keep a copy of this around, you must reference it yourself. -}
layoutGetContext layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_context layout'
    checkUnexpectedReturnNULL "layoutGetContext" result
    result' <- (newObject Pango.Context.Context) result
    touchManagedPtr layout
    return result'

#if ENABLE_OVERLOADING
data LayoutGetContextMethodInfo
instance (signature ~ (m Pango.Context.Context), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetContextMethodInfo a signature where
    overloadedMethod _ = layoutGetContext

#endif

-- method Layout::get_cursor_pos
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "index_", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the byte index of the cursor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "strong_pos", argType = TInterface (Name {namespace = "Pango", name = "Rectangle"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store the strong cursor position\n                    (may be %NULL)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "weak_pos", argType = TInterface (Name {namespace = "Pango", name = "Rectangle"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store the weak cursor position (may be %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_get_cursor_pos" pango_layout_get_cursor_pos ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    Int32 ->                                -- index_ : TBasicType TInt
    Ptr Pango.Rectangle.Rectangle ->        -- strong_pos : TInterface (Name {namespace = "Pango", name = "Rectangle"})
    Ptr Pango.Rectangle.Rectangle ->        -- weak_pos : TInterface (Name {namespace = "Pango", name = "Rectangle"})
    IO ()

{- |
Given an index within a layout, determines the positions that of the
strong and weak cursors if the insertion point is at that
index. The position of each cursor is stored as a zero-width
rectangle. The strong cursor location is the location where
characters of the directionality equal to the base direction of the
layout are inserted.  The weak cursor location is the location
where characters of the directionality opposite to the base
direction of the layout are inserted.
-}
layoutGetCursorPos ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> Int32
    {- ^ /@index_@/: the byte index of the cursor -}
    -> m ((Pango.Rectangle.Rectangle, Pango.Rectangle.Rectangle))
layoutGetCursorPos layout index_ = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    strongPos <- callocBytes 16 :: IO (Ptr Pango.Rectangle.Rectangle)
    weakPos <- callocBytes 16 :: IO (Ptr Pango.Rectangle.Rectangle)
    pango_layout_get_cursor_pos layout' index_ strongPos weakPos
    strongPos' <- (wrapPtr Pango.Rectangle.Rectangle) strongPos
    weakPos' <- (wrapPtr Pango.Rectangle.Rectangle) weakPos
    touchManagedPtr layout
    return (strongPos', weakPos')

#if ENABLE_OVERLOADING
data LayoutGetCursorPosMethodInfo
instance (signature ~ (Int32 -> m ((Pango.Rectangle.Rectangle, Pango.Rectangle.Rectangle))), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetCursorPosMethodInfo a signature where
    overloadedMethod _ = layoutGetCursorPos

#endif

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

foreign import ccall "pango_layout_get_ellipsize" pango_layout_get_ellipsize ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO CUInt

{- |
Gets the type of ellipsization being performed for /@layout@/.
See 'GI.Pango.Objects.Layout.layoutSetEllipsize'

/Since: 1.6/
-}
layoutGetEllipsize ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m Pango.Enums.EllipsizeMode
    {- ^ __Returns:__ the current ellipsization mode for /@layout@/.

Use 'GI.Pango.Objects.Layout.layoutIsEllipsized' to query whether any paragraphs
were actually ellipsized. -}
layoutGetEllipsize layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_ellipsize layout'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr layout
    return result'

#if ENABLE_OVERLOADING
data LayoutGetEllipsizeMethodInfo
instance (signature ~ (m Pango.Enums.EllipsizeMode), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetEllipsizeMethodInfo a signature where
    overloadedMethod _ = layoutGetEllipsize

#endif

-- method Layout::get_extents
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", 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 used to store the extents of the\n                  layout as drawn or %NULL to indicate that the result is\n                  not needed.", 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 used to store the logical\n                     extents of the layout or %NULL to indicate that the\n                     result is not needed.", 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_get_extents" pango_layout_get_extents ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    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 ()

{- |
Computes the logical and ink extents of /@layout@/. Logical extents
are usually what you want for positioning things.  Note that both extents
may have non-zero x and y.  You may want to use those to offset where you
render the layout.  Not doing that is a very typical bug that shows up as
right-to-left layouts not being correctly positioned in a layout with
a set width.

The extents are given in layout coordinates and in Pango units; layout
coordinates begin at the top left corner of the layout.
-}
layoutGetExtents ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m ((Pango.Rectangle.Rectangle, Pango.Rectangle.Rectangle))
layoutGetExtents layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    inkRect <- callocBytes 16 :: IO (Ptr Pango.Rectangle.Rectangle)
    logicalRect <- callocBytes 16 :: IO (Ptr Pango.Rectangle.Rectangle)
    pango_layout_get_extents layout' inkRect logicalRect
    inkRect' <- (wrapPtr Pango.Rectangle.Rectangle) inkRect
    logicalRect' <- (wrapPtr Pango.Rectangle.Rectangle) logicalRect
    touchManagedPtr layout
    return (inkRect', logicalRect')

#if ENABLE_OVERLOADING
data LayoutGetExtentsMethodInfo
instance (signature ~ (m ((Pango.Rectangle.Rectangle, Pango.Rectangle.Rectangle))), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetExtentsMethodInfo a signature where
    overloadedMethod _ = layoutGetExtents

#endif

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

foreign import ccall "pango_layout_get_font_description" pango_layout_get_font_description ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO (Ptr Pango.FontDescription.FontDescription)

{- |
Gets the font description for the layout, if any.

/Since: 1.8/
-}
layoutGetFontDescription ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m (Maybe Pango.FontDescription.FontDescription)
    {- ^ __Returns:__ a pointer to the layout\'s font
 description, or 'Nothing' if the font description from the layout\'s
 context is inherited. This value is owned by the layout and must
 not be modified or freed. -}
layoutGetFontDescription layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_font_description layout'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed Pango.FontDescription.FontDescription) result'
        return result''
    touchManagedPtr layout
    return maybeResult

#if ENABLE_OVERLOADING
data LayoutGetFontDescriptionMethodInfo
instance (signature ~ (m (Maybe Pango.FontDescription.FontDescription)), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetFontDescriptionMethodInfo a signature where
    overloadedMethod _ = layoutGetFontDescription

#endif

-- method Layout::get_height
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", 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_get_height" pango_layout_get_height ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO Int32

{- |
Gets the height of layout used for ellipsization.  See
'GI.Pango.Objects.Layout.layoutSetHeight' for details.

/Since: 1.20/
-}
layoutGetHeight ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m Int32
    {- ^ __Returns:__ the height, in Pango units if positive, or
number of lines if negative. -}
layoutGetHeight layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_height layout'
    touchManagedPtr layout
    return result

#if ENABLE_OVERLOADING
data LayoutGetHeightMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetHeightMethodInfo a signature where
    overloadedMethod _ = layoutGetHeight

#endif

-- method Layout::get_indent
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", 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_get_indent" pango_layout_get_indent ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO Int32

{- |
Gets the paragraph indent width in Pango units. A negative value
indicates a hanging indentation.
-}
layoutGetIndent ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m Int32
    {- ^ __Returns:__ the indent in Pango units. -}
layoutGetIndent layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_indent layout'
    touchManagedPtr layout
    return result

#if ENABLE_OVERLOADING
data LayoutGetIndentMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetIndentMethodInfo a signature where
    overloadedMethod _ = layoutGetIndent

#endif

-- method Layout::get_iter
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", 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_get_iter" pango_layout_get_iter ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO (Ptr Pango.LayoutIter.LayoutIter)

{- |
Returns an iterator to iterate over the visual extents of the layout.
-}
layoutGetIter ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m Pango.LayoutIter.LayoutIter
    {- ^ __Returns:__ the new 'GI.Pango.Structs.LayoutIter.LayoutIter' that should be freed using
              'GI.Pango.Structs.LayoutIter.layoutIterFree'. -}
layoutGetIter layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_iter layout'
    checkUnexpectedReturnNULL "layoutGetIter" result
    result' <- (wrapBoxed Pango.LayoutIter.LayoutIter) result
    touchManagedPtr layout
    return result'

#if ENABLE_OVERLOADING
data LayoutGetIterMethodInfo
instance (signature ~ (m Pango.LayoutIter.LayoutIter), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetIterMethodInfo a signature where
    overloadedMethod _ = layoutGetIter

#endif

-- method Layout::get_justify
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", 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_get_justify" pango_layout_get_justify ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO CInt

{- |
Gets whether each complete line should be stretched to fill the entire
width of the layout.
-}
layoutGetJustify ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m Bool
    {- ^ __Returns:__ the justify. -}
layoutGetJustify layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_justify layout'
    let result' = (/= 0) result
    touchManagedPtr layout
    return result'

#if ENABLE_OVERLOADING
data LayoutGetJustifyMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetJustifyMethodInfo a signature where
    overloadedMethod _ = layoutGetJustify

#endif

-- method Layout::get_line
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "line", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the index of a line, which must be between 0 and\n       <literal>pango_layout_get_line_count(layout) - 1</literal>, inclusive.", 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_get_line" pango_layout_get_line ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    Int32 ->                                -- line : TBasicType TInt
    IO (Ptr Pango.LayoutLine.LayoutLine)

{- |
Retrieves a particular line from a 'GI.Pango.Objects.Layout.Layout'.

Use the faster 'GI.Pango.Objects.Layout.layoutGetLineReadonly' if you do not plan
to modify the contents of the line (glyphs, glyph widths, etc.).
-}
layoutGetLine ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> Int32
    {- ^ /@line@/: the index of a line, which must be between 0 and
       \<literal>pango_layout_get_line_count(layout) - 1\<\/literal>, inclusive. -}
    -> m (Maybe Pango.LayoutLine.LayoutLine)
    {- ^ __Returns:__ the requested
              'GI.Pango.Structs.LayoutLine.LayoutLine', or 'Nothing' if the index is out of
              range. This layout line can be ref\'ed and retained,
              but will become invalid if changes are made to the
              'GI.Pango.Objects.Layout.Layout'. -}
layoutGetLine layout line = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_line layout' line
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed Pango.LayoutLine.LayoutLine) result'
        return result''
    touchManagedPtr layout
    return maybeResult

#if ENABLE_OVERLOADING
data LayoutGetLineMethodInfo
instance (signature ~ (Int32 -> m (Maybe Pango.LayoutLine.LayoutLine)), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetLineMethodInfo a signature where
    overloadedMethod _ = layoutGetLine

#endif

-- method Layout::get_line_count
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#PangoLayout", 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_get_line_count" pango_layout_get_line_count ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO Int32

{- |
Retrieves the count of lines for the /@layout@/.
-}
layoutGetLineCount ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: 'GI.Pango.Objects.Layout.Layout' -}
    -> m Int32
    {- ^ __Returns:__ the line count. -}
layoutGetLineCount layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_line_count layout'
    touchManagedPtr layout
    return result

#if ENABLE_OVERLOADING
data LayoutGetLineCountMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetLineCountMethodInfo a signature where
    overloadedMethod _ = layoutGetLineCount

#endif

-- method Layout::get_line_readonly
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "line", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the index of a line, which must be between 0 and\n       <literal>pango_layout_get_line_count(layout) - 1</literal>, inclusive.", 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_get_line_readonly" pango_layout_get_line_readonly ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    Int32 ->                                -- line : TBasicType TInt
    IO (Ptr Pango.LayoutLine.LayoutLine)

{- |
Retrieves a particular line from a 'GI.Pango.Objects.Layout.Layout'.

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

/Since: 1.16/
-}
layoutGetLineReadonly ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> Int32
    {- ^ /@line@/: the index of a line, which must be between 0 and
       \<literal>pango_layout_get_line_count(layout) - 1\<\/literal>, inclusive. -}
    -> m (Maybe Pango.LayoutLine.LayoutLine)
    {- ^ __Returns:__ the requested
              'GI.Pango.Structs.LayoutLine.LayoutLine', or 'Nothing' if the index is out of
              range. This layout line can be ref\'ed and retained,
              but will become invalid if changes are made to the
              'GI.Pango.Objects.Layout.Layout'.  No changes should be made to the line. -}
layoutGetLineReadonly layout line = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_line_readonly layout' line
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed Pango.LayoutLine.LayoutLine) result'
        return result''
    touchManagedPtr layout
    return maybeResult

#if ENABLE_OVERLOADING
data LayoutGetLineReadonlyMethodInfo
instance (signature ~ (Int32 -> m (Maybe Pango.LayoutLine.LayoutLine)), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetLineReadonlyMethodInfo a signature where
    overloadedMethod _ = layoutGetLineReadonly

#endif

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

foreign import ccall "pango_layout_get_lines" pango_layout_get_lines ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO (Ptr (GSList (Ptr Pango.LayoutLine.LayoutLine)))

{- |
Returns the lines of the /@layout@/ as a list.

Use the faster 'GI.Pango.Objects.Layout.layoutGetLinesReadonly' if you do not plan
to modify the contents of the lines (glyphs, glyph widths, etc.).
-}
layoutGetLines ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m [Pango.LayoutLine.LayoutLine]
    {- ^ __Returns:__ a 'GI.GLib.Structs.SList.SList' containing
the lines in the layout. This points to internal data of the 'GI.Pango.Objects.Layout.Layout'
and must be used with care. It will become invalid on any change to the layout\'s
text or properties. -}
layoutGetLines layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_lines layout'
    result' <- unpackGSList result
    result'' <- mapM (newBoxed Pango.LayoutLine.LayoutLine) result'
    touchManagedPtr layout
    return result''

#if ENABLE_OVERLOADING
data LayoutGetLinesMethodInfo
instance (signature ~ (m [Pango.LayoutLine.LayoutLine]), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetLinesMethodInfo a signature where
    overloadedMethod _ = layoutGetLines

#endif

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

foreign import ccall "pango_layout_get_lines_readonly" pango_layout_get_lines_readonly ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO (Ptr (GSList (Ptr Pango.LayoutLine.LayoutLine)))

{- |
Returns the lines of the /@layout@/ as a list.

This is a faster alternative to 'GI.Pango.Objects.Layout.layoutGetLines',
but the user is not expected
to modify the contents of the lines (glyphs, glyph widths, etc.).

/Since: 1.16/
-}
layoutGetLinesReadonly ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m [Pango.LayoutLine.LayoutLine]
    {- ^ __Returns:__ a 'GI.GLib.Structs.SList.SList' containing
the lines in the layout. This points to internal data of the 'GI.Pango.Objects.Layout.Layout' and
must be used with care. It will become invalid on any change to the layout\'s
text or properties.  No changes should be made to the lines. -}
layoutGetLinesReadonly layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_lines_readonly layout'
    result' <- unpackGSList result
    result'' <- mapM (newBoxed Pango.LayoutLine.LayoutLine) result'
    touchManagedPtr layout
    return result''

#if ENABLE_OVERLOADING
data LayoutGetLinesReadonlyMethodInfo
instance (signature ~ (m [Pango.LayoutLine.LayoutLine]), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetLinesReadonlyMethodInfo a signature where
    overloadedMethod _ = layoutGetLinesReadonly

#endif

-- method Layout::get_log_attrs
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "attrs", argType = TCArray False (-1) 2 (TInterface (Name {namespace = "Pango", name = "LogAttr"})), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "\n        location to store a pointer to an array of logical attributes\n        This value must be freed with g_free().", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferContainer},Arg {argCName = "n_attrs", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store the number of the attributes in the\n          array. (The stored value will be one more than the total number\n          of characters in the layout, since there need to be attributes\n          corresponding to both the position before the first character\n          and the position after the last character.)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : [Arg {argCName = "n_attrs", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store the number of the attributes in the\n          array. (The stored value will be one more than the total number\n          of characters in the layout, since there need to be attributes\n          corresponding to both the position before the first character\n          and the position after the last character.)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "pango_layout_get_log_attrs" pango_layout_get_log_attrs ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    Ptr (Ptr Pango.LogAttr.LogAttr) ->      -- attrs : TCArray False (-1) 2 (TInterface (Name {namespace = "Pango", name = "LogAttr"}))
    Ptr Int32 ->                            -- n_attrs : TBasicType TInt
    IO ()

{- |
Retrieves an array of logical attributes for each character in
the /@layout@/.
-}
layoutGetLogAttrs ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m ([Pango.LogAttr.LogAttr])
layoutGetLogAttrs layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    attrs <- allocMem :: IO (Ptr (Ptr Pango.LogAttr.LogAttr))
    nAttrs <- allocMem :: IO (Ptr Int32)
    pango_layout_get_log_attrs layout' attrs nAttrs
    nAttrs' <- peek nAttrs
    attrs' <- peek attrs
    attrs'' <- (unpackBlockArrayWithLength 52 nAttrs') attrs'
    attrs''' <- mapM (newPtr Pango.LogAttr.LogAttr) attrs''
    freeMem attrs'
    touchManagedPtr layout
    freeMem attrs
    freeMem nAttrs
    return attrs'''

#if ENABLE_OVERLOADING
data LayoutGetLogAttrsMethodInfo
instance (signature ~ (m ([Pango.LogAttr.LogAttr])), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetLogAttrsMethodInfo a signature where
    overloadedMethod _ = layoutGetLogAttrs

#endif

-- method Layout::get_log_attrs_readonly
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_attrs", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store the number of the attributes in\n  the array", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : [Arg {argCName = "n_attrs", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store the number of the attributes in\n  the array", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- returnType : Just (TCArray False (-1) 1 (TInterface (Name {namespace = "Pango", name = "LogAttr"})))
-- throws : False
-- Skip return : False

foreign import ccall "pango_layout_get_log_attrs_readonly" pango_layout_get_log_attrs_readonly ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    Ptr Int32 ->                            -- n_attrs : TBasicType TInt
    IO (Ptr Pango.LogAttr.LogAttr)

{- |
Retrieves an array of logical attributes for each character in
the /@layout@/.

This is a faster alternative to 'GI.Pango.Objects.Layout.layoutGetLogAttrs'.
The returned array is part of /@layout@/ and must not be modified.
Modifying the layout will invalidate the returned array.

The number of attributes returned in /@nAttrs@/ will be one more
than the total number of characters in the layout, since there
need to be attributes corresponding to both the position before
the first character and the position after the last character.

/Since: 1.30/
-}
layoutGetLogAttrsReadonly ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m [Pango.LogAttr.LogAttr]
    {- ^ __Returns:__ an array of logical attributes -}
layoutGetLogAttrsReadonly layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    nAttrs <- allocMem :: IO (Ptr Int32)
    result <- pango_layout_get_log_attrs_readonly layout' nAttrs
    nAttrs' <- peek nAttrs
    checkUnexpectedReturnNULL "layoutGetLogAttrsReadonly" result
    result' <- (unpackBlockArrayWithLength 52 nAttrs') result
    result'' <- mapM (newPtr Pango.LogAttr.LogAttr) result'
    touchManagedPtr layout
    freeMem nAttrs
    return result''

#if ENABLE_OVERLOADING
data LayoutGetLogAttrsReadonlyMethodInfo
instance (signature ~ (m [Pango.LogAttr.LogAttr]), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetLogAttrsReadonlyMethodInfo a signature where
    overloadedMethod _ = layoutGetLogAttrsReadonly

#endif

-- method Layout::get_pixel_extents
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", 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 used to store the extents of the\n                  layout as drawn or %NULL to indicate that the result is\n                  not needed.", 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 used to store the logical\n                      extents of the layout or %NULL to indicate that the\n                      result is not needed.", 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_get_pixel_extents" pango_layout_get_pixel_extents ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    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 ()

{- |
Computes the logical and ink extents of /@layout@/ in device units.
This function just calls 'GI.Pango.Objects.Layout.layoutGetExtents' followed by
two 'GI.Pango.Functions.extentsToPixels' calls, rounding /@inkRect@/ and /@logicalRect@/
such that the rounded rectangles fully contain the unrounded one (that is,
passes them as first argument to 'GI.Pango.Functions.extentsToPixels').
-}
layoutGetPixelExtents ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m ((Pango.Rectangle.Rectangle, Pango.Rectangle.Rectangle))
layoutGetPixelExtents layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    inkRect <- callocBytes 16 :: IO (Ptr Pango.Rectangle.Rectangle)
    logicalRect <- callocBytes 16 :: IO (Ptr Pango.Rectangle.Rectangle)
    pango_layout_get_pixel_extents layout' inkRect logicalRect
    inkRect' <- (wrapPtr Pango.Rectangle.Rectangle) inkRect
    logicalRect' <- (wrapPtr Pango.Rectangle.Rectangle) logicalRect
    touchManagedPtr layout
    return (inkRect', logicalRect')

#if ENABLE_OVERLOADING
data LayoutGetPixelExtentsMethodInfo
instance (signature ~ (m ((Pango.Rectangle.Rectangle, Pango.Rectangle.Rectangle))), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetPixelExtentsMethodInfo a signature where
    overloadedMethod _ = layoutGetPixelExtents

#endif

-- method Layout::get_pixel_size
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "width", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store the logical width, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "height", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store the logical height, 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_get_pixel_size" pango_layout_get_pixel_size ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    Ptr Int32 ->                            -- width : TBasicType TInt
    Ptr Int32 ->                            -- height : TBasicType TInt
    IO ()

{- |
Determines the logical width and height of a 'GI.Pango.Objects.Layout.Layout'
in device units. ('GI.Pango.Objects.Layout.layoutGetSize' returns the width
and height scaled by 'GI.Pango.Constants.SCALE'.) This
is simply a convenience function around
'GI.Pango.Objects.Layout.layoutGetPixelExtents'.
-}
layoutGetPixelSize ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m ((Int32, Int32))
layoutGetPixelSize layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    width <- allocMem :: IO (Ptr Int32)
    height <- allocMem :: IO (Ptr Int32)
    pango_layout_get_pixel_size layout' width height
    width' <- peek width
    height' <- peek height
    touchManagedPtr layout
    freeMem width
    freeMem height
    return (width', height')

#if ENABLE_OVERLOADING
data LayoutGetPixelSizeMethodInfo
instance (signature ~ (m ((Int32, Int32))), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetPixelSizeMethodInfo a signature where
    overloadedMethod _ = layoutGetPixelSize

#endif

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

foreign import ccall "pango_layout_get_serial" pango_layout_get_serial ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO Word32

{- |
Returns the current serial number of /@layout@/.  The serial number is
initialized to an small number  larger than zero when a new layout
is created and is increased whenever the layout is changed using any
of the setter functions, or the 'GI.Pango.Objects.Context.Context' it uses has changed.
The serial may wrap, but will never have the value 0. Since it
can wrap, never compare it with \"less than\", always use \"not equals\".

This can be used to automatically detect changes to a 'GI.Pango.Objects.Layout.Layout', and
is useful for example to decide whether a layout needs redrawing.
To force the serial to be increased, use 'GI.Pango.Objects.Layout.layoutContextChanged'.

/Since: 1.32.4/
-}
layoutGetSerial ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m Word32
    {- ^ __Returns:__ The current serial number of /@layout@/. -}
layoutGetSerial layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_serial layout'
    touchManagedPtr layout
    return result

#if ENABLE_OVERLOADING
data LayoutGetSerialMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetSerialMethodInfo a signature where
    overloadedMethod _ = layoutGetSerial

#endif

-- method Layout::get_single_paragraph_mode
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", 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_get_single_paragraph_mode" pango_layout_get_single_paragraph_mode ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO CInt

{- |
Obtains the value set by 'GI.Pango.Objects.Layout.layoutSetSingleParagraphMode'.
-}
layoutGetSingleParagraphMode ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the layout does not break paragraphs at
paragraph separator characters, 'False' otherwise. -}
layoutGetSingleParagraphMode layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_single_paragraph_mode layout'
    let result' = (/= 0) result
    touchManagedPtr layout
    return result'

#if ENABLE_OVERLOADING
data LayoutGetSingleParagraphModeMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetSingleParagraphModeMethodInfo a signature where
    overloadedMethod _ = layoutGetSingleParagraphMode

#endif

-- method Layout::get_size
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "width", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store the logical width, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "height", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store the logical height, 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_get_size" pango_layout_get_size ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    Ptr Int32 ->                            -- width : TBasicType TInt
    Ptr Int32 ->                            -- height : TBasicType TInt
    IO ()

{- |
Determines the logical width and height of a 'GI.Pango.Objects.Layout.Layout'
in Pango units (device units scaled by 'GI.Pango.Constants.SCALE'). This
is simply a convenience function around 'GI.Pango.Objects.Layout.layoutGetExtents'.
-}
layoutGetSize ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m ((Int32, Int32))
layoutGetSize layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    width <- allocMem :: IO (Ptr Int32)
    height <- allocMem :: IO (Ptr Int32)
    pango_layout_get_size layout' width height
    width' <- peek width
    height' <- peek height
    touchManagedPtr layout
    freeMem width
    freeMem height
    return (width', height')

#if ENABLE_OVERLOADING
data LayoutGetSizeMethodInfo
instance (signature ~ (m ((Int32, Int32))), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetSizeMethodInfo a signature where
    overloadedMethod _ = layoutGetSize

#endif

-- method Layout::get_spacing
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", 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_get_spacing" pango_layout_get_spacing ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO Int32

{- |
Gets the amount of spacing between the lines of the layout.
-}
layoutGetSpacing ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m Int32
    {- ^ __Returns:__ the spacing in Pango units. -}
layoutGetSpacing layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_spacing layout'
    touchManagedPtr layout
    return result

#if ENABLE_OVERLOADING
data LayoutGetSpacingMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetSpacingMethodInfo a signature where
    overloadedMethod _ = layoutGetSpacing

#endif

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

foreign import ccall "pango_layout_get_tabs" pango_layout_get_tabs ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO (Ptr Pango.TabArray.TabArray)

{- |
Gets the current 'GI.Pango.Structs.TabArray.TabArray' used by this layout. If no
'GI.Pango.Structs.TabArray.TabArray' has been set, then the default tabs are in use
and 'Nothing' is returned. Default tabs are every 8 spaces.
The return value should be freed with 'GI.Pango.Structs.TabArray.tabArrayFree'.
-}
layoutGetTabs ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m (Maybe Pango.TabArray.TabArray)
    {- ^ __Returns:__ a copy of the tabs for this layout, or
'Nothing'. -}
layoutGetTabs layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_tabs layout'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Pango.TabArray.TabArray) result'
        return result''
    touchManagedPtr layout
    return maybeResult

#if ENABLE_OVERLOADING
data LayoutGetTabsMethodInfo
instance (signature ~ (m (Maybe Pango.TabArray.TabArray)), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetTabsMethodInfo a signature where
    overloadedMethod _ = layoutGetTabs

#endif

-- method Layout::get_text
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", 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 "pango_layout_get_text" pango_layout_get_text ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO CString

{- |
Gets the text in the layout. The returned text should not
be freed or modified.
-}
layoutGetText ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m T.Text
    {- ^ __Returns:__ the text in the /@layout@/. -}
layoutGetText layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_text layout'
    checkUnexpectedReturnNULL "layoutGetText" result
    result' <- cstringToText result
    touchManagedPtr layout
    return result'

#if ENABLE_OVERLOADING
data LayoutGetTextMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetTextMethodInfo a signature where
    overloadedMethod _ = layoutGetText

#endif

-- method Layout::get_unknown_glyphs_count
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", 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_get_unknown_glyphs_count" pango_layout_get_unknown_glyphs_count ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO Int32

{- |
Counts the number unknown glyphs in /@layout@/.  That is, zero if
glyphs for all characters in the layout text were found, or more
than zero otherwise.

This function can be used to determine if there are any fonts
available to render all characters in a certain string, or when
used in combination with 'GI.Pango.Enums.AttrTypeFallback', to check if a
certain font supports all the characters in the string.

/Since: 1.16/
-}
layoutGetUnknownGlyphsCount ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m Int32
    {- ^ __Returns:__ The number of unknown glyphs in /@layout@/. -}
layoutGetUnknownGlyphsCount layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_unknown_glyphs_count layout'
    touchManagedPtr layout
    return result

#if ENABLE_OVERLOADING
data LayoutGetUnknownGlyphsCountMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetUnknownGlyphsCountMethodInfo a signature where
    overloadedMethod _ = layoutGetUnknownGlyphsCount

#endif

-- method Layout::get_width
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", 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_get_width" pango_layout_get_width ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO Int32

{- |
Gets the width to which the lines of the 'GI.Pango.Objects.Layout.Layout' should wrap.
-}
layoutGetWidth ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m Int32
    {- ^ __Returns:__ the width in Pango units, or -1 if no width set. -}
layoutGetWidth layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_width layout'
    touchManagedPtr layout
    return result

#if ENABLE_OVERLOADING
data LayoutGetWidthMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetWidthMethodInfo a signature where
    overloadedMethod _ = layoutGetWidth

#endif

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

foreign import ccall "pango_layout_get_wrap" pango_layout_get_wrap ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO CUInt

{- |
Gets the wrap mode for the layout.

Use 'GI.Pango.Objects.Layout.layoutIsWrapped' to query whether any paragraphs
were actually wrapped.
-}
layoutGetWrap ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m Pango.Enums.WrapMode
    {- ^ __Returns:__ active wrap mode. -}
layoutGetWrap layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_get_wrap layout'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr layout
    return result'

#if ENABLE_OVERLOADING
data LayoutGetWrapMethodInfo
instance (signature ~ (m Pango.Enums.WrapMode), MonadIO m, IsLayout a) => O.MethodInfo LayoutGetWrapMethodInfo a signature where
    overloadedMethod _ = layoutGetWrap

#endif

-- method Layout::index_to_line_x
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "index_", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the byte index of a grapheme within the layout.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "trailing", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an integer indicating the edge of the grapheme to retrieve the\n            position of. If > 0, the trailing edge of the grapheme, if 0,\n            the leading of the grapheme.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "line", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store resulting line index. (which will\n              between 0 and pango_layout_get_line_count(layout) - 1), or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "x_pos", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store resulting position within line\n             (%PANGO_SCALE units per device unit), 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_index_to_line_x" pango_layout_index_to_line_x ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    Int32 ->                                -- index_ : TBasicType TInt
    CInt ->                                 -- trailing : TBasicType TBoolean
    Ptr Int32 ->                            -- line : TBasicType TInt
    Ptr Int32 ->                            -- x_pos : TBasicType TInt
    IO ()

{- |
Converts from byte /@index_@/ within the /@layout@/ to line and X position.
(X position is measured from the left edge of the line)
-}
layoutIndexToLineX ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> Int32
    {- ^ /@index_@/: the byte index of a grapheme within the layout. -}
    -> Bool
    {- ^ /@trailing@/: an integer indicating the edge of the grapheme to retrieve the
            position of. If > 0, the trailing edge of the grapheme, if 0,
            the leading of the grapheme. -}
    -> m ((Int32, Int32))
layoutIndexToLineX layout index_ trailing = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    let trailing' = (fromIntegral . fromEnum) trailing
    line <- allocMem :: IO (Ptr Int32)
    xPos <- allocMem :: IO (Ptr Int32)
    pango_layout_index_to_line_x layout' index_ trailing' line xPos
    line' <- peek line
    xPos' <- peek xPos
    touchManagedPtr layout
    freeMem line
    freeMem xPos
    return (line', xPos')

#if ENABLE_OVERLOADING
data LayoutIndexToLineXMethodInfo
instance (signature ~ (Int32 -> Bool -> m ((Int32, Int32))), MonadIO m, IsLayout a) => O.MethodInfo LayoutIndexToLineXMethodInfo a signature where
    overloadedMethod _ = layoutIndexToLineX

#endif

-- method Layout::index_to_pos
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "index_", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "byte index within @layout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "pos", argType = TInterface (Name {namespace = "Pango", name = "Rectangle"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "rectangle in which to store the position of the grapheme", 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_index_to_pos" pango_layout_index_to_pos ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    Int32 ->                                -- index_ : TBasicType TInt
    Ptr Pango.Rectangle.Rectangle ->        -- pos : TInterface (Name {namespace = "Pango", name = "Rectangle"})
    IO ()

{- |
Converts from an index within a 'GI.Pango.Objects.Layout.Layout' to the onscreen position
corresponding to the grapheme at that index, which is represented
as rectangle.  Note that \<literal>pos->x\<\/literal> is always the leading
edge of the grapheme and \<literal>pos->x + pos->width\<\/literal> the trailing
edge of the grapheme. If the directionality of the grapheme is right-to-left,
then \<literal>pos->width\<\/literal> will be negative.
-}
layoutIndexToPos ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> Int32
    {- ^ /@index_@/: byte index within /@layout@/ -}
    -> m (Pango.Rectangle.Rectangle)
layoutIndexToPos layout index_ = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    pos <- callocBytes 16 :: IO (Ptr Pango.Rectangle.Rectangle)
    pango_layout_index_to_pos layout' index_ pos
    pos' <- (wrapPtr Pango.Rectangle.Rectangle) pos
    touchManagedPtr layout
    return pos'

#if ENABLE_OVERLOADING
data LayoutIndexToPosMethodInfo
instance (signature ~ (Int32 -> m (Pango.Rectangle.Rectangle)), MonadIO m, IsLayout a) => O.MethodInfo LayoutIndexToPosMethodInfo a signature where
    overloadedMethod _ = layoutIndexToPos

#endif

-- method Layout::is_ellipsized
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", 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_is_ellipsized" pango_layout_is_ellipsized ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO CInt

{- |
Queries whether the layout had to ellipsize any paragraphs.

This returns 'True' if the ellipsization mode for /@layout@/
is not 'GI.Pango.Enums.EllipsizeModeNone', a positive width is set on /@layout@/,
and there are paragraphs exceeding that width that have to be
ellipsized.

/Since: 1.16/
-}
layoutIsEllipsized ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if any paragraphs had to be ellipsized, 'False'
otherwise. -}
layoutIsEllipsized layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_is_ellipsized layout'
    let result' = (/= 0) result
    touchManagedPtr layout
    return result'

#if ENABLE_OVERLOADING
data LayoutIsEllipsizedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsLayout a) => O.MethodInfo LayoutIsEllipsizedMethodInfo a signature where
    overloadedMethod _ = layoutIsEllipsized

#endif

-- method Layout::is_wrapped
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", 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_is_wrapped" pango_layout_is_wrapped ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    IO CInt

{- |
Queries whether the layout had to wrap any paragraphs.

This returns 'True' if a positive width is set on /@layout@/,
ellipsization mode of /@layout@/ is set to 'GI.Pango.Enums.EllipsizeModeNone',
and there are paragraphs exceeding the layout width that have
to be wrapped.

/Since: 1.16/
-}
layoutIsWrapped ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if any paragraphs had to be wrapped, 'False'
otherwise. -}
layoutIsWrapped layout = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    result <- pango_layout_is_wrapped layout'
    let result' = (/= 0) result
    touchManagedPtr layout
    return result'

#if ENABLE_OVERLOADING
data LayoutIsWrappedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsLayout a) => O.MethodInfo LayoutIsWrappedMethodInfo a signature where
    overloadedMethod _ = layoutIsWrapped

#endif

-- method Layout::move_cursor_visually
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "strong", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "whether the moving cursor is the strong cursor or the\n               weak cursor. The strong cursor is the cursor corresponding\n               to text insertion in the base direction for the layout.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "old_index", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the byte index of the grapheme for the old index", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "old_trailing", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if 0, the cursor was at the leading edge of the\n               grapheme indicated by @old_index, if > 0, the cursor\n               was at the trailing edge.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "direction", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "direction to move cursor. A negative\n               value indicates motion to the left.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "new_index", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store the new cursor byte index. A value of -1\n               indicates that the cursor has been moved off the beginning\n               of the layout. A value of %G_MAXINT indicates that\n               the cursor has been moved off the end of the layout.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "new_trailing", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of characters to move forward from the\n               location returned for @new_index to get the position\n               where the cursor should be displayed. This allows\n               distinguishing the position at the beginning of one\n               line from the position at the end of the preceding\n               line. @new_index is always on the line where the\n               cursor should be displayed.", 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_move_cursor_visually" pango_layout_move_cursor_visually ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    CInt ->                                 -- strong : TBasicType TBoolean
    Int32 ->                                -- old_index : TBasicType TInt
    Int32 ->                                -- old_trailing : TBasicType TInt
    Int32 ->                                -- direction : TBasicType TInt
    Ptr Int32 ->                            -- new_index : TBasicType TInt
    Ptr Int32 ->                            -- new_trailing : TBasicType TInt
    IO ()

{- |
Computes a new cursor position from an old position and
a count of positions to move visually. If /@direction@/ is positive,
then the new strong cursor position will be one position
to the right of the old cursor position. If /@direction@/ is negative,
then the new strong cursor position will be one position
to the left of the old cursor position.

In the presence of bidirectional text, the correspondence
between logical and visual order will depend on the direction
of the current run, and there may be jumps when the cursor
is moved off of the end of a run.

Motion here is in cursor positions, not in characters, so a
single call to 'GI.Pango.Objects.Layout.layoutMoveCursorVisually' may move the
cursor over multiple characters when multiple characters combine
to form a single grapheme.
-}
layoutMoveCursorVisually ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout'. -}
    -> Bool
    {- ^ /@strong@/: whether the moving cursor is the strong cursor or the
               weak cursor. The strong cursor is the cursor corresponding
               to text insertion in the base direction for the layout. -}
    -> Int32
    {- ^ /@oldIndex@/: the byte index of the grapheme for the old index -}
    -> Int32
    {- ^ /@oldTrailing@/: if 0, the cursor was at the leading edge of the
               grapheme indicated by /@oldIndex@/, if > 0, the cursor
               was at the trailing edge. -}
    -> Int32
    {- ^ /@direction@/: direction to move cursor. A negative
               value indicates motion to the left. -}
    -> m ((Int32, Int32))
layoutMoveCursorVisually layout strong oldIndex oldTrailing direction = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    let strong' = (fromIntegral . fromEnum) strong
    newIndex <- allocMem :: IO (Ptr Int32)
    newTrailing <- allocMem :: IO (Ptr Int32)
    pango_layout_move_cursor_visually layout' strong' oldIndex oldTrailing direction newIndex newTrailing
    newIndex' <- peek newIndex
    newTrailing' <- peek newTrailing
    touchManagedPtr layout
    freeMem newIndex
    freeMem newTrailing
    return (newIndex', newTrailing')

#if ENABLE_OVERLOADING
data LayoutMoveCursorVisuallyMethodInfo
instance (signature ~ (Bool -> Int32 -> Int32 -> Int32 -> m ((Int32, Int32))), MonadIO m, IsLayout a) => O.MethodInfo LayoutMoveCursorVisuallyMethodInfo a signature where
    overloadedMethod _ = layoutMoveCursorVisually

#endif

-- method Layout::set_alignment
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "alignment", argType = TInterface (Name {namespace = "Pango", name = "Alignment"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the alignment", 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_set_alignment" pango_layout_set_alignment ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    CUInt ->                                -- alignment : TInterface (Name {namespace = "Pango", name = "Alignment"})
    IO ()

{- |
Sets the alignment for the layout: how partial lines are
positioned within the horizontal space available.
-}
layoutSetAlignment ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> Pango.Enums.Alignment
    {- ^ /@alignment@/: the alignment -}
    -> m ()
layoutSetAlignment layout alignment = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    let alignment' = (fromIntegral . fromEnum) alignment
    pango_layout_set_alignment layout' alignment'
    touchManagedPtr layout
    return ()

#if ENABLE_OVERLOADING
data LayoutSetAlignmentMethodInfo
instance (signature ~ (Pango.Enums.Alignment -> m ()), MonadIO m, IsLayout a) => O.MethodInfo LayoutSetAlignmentMethodInfo a signature where
    overloadedMethod _ = layoutSetAlignment

#endif

-- method Layout::set_attributes
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "attrs", argType = TInterface (Name {namespace = "Pango", name = "AttrList"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #PangoAttrList, can 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_set_attributes" pango_layout_set_attributes ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    Ptr Pango.AttrList.AttrList ->          -- attrs : TInterface (Name {namespace = "Pango", name = "AttrList"})
    IO ()

{- |
Sets the text attributes for a layout object.
References /@attrs@/, so the caller can unref its reference.
-}
layoutSetAttributes ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> Maybe (Pango.AttrList.AttrList)
    {- ^ /@attrs@/: a 'GI.Pango.Structs.AttrList.AttrList', can be 'Nothing' -}
    -> m ()
layoutSetAttributes layout attrs = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    maybeAttrs <- case attrs of
        Nothing -> return nullPtr
        Just jAttrs -> do
            jAttrs' <- unsafeManagedPtrGetPtr jAttrs
            return jAttrs'
    pango_layout_set_attributes layout' maybeAttrs
    touchManagedPtr layout
    whenJust attrs touchManagedPtr
    return ()

#if ENABLE_OVERLOADING
data LayoutSetAttributesMethodInfo
instance (signature ~ (Maybe (Pango.AttrList.AttrList) -> m ()), MonadIO m, IsLayout a) => O.MethodInfo LayoutSetAttributesMethodInfo a signature where
    overloadedMethod _ = layoutSetAttributes

#endif

-- method Layout::set_auto_dir
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "auto_dir", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if %TRUE, compute the bidirectional base direction\n  from the layout's contents.", 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_set_auto_dir" pango_layout_set_auto_dir ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    CInt ->                                 -- auto_dir : TBasicType TBoolean
    IO ()

{- |
Sets whether to calculate the bidirectional base direction
for the layout according to the contents of the layout;
when this flag is on (the default), then paragraphs in
   /@layout@/ that begin with strong right-to-left characters
(Arabic and Hebrew principally), will have right-to-left
layout, paragraphs with letters from other scripts will
have left-to-right layout. Paragraphs with only neutral
characters get their direction from the surrounding paragraphs.

When 'False', the choice between left-to-right and
right-to-left layout is done according to the base direction
of the layout\'s 'GI.Pango.Objects.Context.Context'. (See 'GI.Pango.Objects.Context.contextSetBaseDir').

When the auto-computed direction of a paragraph differs from the
base direction of the context, the interpretation of
'GI.Pango.Enums.AlignmentLeft' and 'GI.Pango.Enums.AlignmentRight' are swapped.

/Since: 1.4/
-}
layoutSetAutoDir ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> Bool
    {- ^ /@autoDir@/: if 'True', compute the bidirectional base direction
  from the layout\'s contents. -}
    -> m ()
layoutSetAutoDir layout autoDir = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    let autoDir' = (fromIntegral . fromEnum) autoDir
    pango_layout_set_auto_dir layout' autoDir'
    touchManagedPtr layout
    return ()

#if ENABLE_OVERLOADING
data LayoutSetAutoDirMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsLayout a) => O.MethodInfo LayoutSetAutoDirMethodInfo a signature where
    overloadedMethod _ = layoutSetAutoDir

#endif

-- method Layout::set_ellipsize
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "ellipsize", argType = TInterface (Name {namespace = "Pango", name = "EllipsizeMode"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new ellipsization mode for @layout", 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_set_ellipsize" pango_layout_set_ellipsize ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    CUInt ->                                -- ellipsize : TInterface (Name {namespace = "Pango", name = "EllipsizeMode"})
    IO ()

{- |
Sets the type of ellipsization being performed for /@layout@/.
Depending on the ellipsization mode /@ellipsize@/ text is
removed from the start, middle, or end of text so they
fit within the width and height of layout set with
'GI.Pango.Objects.Layout.layoutSetWidth' and 'GI.Pango.Objects.Layout.layoutSetHeight'.

If the layout contains characters such as newlines that
force it to be layed out in multiple paragraphs, then whether
each paragraph is ellipsized separately or the entire layout
is ellipsized as a whole depends on the set height of the layout.
See 'GI.Pango.Objects.Layout.layoutSetHeight' for details.

/Since: 1.6/
-}
layoutSetEllipsize ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> Pango.Enums.EllipsizeMode
    {- ^ /@ellipsize@/: the new ellipsization mode for /@layout@/ -}
    -> m ()
layoutSetEllipsize layout ellipsize = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    let ellipsize' = (fromIntegral . fromEnum) ellipsize
    pango_layout_set_ellipsize layout' ellipsize'
    touchManagedPtr layout
    return ()

#if ENABLE_OVERLOADING
data LayoutSetEllipsizeMethodInfo
instance (signature ~ (Pango.Enums.EllipsizeMode -> m ()), MonadIO m, IsLayout a) => O.MethodInfo LayoutSetEllipsizeMethodInfo a signature where
    overloadedMethod _ = layoutSetEllipsize

#endif

-- method Layout::set_font_description
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "desc", argType = TInterface (Name {namespace = "Pango", name = "FontDescription"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the new #PangoFontDescription, or %NULL to unset the\n       current font description", 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_set_font_description" pango_layout_set_font_description ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    Ptr Pango.FontDescription.FontDescription -> -- desc : TInterface (Name {namespace = "Pango", name = "FontDescription"})
    IO ()

{- |
Sets the default font description for the layout. If no font
description is set on the layout, the font description from
the layout\'s context is used.
-}
layoutSetFontDescription ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> Maybe (Pango.FontDescription.FontDescription)
    {- ^ /@desc@/: the new 'GI.Pango.Structs.FontDescription.FontDescription', or 'Nothing' to unset the
       current font description -}
    -> m ()
layoutSetFontDescription layout desc = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    maybeDesc <- case desc of
        Nothing -> return nullPtr
        Just jDesc -> do
            jDesc' <- unsafeManagedPtrGetPtr jDesc
            return jDesc'
    pango_layout_set_font_description layout' maybeDesc
    touchManagedPtr layout
    whenJust desc touchManagedPtr
    return ()

#if ENABLE_OVERLOADING
data LayoutSetFontDescriptionMethodInfo
instance (signature ~ (Maybe (Pango.FontDescription.FontDescription) -> m ()), MonadIO m, IsLayout a) => O.MethodInfo LayoutSetFontDescriptionMethodInfo a signature where
    overloadedMethod _ = layoutSetFontDescription

#endif

-- method Layout::set_height
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "height", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the desired height of the layout in Pango units if positive,\n         or desired number of lines if negative.", 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_set_height" pango_layout_set_height ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    Int32 ->                                -- height : TBasicType TInt
    IO ()

{- |
Sets the height to which the 'GI.Pango.Objects.Layout.Layout' should be ellipsized at.  There
are two different behaviors, based on whether /@height@/ is positive or
negative.

If /@height@/ is positive, it will be the maximum height of the layout.  Only
lines would be shown that would fit, and if there is any text omitted,
an ellipsis added.  At least one line is included in each paragraph regardless
of how small the height value is.  A value of zero will render exactly one
line for the entire layout.

If /@height@/ is negative, it will be the (negative of) maximum number of lines per
paragraph.  That is, the total number of lines shown may well be more than
this value if the layout contains multiple paragraphs of text.
The default value of -1 means that first line of each paragraph is ellipsized.
This behvaior may be changed in the future to act per layout instead of per
paragraph.  File a bug against pango at \<ulink
url=\"http:\/\/bugzilla.gnome.org\/\">http:\/\/bugzilla.gnome.org\/\<\/ulink> if your
code relies on this behavior.

Height setting only has effect if a positive width is set on
/@layout@/ and ellipsization mode of /@layout@/ is not 'GI.Pango.Enums.EllipsizeModeNone'.
The behavior is undefined if a height other than -1 is set and
ellipsization mode is set to 'GI.Pango.Enums.EllipsizeModeNone', and may change in the
future.

/Since: 1.20/
-}
layoutSetHeight ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout'. -}
    -> Int32
    {- ^ /@height@/: the desired height of the layout in Pango units if positive,
         or desired number of lines if negative. -}
    -> m ()
layoutSetHeight layout height = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    pango_layout_set_height layout' height
    touchManagedPtr layout
    return ()

#if ENABLE_OVERLOADING
data LayoutSetHeightMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m, IsLayout a) => O.MethodInfo LayoutSetHeightMethodInfo a signature where
    overloadedMethod _ = layoutSetHeight

#endif

-- method Layout::set_indent
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "indent", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the amount by which to indent.", 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_set_indent" pango_layout_set_indent ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    Int32 ->                                -- indent : TBasicType TInt
    IO ()

{- |
Sets the width in Pango units to indent each paragraph. A negative value
of /@indent@/ will produce a hanging indentation. That is, the first line will
have the full width, and subsequent lines will be indented by the
absolute value of /@indent@/.

The indent setting is ignored if layout alignment is set to
'GI.Pango.Enums.AlignmentCenter'.
-}
layoutSetIndent ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout'. -}
    -> Int32
    {- ^ /@indent@/: the amount by which to indent. -}
    -> m ()
layoutSetIndent layout indent = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    pango_layout_set_indent layout' indent
    touchManagedPtr layout
    return ()

#if ENABLE_OVERLOADING
data LayoutSetIndentMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m, IsLayout a) => O.MethodInfo LayoutSetIndentMethodInfo a signature where
    overloadedMethod _ = layoutSetIndent

#endif

-- method Layout::set_justify
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "justify", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "whether the lines in the layout should be justified.", 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_set_justify" pango_layout_set_justify ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    CInt ->                                 -- justify : TBasicType TBoolean
    IO ()

{- |
Sets whether each complete line should be stretched to
fill the entire width of the layout. This stretching is typically
done by adding whitespace, but for some scripts (such as Arabic),
the justification may be done in more complex ways, like extending
the characters.

Note that this setting is not implemented and so is ignored in Pango
older than 1.18.
-}
layoutSetJustify ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> Bool
    {- ^ /@justify@/: whether the lines in the layout should be justified. -}
    -> m ()
layoutSetJustify layout justify = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    let justify' = (fromIntegral . fromEnum) justify
    pango_layout_set_justify layout' justify'
    touchManagedPtr layout
    return ()

#if ENABLE_OVERLOADING
data LayoutSetJustifyMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsLayout a) => O.MethodInfo LayoutSetJustifyMethodInfo a signature where
    overloadedMethod _ = layoutSetJustify

#endif

-- method Layout::set_markup
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "markup", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "marked-up text", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "length of marked-up text in bytes, or -1 if @markup is\n         null-terminated", 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_set_markup" pango_layout_set_markup ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    CString ->                              -- markup : TBasicType TUTF8
    Int32 ->                                -- length : TBasicType TInt
    IO ()

{- |
Same as 'GI.Pango.Objects.Layout.layoutSetMarkupWithAccel', but
the markup text isn\'t scanned for accelerators.
-}
layoutSetMarkup ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> T.Text
    {- ^ /@markup@/: marked-up text -}
    -> Int32
    {- ^ /@length@/: length of marked-up text in bytes, or -1 if /@markup@/ is
         null-terminated -}
    -> m ()
layoutSetMarkup layout markup length_ = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    markup' <- textToCString markup
    pango_layout_set_markup layout' markup' length_
    touchManagedPtr layout
    freeMem markup'
    return ()

#if ENABLE_OVERLOADING
data LayoutSetMarkupMethodInfo
instance (signature ~ (T.Text -> Int32 -> m ()), MonadIO m, IsLayout a) => O.MethodInfo LayoutSetMarkupMethodInfo a signature where
    overloadedMethod _ = layoutSetMarkup

#endif

-- XXX Could not generate method Layout::set_markup_with_accel
-- Error was : Not implemented: "Don't know how to allocate \"accel_char\" of type TBasicType TUniChar"
#if ENABLE_OVERLOADING
-- XXX: Dummy instance, since code generation failed.
-- Please file a bug at http://github.com/haskell-gi/haskell-gi.
data LayoutSetMarkupWithAccelMethodInfo
instance (p ~ (), o ~ O.MethodResolutionFailed "setMarkupWithAccel" Layout) => O.MethodInfo LayoutSetMarkupWithAccelMethodInfo o p where
    overloadedMethod _ = undefined
#endif

-- method Layout::set_single_paragraph_mode
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "setting", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "new setting", 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_set_single_paragraph_mode" pango_layout_set_single_paragraph_mode ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    CInt ->                                 -- setting : TBasicType TBoolean
    IO ()

{- |
If /@setting@/ is 'True', do not treat newlines and similar characters
as paragraph separators; instead, keep all text in a single paragraph,
and display a glyph for paragraph separator characters. Used when
you want to allow editing of newlines on a single text line.
-}
layoutSetSingleParagraphMode ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> Bool
    {- ^ /@setting@/: new setting -}
    -> m ()
layoutSetSingleParagraphMode layout setting = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    let setting' = (fromIntegral . fromEnum) setting
    pango_layout_set_single_paragraph_mode layout' setting'
    touchManagedPtr layout
    return ()

#if ENABLE_OVERLOADING
data LayoutSetSingleParagraphModeMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsLayout a) => O.MethodInfo LayoutSetSingleParagraphModeMethodInfo a signature where
    overloadedMethod _ = layoutSetSingleParagraphMode

#endif

-- method Layout::set_spacing
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "spacing", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the amount of spacing", 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_set_spacing" pango_layout_set_spacing ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    Int32 ->                                -- spacing : TBasicType TInt
    IO ()

{- |
Sets the amount of spacing in Pango unit between the lines of the
layout.
-}
layoutSetSpacing ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout'. -}
    -> Int32
    {- ^ /@spacing@/: the amount of spacing -}
    -> m ()
layoutSetSpacing layout spacing = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    pango_layout_set_spacing layout' spacing
    touchManagedPtr layout
    return ()

#if ENABLE_OVERLOADING
data LayoutSetSpacingMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m, IsLayout a) => O.MethodInfo LayoutSetSpacingMethodInfo a signature where
    overloadedMethod _ = layoutSetSpacing

#endif

-- method Layout::set_tabs
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "tabs", argType = TInterface (Name {namespace = "Pango", name = "TabArray"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #PangoTabArray, or %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_set_tabs" pango_layout_set_tabs ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    Ptr Pango.TabArray.TabArray ->          -- tabs : TInterface (Name {namespace = "Pango", name = "TabArray"})
    IO ()

{- |
Sets the tabs to use for /@layout@/, overriding the default tabs
(by default, tabs are every 8 spaces). If /@tabs@/ is 'Nothing', the default
tabs are reinstated. /@tabs@/ is copied into the layout; you must
free your copy of /@tabs@/ yourself.
-}
layoutSetTabs ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> Maybe (Pango.TabArray.TabArray)
    {- ^ /@tabs@/: a 'GI.Pango.Structs.TabArray.TabArray', or 'Nothing' -}
    -> m ()
layoutSetTabs layout tabs = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    maybeTabs <- case tabs of
        Nothing -> return nullPtr
        Just jTabs -> do
            jTabs' <- unsafeManagedPtrGetPtr jTabs
            return jTabs'
    pango_layout_set_tabs layout' maybeTabs
    touchManagedPtr layout
    whenJust tabs touchManagedPtr
    return ()

#if ENABLE_OVERLOADING
data LayoutSetTabsMethodInfo
instance (signature ~ (Maybe (Pango.TabArray.TabArray) -> m ()), MonadIO m, IsLayout a) => O.MethodInfo LayoutSetTabsMethodInfo a signature where
    overloadedMethod _ = layoutSetTabs

#endif

-- method Layout::set_text
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "text", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid UTF-8 string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "maximum length of @text, in bytes. -1 indicates that\n         the string is nul-terminated and the length should be\n         calculated.  The text will also be truncated on\n         encountering a nul-termination even when @length is\n         positive.", 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_set_text" pango_layout_set_text ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    CString ->                              -- text : TBasicType TUTF8
    Int32 ->                                -- length : TBasicType TInt
    IO ()

{- |
Sets the text of the layout.

Note that if you have used
'GI.Pango.Objects.Layout.layoutSetMarkup' or 'GI.Pango.Objects.Layout.layoutSetMarkupWithAccel' on
/@layout@/ before, you may want to call 'GI.Pango.Objects.Layout.layoutSetAttributes' to clear
the attributes set on the layout from the markup as this function does not
clear attributes.
-}
layoutSetText ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> T.Text
    {- ^ /@text@/: a valid UTF-8 string -}
    -> Int32
    {- ^ /@length@/: maximum length of /@text@/, in bytes. -1 indicates that
         the string is nul-terminated and the length should be
         calculated.  The text will also be truncated on
         encountering a nul-termination even when /@length@/ is
         positive. -}
    -> m ()
layoutSetText layout text length_ = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    text' <- textToCString text
    pango_layout_set_text layout' text' length_
    touchManagedPtr layout
    freeMem text'
    return ()

#if ENABLE_OVERLOADING
data LayoutSetTextMethodInfo
instance (signature ~ (T.Text -> Int32 -> m ()), MonadIO m, IsLayout a) => O.MethodInfo LayoutSetTextMethodInfo a signature where
    overloadedMethod _ = layoutSetText

#endif

-- method Layout::set_width
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "width", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the desired width in Pango units, or -1 to indicate that no\n        wrapping or ellipsization should be performed.", 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_set_width" pango_layout_set_width ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    Int32 ->                                -- width : TBasicType TInt
    IO ()

{- |
Sets the width to which the lines of the 'GI.Pango.Objects.Layout.Layout' should wrap or
ellipsized.  The default value is -1: no width set.
-}
layoutSetWidth ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout'. -}
    -> Int32
    {- ^ /@width@/: the desired width in Pango units, or -1 to indicate that no
        wrapping or ellipsization should be performed. -}
    -> m ()
layoutSetWidth layout width = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    pango_layout_set_width layout' width
    touchManagedPtr layout
    return ()

#if ENABLE_OVERLOADING
data LayoutSetWidthMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m, IsLayout a) => O.MethodInfo LayoutSetWidthMethodInfo a signature where
    overloadedMethod _ = layoutSetWidth

#endif

-- method Layout::set_wrap
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "wrap", argType = TInterface (Name {namespace = "Pango", name = "WrapMode"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the wrap mode", 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_set_wrap" pango_layout_set_wrap ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    CUInt ->                                -- wrap : TInterface (Name {namespace = "Pango", name = "WrapMode"})
    IO ()

{- |
Sets the wrap mode; the wrap mode only has effect if a width
is set on the layout with 'GI.Pango.Objects.Layout.layoutSetWidth'.
To turn off wrapping, set the width to -1.
-}
layoutSetWrap ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> Pango.Enums.WrapMode
    {- ^ /@wrap@/: the wrap mode -}
    -> m ()
layoutSetWrap layout wrap = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    let wrap' = (fromIntegral . fromEnum) wrap
    pango_layout_set_wrap layout' wrap'
    touchManagedPtr layout
    return ()

#if ENABLE_OVERLOADING
data LayoutSetWrapMethodInfo
instance (signature ~ (Pango.Enums.WrapMode -> m ()), MonadIO m, IsLayout a) => O.MethodInfo LayoutSetWrapMethodInfo a signature where
    overloadedMethod _ = layoutSetWrap

#endif

-- method Layout::xy_to_index
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "layout", argType = TInterface (Name {namespace = "Pango", name = "Layout"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoLayout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "x", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the X offset (in Pango units)\n            from the left edge of the layout.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "y", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the Y offset (in Pango units)\n            from the top edge of the layout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "index_", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store calculated byte index", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "trailing", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store a integer indicating where\n            in the grapheme the user clicked. It will either\n            be zero, or the number of characters in the\n            grapheme. 0 represents the leading edge of the grapheme.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "pango_layout_xy_to_index" pango_layout_xy_to_index ::
    Ptr Layout ->                           -- layout : TInterface (Name {namespace = "Pango", name = "Layout"})
    Int32 ->                                -- x : TBasicType TInt
    Int32 ->                                -- y : TBasicType TInt
    Ptr Int32 ->                            -- index_ : TBasicType TInt
    Ptr Int32 ->                            -- trailing : TBasicType TInt
    IO CInt

{- |
Converts from X and Y position within a layout to the byte
index to the character at that logical position. If the
Y position is not inside the layout, the closest position is chosen
(the position will be clamped inside the layout). If the
X position is not within the layout, then the start or the
end of the line is chosen as described for 'GI.Pango.Structs.LayoutLine.layoutLineXToIndex'.
If either the X or Y positions were not inside the layout, then the
function returns 'False'; on an exact hit, it returns 'True'.
-}
layoutXyToIndex ::
    (B.CallStack.HasCallStack, MonadIO m, IsLayout a) =>
    a
    {- ^ /@layout@/: a 'GI.Pango.Objects.Layout.Layout' -}
    -> Int32
    {- ^ /@x@/: the X offset (in Pango units)
            from the left edge of the layout. -}
    -> Int32
    {- ^ /@y@/: the Y offset (in Pango units)
            from the top edge of the layout -}
    -> m ((Bool, Int32, Int32))
    {- ^ __Returns:__ 'True' if the coordinates were inside text, 'False' otherwise. -}
layoutXyToIndex layout x y = liftIO $ do
    layout' <- unsafeManagedPtrCastPtr layout
    index_ <- allocMem :: IO (Ptr Int32)
    trailing <- allocMem :: IO (Ptr Int32)
    result <- pango_layout_xy_to_index layout' x y index_ trailing
    let result' = (/= 0) result
    index_' <- peek index_
    trailing' <- peek trailing
    touchManagedPtr layout
    freeMem index_
    freeMem trailing
    return (result', index_', trailing')

#if ENABLE_OVERLOADING
data LayoutXyToIndexMethodInfo
instance (signature ~ (Int32 -> Int32 -> m ((Bool, Int32, Int32))), MonadIO m, IsLayout a) => O.MethodInfo LayoutXyToIndexMethodInfo a signature where
    overloadedMethod _ = layoutXyToIndex

#endif