{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}

module GI.GtkSource.Objects.Buffer
    ( 

-- * Exported types
    Buffer(..)                              ,
    IsBuffer                                ,
    toBuffer                                ,
    noBuffer                                ,


 -- * Methods
-- ** backwardIterToSourceMark #method:backwardIterToSourceMark#
    BufferBackwardIterToSourceMarkMethodInfo,
    bufferBackwardIterToSourceMark          ,


-- ** beginNotUndoableAction #method:beginNotUndoableAction#
    BufferBeginNotUndoableActionMethodInfo  ,
    bufferBeginNotUndoableAction            ,


-- ** canRedo #method:canRedo#
    BufferCanRedoMethodInfo                 ,
    bufferCanRedo                           ,


-- ** canUndo #method:canUndo#
    BufferCanUndoMethodInfo                 ,
    bufferCanUndo                           ,


-- ** changeCase #method:changeCase#
    BufferChangeCaseMethodInfo              ,
    bufferChangeCase                        ,


-- ** createSourceMark #method:createSourceMark#
    BufferCreateSourceMarkMethodInfo        ,
    bufferCreateSourceMark                  ,


-- ** endNotUndoableAction #method:endNotUndoableAction#
    BufferEndNotUndoableActionMethodInfo    ,
    bufferEndNotUndoableAction              ,


-- ** ensureHighlight #method:ensureHighlight#
    BufferEnsureHighlightMethodInfo         ,
    bufferEnsureHighlight                   ,


-- ** forwardIterToSourceMark #method:forwardIterToSourceMark#
    BufferForwardIterToSourceMarkMethodInfo ,
    bufferForwardIterToSourceMark           ,


-- ** getContextClassesAtIter #method:getContextClassesAtIter#
    BufferGetContextClassesAtIterMethodInfo ,
    bufferGetContextClassesAtIter           ,


-- ** getHighlightMatchingBrackets #method:getHighlightMatchingBrackets#
    BufferGetHighlightMatchingBracketsMethodInfo,
    bufferGetHighlightMatchingBrackets      ,


-- ** getHighlightSyntax #method:getHighlightSyntax#
    BufferGetHighlightSyntaxMethodInfo      ,
    bufferGetHighlightSyntax                ,


-- ** getImplicitTrailingNewline #method:getImplicitTrailingNewline#
    BufferGetImplicitTrailingNewlineMethodInfo,
    bufferGetImplicitTrailingNewline        ,


-- ** getLanguage #method:getLanguage#
    BufferGetLanguageMethodInfo             ,
    bufferGetLanguage                       ,


-- ** getMaxUndoLevels #method:getMaxUndoLevels#
    BufferGetMaxUndoLevelsMethodInfo        ,
    bufferGetMaxUndoLevels                  ,


-- ** getSourceMarksAtIter #method:getSourceMarksAtIter#
    BufferGetSourceMarksAtIterMethodInfo    ,
    bufferGetSourceMarksAtIter              ,


-- ** getSourceMarksAtLine #method:getSourceMarksAtLine#
    BufferGetSourceMarksAtLineMethodInfo    ,
    bufferGetSourceMarksAtLine              ,


-- ** getStyleScheme #method:getStyleScheme#
    BufferGetStyleSchemeMethodInfo          ,
    bufferGetStyleScheme                    ,


-- ** getUndoManager #method:getUndoManager#
    BufferGetUndoManagerMethodInfo          ,
    bufferGetUndoManager                    ,


-- ** iterBackwardToContextClassToggle #method:iterBackwardToContextClassToggle#
    BufferIterBackwardToContextClassToggleMethodInfo,
    bufferIterBackwardToContextClassToggle  ,


-- ** iterForwardToContextClassToggle #method:iterForwardToContextClassToggle#
    BufferIterForwardToContextClassToggleMethodInfo,
    bufferIterForwardToContextClassToggle   ,


-- ** iterHasContextClass #method:iterHasContextClass#
    BufferIterHasContextClassMethodInfo     ,
    bufferIterHasContextClass               ,


-- ** joinLines #method:joinLines#
    BufferJoinLinesMethodInfo               ,
    bufferJoinLines                         ,


-- ** new #method:new#
    bufferNew                               ,


-- ** newWithLanguage #method:newWithLanguage#
    bufferNewWithLanguage                   ,


-- ** redo #method:redo#
    BufferRedoMethodInfo                    ,
    bufferRedo                              ,


-- ** removeSourceMarks #method:removeSourceMarks#
    BufferRemoveSourceMarksMethodInfo       ,
    bufferRemoveSourceMarks                 ,


-- ** setHighlightMatchingBrackets #method:setHighlightMatchingBrackets#
    BufferSetHighlightMatchingBracketsMethodInfo,
    bufferSetHighlightMatchingBrackets      ,


-- ** setHighlightSyntax #method:setHighlightSyntax#
    BufferSetHighlightSyntaxMethodInfo      ,
    bufferSetHighlightSyntax                ,


-- ** setImplicitTrailingNewline #method:setImplicitTrailingNewline#
    BufferSetImplicitTrailingNewlineMethodInfo,
    bufferSetImplicitTrailingNewline        ,


-- ** setLanguage #method:setLanguage#
    BufferSetLanguageMethodInfo             ,
    bufferSetLanguage                       ,


-- ** setMaxUndoLevels #method:setMaxUndoLevels#
    BufferSetMaxUndoLevelsMethodInfo        ,
    bufferSetMaxUndoLevels                  ,


-- ** setStyleScheme #method:setStyleScheme#
    BufferSetStyleSchemeMethodInfo          ,
    bufferSetStyleScheme                    ,


-- ** setUndoManager #method:setUndoManager#
    BufferSetUndoManagerMethodInfo          ,
    bufferSetUndoManager                    ,


-- ** sortLines #method:sortLines#
    BufferSortLinesMethodInfo               ,
    bufferSortLines                         ,


-- ** undo #method:undo#
    BufferUndoMethodInfo                    ,
    bufferUndo                              ,




 -- * Properties
-- ** canRedo #attr:canRedo#
    BufferCanRedoPropertyInfo               ,
    getBufferCanRedo                        ,


-- ** canUndo #attr:canUndo#
    BufferCanUndoPropertyInfo               ,
    getBufferCanUndo                        ,


-- ** highlightMatchingBrackets #attr:highlightMatchingBrackets#
    BufferHighlightMatchingBracketsPropertyInfo,
    bufferHighlightMatchingBrackets         ,
    constructBufferHighlightMatchingBrackets,
    getBufferHighlightMatchingBrackets      ,
    setBufferHighlightMatchingBrackets      ,


-- ** highlightSyntax #attr:highlightSyntax#
    BufferHighlightSyntaxPropertyInfo       ,
    bufferHighlightSyntax                   ,
    constructBufferHighlightSyntax          ,
    getBufferHighlightSyntax                ,
    setBufferHighlightSyntax                ,


-- ** implicitTrailingNewline #attr:implicitTrailingNewline#
    BufferImplicitTrailingNewlinePropertyInfo,
    bufferImplicitTrailingNewline           ,
    constructBufferImplicitTrailingNewline  ,
    getBufferImplicitTrailingNewline        ,
    setBufferImplicitTrailingNewline        ,


-- ** language #attr:language#
    BufferLanguagePropertyInfo              ,
    bufferLanguage                          ,
    clearBufferLanguage                     ,
    constructBufferLanguage                 ,
    getBufferLanguage                       ,
    setBufferLanguage                       ,


-- ** maxUndoLevels #attr:maxUndoLevels#
    BufferMaxUndoLevelsPropertyInfo         ,
    bufferMaxUndoLevels                     ,
    constructBufferMaxUndoLevels            ,
    getBufferMaxUndoLevels                  ,
    setBufferMaxUndoLevels                  ,


-- ** styleScheme #attr:styleScheme#
    BufferStyleSchemePropertyInfo           ,
    bufferStyleScheme                       ,
    clearBufferStyleScheme                  ,
    constructBufferStyleScheme              ,
    getBufferStyleScheme                    ,
    setBufferStyleScheme                    ,


-- ** undoManager #attr:undoManager#
    BufferUndoManagerPropertyInfo           ,
    bufferUndoManager                       ,
    clearBufferUndoManager                  ,
    constructBufferUndoManager              ,
    getBufferUndoManager                    ,
    setBufferUndoManager                    ,




 -- * Signals
-- ** bracketMatched #signal:bracketMatched#
    BufferBracketMatchedCallback            ,
    BufferBracketMatchedSignalInfo          ,
    C_BufferBracketMatchedCallback          ,
    afterBufferBracketMatched               ,
    genClosure_BufferBracketMatched         ,
    mk_BufferBracketMatchedCallback         ,
    noBufferBracketMatchedCallback          ,
    onBufferBracketMatched                  ,
    wrap_BufferBracketMatchedCallback       ,


-- ** highlightUpdated #signal:highlightUpdated#
    BufferHighlightUpdatedCallback          ,
    BufferHighlightUpdatedSignalInfo        ,
    C_BufferHighlightUpdatedCallback        ,
    afterBufferHighlightUpdated             ,
    genClosure_BufferHighlightUpdated       ,
    mk_BufferHighlightUpdatedCallback       ,
    noBufferHighlightUpdatedCallback        ,
    onBufferHighlightUpdated                ,
    wrap_BufferHighlightUpdatedCallback     ,


-- ** redo #signal:redo#
    BufferRedoCallback                      ,
    BufferRedoSignalInfo                    ,
    C_BufferRedoCallback                    ,
    afterBufferRedo                         ,
    genClosure_BufferRedo                   ,
    mk_BufferRedoCallback                   ,
    noBufferRedoCallback                    ,
    onBufferRedo                            ,
    wrap_BufferRedoCallback                 ,


-- ** sourceMarkUpdated #signal:sourceMarkUpdated#
    BufferSourceMarkUpdatedCallback         ,
    BufferSourceMarkUpdatedSignalInfo       ,
    C_BufferSourceMarkUpdatedCallback       ,
    afterBufferSourceMarkUpdated            ,
    genClosure_BufferSourceMarkUpdated      ,
    mk_BufferSourceMarkUpdatedCallback      ,
    noBufferSourceMarkUpdatedCallback       ,
    onBufferSourceMarkUpdated               ,
    wrap_BufferSourceMarkUpdatedCallback    ,


-- ** undo #signal:undo#
    BufferUndoCallback                      ,
    BufferUndoSignalInfo                    ,
    C_BufferUndoCallback                    ,
    afterBufferUndo                         ,
    genClosure_BufferUndo                   ,
    mk_BufferUndoCallback                   ,
    noBufferUndoCallback                    ,
    onBufferUndo                            ,
    wrap_BufferUndoCallback                 ,




    ) 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.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
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 GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gtk.Objects.TextBuffer as Gtk.TextBuffer
import qualified GI.Gtk.Objects.TextMark as Gtk.TextMark
import qualified GI.Gtk.Objects.TextTagTable as Gtk.TextTagTable
import qualified GI.Gtk.Structs.TextIter as Gtk.TextIter
import {-# SOURCE #-} qualified GI.GtkSource.Enums as GtkSource.Enums
import {-# SOURCE #-} qualified GI.GtkSource.Flags as GtkSource.Flags
import {-# SOURCE #-} qualified GI.GtkSource.Interfaces.UndoManager as GtkSource.UndoManager
import {-# SOURCE #-} qualified GI.GtkSource.Objects.Language as GtkSource.Language
import {-# SOURCE #-} qualified GI.GtkSource.Objects.Mark as GtkSource.Mark
import {-# SOURCE #-} qualified GI.GtkSource.Objects.StyleScheme as GtkSource.StyleScheme

newtype Buffer = Buffer (ManagedPtr Buffer)
foreign import ccall "gtk_source_buffer_get_type"
    c_gtk_source_buffer_get_type :: IO GType

instance GObject Buffer where
    gobjectType _ = c_gtk_source_buffer_get_type
    

class GObject o => IsBuffer o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError Buffer a) =>
    IsBuffer a
#endif
instance IsBuffer Buffer
instance Gtk.TextBuffer.IsTextBuffer Buffer
instance GObject.Object.IsObject Buffer

toBuffer :: IsBuffer o => o -> IO Buffer
toBuffer = unsafeCastTo Buffer

noBuffer :: Maybe Buffer
noBuffer = Nothing

type family ResolveBufferMethod (t :: Symbol) (o :: *) :: * where
    ResolveBufferMethod "addMark" o = Gtk.TextBuffer.TextBufferAddMarkMethodInfo
    ResolveBufferMethod "addSelectionClipboard" o = Gtk.TextBuffer.TextBufferAddSelectionClipboardMethodInfo
    ResolveBufferMethod "applyTag" o = Gtk.TextBuffer.TextBufferApplyTagMethodInfo
    ResolveBufferMethod "applyTagByName" o = Gtk.TextBuffer.TextBufferApplyTagByNameMethodInfo
    ResolveBufferMethod "backspace" o = Gtk.TextBuffer.TextBufferBackspaceMethodInfo
    ResolveBufferMethod "backwardIterToSourceMark" o = BufferBackwardIterToSourceMarkMethodInfo
    ResolveBufferMethod "beginNotUndoableAction" o = BufferBeginNotUndoableActionMethodInfo
    ResolveBufferMethod "beginUserAction" o = Gtk.TextBuffer.TextBufferBeginUserActionMethodInfo
    ResolveBufferMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveBufferMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveBufferMethod "canRedo" o = BufferCanRedoMethodInfo
    ResolveBufferMethod "canUndo" o = BufferCanUndoMethodInfo
    ResolveBufferMethod "changeCase" o = BufferChangeCaseMethodInfo
    ResolveBufferMethod "copyClipboard" o = Gtk.TextBuffer.TextBufferCopyClipboardMethodInfo
    ResolveBufferMethod "createChildAnchor" o = Gtk.TextBuffer.TextBufferCreateChildAnchorMethodInfo
    ResolveBufferMethod "createMark" o = Gtk.TextBuffer.TextBufferCreateMarkMethodInfo
    ResolveBufferMethod "createSourceMark" o = BufferCreateSourceMarkMethodInfo
    ResolveBufferMethod "cutClipboard" o = Gtk.TextBuffer.TextBufferCutClipboardMethodInfo
    ResolveBufferMethod "delete" o = Gtk.TextBuffer.TextBufferDeleteMethodInfo
    ResolveBufferMethod "deleteInteractive" o = Gtk.TextBuffer.TextBufferDeleteInteractiveMethodInfo
    ResolveBufferMethod "deleteMark" o = Gtk.TextBuffer.TextBufferDeleteMarkMethodInfo
    ResolveBufferMethod "deleteMarkByName" o = Gtk.TextBuffer.TextBufferDeleteMarkByNameMethodInfo
    ResolveBufferMethod "deleteSelection" o = Gtk.TextBuffer.TextBufferDeleteSelectionMethodInfo
    ResolveBufferMethod "deserialize" o = Gtk.TextBuffer.TextBufferDeserializeMethodInfo
    ResolveBufferMethod "deserializeGetCanCreateTags" o = Gtk.TextBuffer.TextBufferDeserializeGetCanCreateTagsMethodInfo
    ResolveBufferMethod "deserializeSetCanCreateTags" o = Gtk.TextBuffer.TextBufferDeserializeSetCanCreateTagsMethodInfo
    ResolveBufferMethod "endNotUndoableAction" o = BufferEndNotUndoableActionMethodInfo
    ResolveBufferMethod "endUserAction" o = Gtk.TextBuffer.TextBufferEndUserActionMethodInfo
    ResolveBufferMethod "ensureHighlight" o = BufferEnsureHighlightMethodInfo
    ResolveBufferMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveBufferMethod "forwardIterToSourceMark" o = BufferForwardIterToSourceMarkMethodInfo
    ResolveBufferMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveBufferMethod "insert" o = Gtk.TextBuffer.TextBufferInsertMethodInfo
    ResolveBufferMethod "insertAtCursor" o = Gtk.TextBuffer.TextBufferInsertAtCursorMethodInfo
    ResolveBufferMethod "insertChildAnchor" o = Gtk.TextBuffer.TextBufferInsertChildAnchorMethodInfo
    ResolveBufferMethod "insertInteractive" o = Gtk.TextBuffer.TextBufferInsertInteractiveMethodInfo
    ResolveBufferMethod "insertInteractiveAtCursor" o = Gtk.TextBuffer.TextBufferInsertInteractiveAtCursorMethodInfo
    ResolveBufferMethod "insertMarkup" o = Gtk.TextBuffer.TextBufferInsertMarkupMethodInfo
    ResolveBufferMethod "insertPixbuf" o = Gtk.TextBuffer.TextBufferInsertPixbufMethodInfo
    ResolveBufferMethod "insertRange" o = Gtk.TextBuffer.TextBufferInsertRangeMethodInfo
    ResolveBufferMethod "insertRangeInteractive" o = Gtk.TextBuffer.TextBufferInsertRangeInteractiveMethodInfo
    ResolveBufferMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveBufferMethod "iterBackwardToContextClassToggle" o = BufferIterBackwardToContextClassToggleMethodInfo
    ResolveBufferMethod "iterForwardToContextClassToggle" o = BufferIterForwardToContextClassToggleMethodInfo
    ResolveBufferMethod "iterHasContextClass" o = BufferIterHasContextClassMethodInfo
    ResolveBufferMethod "joinLines" o = BufferJoinLinesMethodInfo
    ResolveBufferMethod "moveMark" o = Gtk.TextBuffer.TextBufferMoveMarkMethodInfo
    ResolveBufferMethod "moveMarkByName" o = Gtk.TextBuffer.TextBufferMoveMarkByNameMethodInfo
    ResolveBufferMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveBufferMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveBufferMethod "pasteClipboard" o = Gtk.TextBuffer.TextBufferPasteClipboardMethodInfo
    ResolveBufferMethod "placeCursor" o = Gtk.TextBuffer.TextBufferPlaceCursorMethodInfo
    ResolveBufferMethod "redo" o = BufferRedoMethodInfo
    ResolveBufferMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveBufferMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveBufferMethod "registerDeserializeFormat" o = Gtk.TextBuffer.TextBufferRegisterDeserializeFormatMethodInfo
    ResolveBufferMethod "registerDeserializeTagset" o = Gtk.TextBuffer.TextBufferRegisterDeserializeTagsetMethodInfo
    ResolveBufferMethod "registerSerializeFormat" o = Gtk.TextBuffer.TextBufferRegisterSerializeFormatMethodInfo
    ResolveBufferMethod "registerSerializeTagset" o = Gtk.TextBuffer.TextBufferRegisterSerializeTagsetMethodInfo
    ResolveBufferMethod "removeAllTags" o = Gtk.TextBuffer.TextBufferRemoveAllTagsMethodInfo
    ResolveBufferMethod "removeSelectionClipboard" o = Gtk.TextBuffer.TextBufferRemoveSelectionClipboardMethodInfo
    ResolveBufferMethod "removeSourceMarks" o = BufferRemoveSourceMarksMethodInfo
    ResolveBufferMethod "removeTag" o = Gtk.TextBuffer.TextBufferRemoveTagMethodInfo
    ResolveBufferMethod "removeTagByName" o = Gtk.TextBuffer.TextBufferRemoveTagByNameMethodInfo
    ResolveBufferMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveBufferMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveBufferMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveBufferMethod "selectRange" o = Gtk.TextBuffer.TextBufferSelectRangeMethodInfo
    ResolveBufferMethod "serialize" o = Gtk.TextBuffer.TextBufferSerializeMethodInfo
    ResolveBufferMethod "sortLines" o = BufferSortLinesMethodInfo
    ResolveBufferMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveBufferMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveBufferMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveBufferMethod "undo" o = BufferUndoMethodInfo
    ResolveBufferMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveBufferMethod "unregisterDeserializeFormat" o = Gtk.TextBuffer.TextBufferUnregisterDeserializeFormatMethodInfo
    ResolveBufferMethod "unregisterSerializeFormat" o = Gtk.TextBuffer.TextBufferUnregisterSerializeFormatMethodInfo
    ResolveBufferMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveBufferMethod "getBounds" o = Gtk.TextBuffer.TextBufferGetBoundsMethodInfo
    ResolveBufferMethod "getCharCount" o = Gtk.TextBuffer.TextBufferGetCharCountMethodInfo
    ResolveBufferMethod "getContextClassesAtIter" o = BufferGetContextClassesAtIterMethodInfo
    ResolveBufferMethod "getCopyTargetList" o = Gtk.TextBuffer.TextBufferGetCopyTargetListMethodInfo
    ResolveBufferMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveBufferMethod "getDeserializeFormats" o = Gtk.TextBuffer.TextBufferGetDeserializeFormatsMethodInfo
    ResolveBufferMethod "getEndIter" o = Gtk.TextBuffer.TextBufferGetEndIterMethodInfo
    ResolveBufferMethod "getHasSelection" o = Gtk.TextBuffer.TextBufferGetHasSelectionMethodInfo
    ResolveBufferMethod "getHighlightMatchingBrackets" o = BufferGetHighlightMatchingBracketsMethodInfo
    ResolveBufferMethod "getHighlightSyntax" o = BufferGetHighlightSyntaxMethodInfo
    ResolveBufferMethod "getImplicitTrailingNewline" o = BufferGetImplicitTrailingNewlineMethodInfo
    ResolveBufferMethod "getInsert" o = Gtk.TextBuffer.TextBufferGetInsertMethodInfo
    ResolveBufferMethod "getIterAtChildAnchor" o = Gtk.TextBuffer.TextBufferGetIterAtChildAnchorMethodInfo
    ResolveBufferMethod "getIterAtLine" o = Gtk.TextBuffer.TextBufferGetIterAtLineMethodInfo
    ResolveBufferMethod "getIterAtLineIndex" o = Gtk.TextBuffer.TextBufferGetIterAtLineIndexMethodInfo
    ResolveBufferMethod "getIterAtLineOffset" o = Gtk.TextBuffer.TextBufferGetIterAtLineOffsetMethodInfo
    ResolveBufferMethod "getIterAtMark" o = Gtk.TextBuffer.TextBufferGetIterAtMarkMethodInfo
    ResolveBufferMethod "getIterAtOffset" o = Gtk.TextBuffer.TextBufferGetIterAtOffsetMethodInfo
    ResolveBufferMethod "getLanguage" o = BufferGetLanguageMethodInfo
    ResolveBufferMethod "getLineCount" o = Gtk.TextBuffer.TextBufferGetLineCountMethodInfo
    ResolveBufferMethod "getMark" o = Gtk.TextBuffer.TextBufferGetMarkMethodInfo
    ResolveBufferMethod "getMaxUndoLevels" o = BufferGetMaxUndoLevelsMethodInfo
    ResolveBufferMethod "getModified" o = Gtk.TextBuffer.TextBufferGetModifiedMethodInfo
    ResolveBufferMethod "getPasteTargetList" o = Gtk.TextBuffer.TextBufferGetPasteTargetListMethodInfo
    ResolveBufferMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveBufferMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveBufferMethod "getSelectionBound" o = Gtk.TextBuffer.TextBufferGetSelectionBoundMethodInfo
    ResolveBufferMethod "getSelectionBounds" o = Gtk.TextBuffer.TextBufferGetSelectionBoundsMethodInfo
    ResolveBufferMethod "getSerializeFormats" o = Gtk.TextBuffer.TextBufferGetSerializeFormatsMethodInfo
    ResolveBufferMethod "getSlice" o = Gtk.TextBuffer.TextBufferGetSliceMethodInfo
    ResolveBufferMethod "getSourceMarksAtIter" o = BufferGetSourceMarksAtIterMethodInfo
    ResolveBufferMethod "getSourceMarksAtLine" o = BufferGetSourceMarksAtLineMethodInfo
    ResolveBufferMethod "getStartIter" o = Gtk.TextBuffer.TextBufferGetStartIterMethodInfo
    ResolveBufferMethod "getStyleScheme" o = BufferGetStyleSchemeMethodInfo
    ResolveBufferMethod "getTagTable" o = Gtk.TextBuffer.TextBufferGetTagTableMethodInfo
    ResolveBufferMethod "getText" o = Gtk.TextBuffer.TextBufferGetTextMethodInfo
    ResolveBufferMethod "getUndoManager" o = BufferGetUndoManagerMethodInfo
    ResolveBufferMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveBufferMethod "setHighlightMatchingBrackets" o = BufferSetHighlightMatchingBracketsMethodInfo
    ResolveBufferMethod "setHighlightSyntax" o = BufferSetHighlightSyntaxMethodInfo
    ResolveBufferMethod "setImplicitTrailingNewline" o = BufferSetImplicitTrailingNewlineMethodInfo
    ResolveBufferMethod "setLanguage" o = BufferSetLanguageMethodInfo
    ResolveBufferMethod "setMaxUndoLevels" o = BufferSetMaxUndoLevelsMethodInfo
    ResolveBufferMethod "setModified" o = Gtk.TextBuffer.TextBufferSetModifiedMethodInfo
    ResolveBufferMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveBufferMethod "setStyleScheme" o = BufferSetStyleSchemeMethodInfo
    ResolveBufferMethod "setText" o = Gtk.TextBuffer.TextBufferSetTextMethodInfo
    ResolveBufferMethod "setUndoManager" o = BufferSetUndoManagerMethodInfo
    ResolveBufferMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveBufferMethod t Buffer, O.MethodInfo info Buffer p) => O.IsLabelProxy t (Buffer -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveBufferMethod t Buffer, O.MethodInfo info Buffer p) => O.IsLabel t (Buffer -> p) where
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

-- signal Buffer::bracket-matched
type BufferBracketMatchedCallback =
    Gtk.TextIter.TextIter ->
    GtkSource.Enums.BracketMatchType ->
    IO ()

noBufferBracketMatchedCallback :: Maybe BufferBracketMatchedCallback
noBufferBracketMatchedCallback = Nothing

type C_BufferBracketMatchedCallback =
    Ptr () ->                               -- object
    Ptr Gtk.TextIter.TextIter ->
    CUInt ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_BufferBracketMatchedCallback :: C_BufferBracketMatchedCallback -> IO (FunPtr C_BufferBracketMatchedCallback)

genClosure_BufferBracketMatched :: BufferBracketMatchedCallback -> IO Closure
genClosure_BufferBracketMatched cb = do
    let cb' = wrap_BufferBracketMatchedCallback cb
    mk_BufferBracketMatchedCallback cb' >>= newCClosure


wrap_BufferBracketMatchedCallback ::
    BufferBracketMatchedCallback ->
    Ptr () ->
    Ptr Gtk.TextIter.TextIter ->
    CUInt ->
    Ptr () ->
    IO ()
wrap_BufferBracketMatchedCallback _cb _ iter state _ = do
    iter' <- (newBoxed Gtk.TextIter.TextIter) iter
    let state' = (toEnum . fromIntegral) state
    _cb  iter' state'


onBufferBracketMatched :: (IsBuffer a, MonadIO m) => a -> BufferBracketMatchedCallback -> m SignalHandlerId
onBufferBracketMatched obj cb = liftIO $ do
    let cb' = wrap_BufferBracketMatchedCallback cb
    cb'' <- mk_BufferBracketMatchedCallback cb'
    connectSignalFunPtr obj "bracket-matched" cb'' SignalConnectBefore

afterBufferBracketMatched :: (IsBuffer a, MonadIO m) => a -> BufferBracketMatchedCallback -> m SignalHandlerId
afterBufferBracketMatched obj cb = liftIO $ do
    let cb' = wrap_BufferBracketMatchedCallback cb
    cb'' <- mk_BufferBracketMatchedCallback cb'
    connectSignalFunPtr obj "bracket-matched" cb'' SignalConnectAfter


-- signal Buffer::highlight-updated
type BufferHighlightUpdatedCallback =
    Gtk.TextIter.TextIter ->
    Gtk.TextIter.TextIter ->
    IO ()

noBufferHighlightUpdatedCallback :: Maybe BufferHighlightUpdatedCallback
noBufferHighlightUpdatedCallback = Nothing

type C_BufferHighlightUpdatedCallback =
    Ptr () ->                               -- object
    Ptr Gtk.TextIter.TextIter ->
    Ptr Gtk.TextIter.TextIter ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_BufferHighlightUpdatedCallback :: C_BufferHighlightUpdatedCallback -> IO (FunPtr C_BufferHighlightUpdatedCallback)

genClosure_BufferHighlightUpdated :: BufferHighlightUpdatedCallback -> IO Closure
genClosure_BufferHighlightUpdated cb = do
    let cb' = wrap_BufferHighlightUpdatedCallback cb
    mk_BufferHighlightUpdatedCallback cb' >>= newCClosure


wrap_BufferHighlightUpdatedCallback ::
    BufferHighlightUpdatedCallback ->
    Ptr () ->
    Ptr Gtk.TextIter.TextIter ->
    Ptr Gtk.TextIter.TextIter ->
    Ptr () ->
    IO ()
wrap_BufferHighlightUpdatedCallback _cb _ start end _ = do
    start' <- (newBoxed Gtk.TextIter.TextIter) start
    end' <- (newBoxed Gtk.TextIter.TextIter) end
    _cb  start' end'


onBufferHighlightUpdated :: (IsBuffer a, MonadIO m) => a -> BufferHighlightUpdatedCallback -> m SignalHandlerId
onBufferHighlightUpdated obj cb = liftIO $ do
    let cb' = wrap_BufferHighlightUpdatedCallback cb
    cb'' <- mk_BufferHighlightUpdatedCallback cb'
    connectSignalFunPtr obj "highlight-updated" cb'' SignalConnectBefore

afterBufferHighlightUpdated :: (IsBuffer a, MonadIO m) => a -> BufferHighlightUpdatedCallback -> m SignalHandlerId
afterBufferHighlightUpdated obj cb = liftIO $ do
    let cb' = wrap_BufferHighlightUpdatedCallback cb
    cb'' <- mk_BufferHighlightUpdatedCallback cb'
    connectSignalFunPtr obj "highlight-updated" cb'' SignalConnectAfter


-- signal Buffer::redo
type BufferRedoCallback =
    IO ()

noBufferRedoCallback :: Maybe BufferRedoCallback
noBufferRedoCallback = Nothing

type C_BufferRedoCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_BufferRedoCallback :: C_BufferRedoCallback -> IO (FunPtr C_BufferRedoCallback)

genClosure_BufferRedo :: BufferRedoCallback -> IO Closure
genClosure_BufferRedo cb = do
    let cb' = wrap_BufferRedoCallback cb
    mk_BufferRedoCallback cb' >>= newCClosure


wrap_BufferRedoCallback ::
    BufferRedoCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_BufferRedoCallback _cb _ _ = do
    _cb 


onBufferRedo :: (IsBuffer a, MonadIO m) => a -> BufferRedoCallback -> m SignalHandlerId
onBufferRedo obj cb = liftIO $ do
    let cb' = wrap_BufferRedoCallback cb
    cb'' <- mk_BufferRedoCallback cb'
    connectSignalFunPtr obj "redo" cb'' SignalConnectBefore

afterBufferRedo :: (IsBuffer a, MonadIO m) => a -> BufferRedoCallback -> m SignalHandlerId
afterBufferRedo obj cb = liftIO $ do
    let cb' = wrap_BufferRedoCallback cb
    cb'' <- mk_BufferRedoCallback cb'
    connectSignalFunPtr obj "redo" cb'' SignalConnectAfter


-- signal Buffer::source-mark-updated
type BufferSourceMarkUpdatedCallback =
    Gtk.TextMark.TextMark ->
    IO ()

noBufferSourceMarkUpdatedCallback :: Maybe BufferSourceMarkUpdatedCallback
noBufferSourceMarkUpdatedCallback = Nothing

type C_BufferSourceMarkUpdatedCallback =
    Ptr () ->                               -- object
    Ptr Gtk.TextMark.TextMark ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_BufferSourceMarkUpdatedCallback :: C_BufferSourceMarkUpdatedCallback -> IO (FunPtr C_BufferSourceMarkUpdatedCallback)

genClosure_BufferSourceMarkUpdated :: BufferSourceMarkUpdatedCallback -> IO Closure
genClosure_BufferSourceMarkUpdated cb = do
    let cb' = wrap_BufferSourceMarkUpdatedCallback cb
    mk_BufferSourceMarkUpdatedCallback cb' >>= newCClosure


wrap_BufferSourceMarkUpdatedCallback ::
    BufferSourceMarkUpdatedCallback ->
    Ptr () ->
    Ptr Gtk.TextMark.TextMark ->
    Ptr () ->
    IO ()
wrap_BufferSourceMarkUpdatedCallback _cb _ mark _ = do
    mark' <- (newObject Gtk.TextMark.TextMark) mark
    _cb  mark'


onBufferSourceMarkUpdated :: (IsBuffer a, MonadIO m) => a -> BufferSourceMarkUpdatedCallback -> m SignalHandlerId
onBufferSourceMarkUpdated obj cb = liftIO $ do
    let cb' = wrap_BufferSourceMarkUpdatedCallback cb
    cb'' <- mk_BufferSourceMarkUpdatedCallback cb'
    connectSignalFunPtr obj "source-mark-updated" cb'' SignalConnectBefore

afterBufferSourceMarkUpdated :: (IsBuffer a, MonadIO m) => a -> BufferSourceMarkUpdatedCallback -> m SignalHandlerId
afterBufferSourceMarkUpdated obj cb = liftIO $ do
    let cb' = wrap_BufferSourceMarkUpdatedCallback cb
    cb'' <- mk_BufferSourceMarkUpdatedCallback cb'
    connectSignalFunPtr obj "source-mark-updated" cb'' SignalConnectAfter


-- signal Buffer::undo
type BufferUndoCallback =
    IO ()

noBufferUndoCallback :: Maybe BufferUndoCallback
noBufferUndoCallback = Nothing

type C_BufferUndoCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_BufferUndoCallback :: C_BufferUndoCallback -> IO (FunPtr C_BufferUndoCallback)

genClosure_BufferUndo :: BufferUndoCallback -> IO Closure
genClosure_BufferUndo cb = do
    let cb' = wrap_BufferUndoCallback cb
    mk_BufferUndoCallback cb' >>= newCClosure


wrap_BufferUndoCallback ::
    BufferUndoCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_BufferUndoCallback _cb _ _ = do
    _cb 


onBufferUndo :: (IsBuffer a, MonadIO m) => a -> BufferUndoCallback -> m SignalHandlerId
onBufferUndo obj cb = liftIO $ do
    let cb' = wrap_BufferUndoCallback cb
    cb'' <- mk_BufferUndoCallback cb'
    connectSignalFunPtr obj "undo" cb'' SignalConnectBefore

afterBufferUndo :: (IsBuffer a, MonadIO m) => a -> BufferUndoCallback -> m SignalHandlerId
afterBufferUndo obj cb = liftIO $ do
    let cb' = wrap_BufferUndoCallback cb
    cb'' <- mk_BufferUndoCallback cb'
    connectSignalFunPtr obj "undo" cb'' SignalConnectAfter


-- VVV Prop "can-redo"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

getBufferCanRedo :: (MonadIO m, IsBuffer o) => o -> m Bool
getBufferCanRedo obj = liftIO $ getObjectPropertyBool obj "can-redo"

data BufferCanRedoPropertyInfo
instance AttrInfo BufferCanRedoPropertyInfo where
    type AttrAllowedOps BufferCanRedoPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint BufferCanRedoPropertyInfo = (~) ()
    type AttrBaseTypeConstraint BufferCanRedoPropertyInfo = IsBuffer
    type AttrGetType BufferCanRedoPropertyInfo = Bool
    type AttrLabel BufferCanRedoPropertyInfo = "can-redo"
    type AttrOrigin BufferCanRedoPropertyInfo = Buffer
    attrGet _ = getBufferCanRedo
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "can-undo"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

getBufferCanUndo :: (MonadIO m, IsBuffer o) => o -> m Bool
getBufferCanUndo obj = liftIO $ getObjectPropertyBool obj "can-undo"

data BufferCanUndoPropertyInfo
instance AttrInfo BufferCanUndoPropertyInfo where
    type AttrAllowedOps BufferCanUndoPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint BufferCanUndoPropertyInfo = (~) ()
    type AttrBaseTypeConstraint BufferCanUndoPropertyInfo = IsBuffer
    type AttrGetType BufferCanUndoPropertyInfo = Bool
    type AttrLabel BufferCanUndoPropertyInfo = "can-undo"
    type AttrOrigin BufferCanUndoPropertyInfo = Buffer
    attrGet _ = getBufferCanUndo
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "highlight-matching-brackets"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

getBufferHighlightMatchingBrackets :: (MonadIO m, IsBuffer o) => o -> m Bool
getBufferHighlightMatchingBrackets obj = liftIO $ getObjectPropertyBool obj "highlight-matching-brackets"

setBufferHighlightMatchingBrackets :: (MonadIO m, IsBuffer o) => o -> Bool -> m ()
setBufferHighlightMatchingBrackets obj val = liftIO $ setObjectPropertyBool obj "highlight-matching-brackets" val

constructBufferHighlightMatchingBrackets :: (IsBuffer o) => Bool -> IO (GValueConstruct o)
constructBufferHighlightMatchingBrackets val = constructObjectPropertyBool "highlight-matching-brackets" val

data BufferHighlightMatchingBracketsPropertyInfo
instance AttrInfo BufferHighlightMatchingBracketsPropertyInfo where
    type AttrAllowedOps BufferHighlightMatchingBracketsPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint BufferHighlightMatchingBracketsPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint BufferHighlightMatchingBracketsPropertyInfo = IsBuffer
    type AttrGetType BufferHighlightMatchingBracketsPropertyInfo = Bool
    type AttrLabel BufferHighlightMatchingBracketsPropertyInfo = "highlight-matching-brackets"
    type AttrOrigin BufferHighlightMatchingBracketsPropertyInfo = Buffer
    attrGet _ = getBufferHighlightMatchingBrackets
    attrSet _ = setBufferHighlightMatchingBrackets
    attrConstruct _ = constructBufferHighlightMatchingBrackets
    attrClear _ = undefined

-- VVV Prop "highlight-syntax"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

getBufferHighlightSyntax :: (MonadIO m, IsBuffer o) => o -> m Bool
getBufferHighlightSyntax obj = liftIO $ getObjectPropertyBool obj "highlight-syntax"

setBufferHighlightSyntax :: (MonadIO m, IsBuffer o) => o -> Bool -> m ()
setBufferHighlightSyntax obj val = liftIO $ setObjectPropertyBool obj "highlight-syntax" val

constructBufferHighlightSyntax :: (IsBuffer o) => Bool -> IO (GValueConstruct o)
constructBufferHighlightSyntax val = constructObjectPropertyBool "highlight-syntax" val

data BufferHighlightSyntaxPropertyInfo
instance AttrInfo BufferHighlightSyntaxPropertyInfo where
    type AttrAllowedOps BufferHighlightSyntaxPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint BufferHighlightSyntaxPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint BufferHighlightSyntaxPropertyInfo = IsBuffer
    type AttrGetType BufferHighlightSyntaxPropertyInfo = Bool
    type AttrLabel BufferHighlightSyntaxPropertyInfo = "highlight-syntax"
    type AttrOrigin BufferHighlightSyntaxPropertyInfo = Buffer
    attrGet _ = getBufferHighlightSyntax
    attrSet _ = setBufferHighlightSyntax
    attrConstruct _ = constructBufferHighlightSyntax
    attrClear _ = undefined

-- VVV Prop "implicit-trailing-newline"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
   -- Nullable: (Just False,Just False)

getBufferImplicitTrailingNewline :: (MonadIO m, IsBuffer o) => o -> m Bool
getBufferImplicitTrailingNewline obj = liftIO $ getObjectPropertyBool obj "implicit-trailing-newline"

setBufferImplicitTrailingNewline :: (MonadIO m, IsBuffer o) => o -> Bool -> m ()
setBufferImplicitTrailingNewline obj val = liftIO $ setObjectPropertyBool obj "implicit-trailing-newline" val

constructBufferImplicitTrailingNewline :: (IsBuffer o) => Bool -> IO (GValueConstruct o)
constructBufferImplicitTrailingNewline val = constructObjectPropertyBool "implicit-trailing-newline" val

data BufferImplicitTrailingNewlinePropertyInfo
instance AttrInfo BufferImplicitTrailingNewlinePropertyInfo where
    type AttrAllowedOps BufferImplicitTrailingNewlinePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint BufferImplicitTrailingNewlinePropertyInfo = (~) Bool
    type AttrBaseTypeConstraint BufferImplicitTrailingNewlinePropertyInfo = IsBuffer
    type AttrGetType BufferImplicitTrailingNewlinePropertyInfo = Bool
    type AttrLabel BufferImplicitTrailingNewlinePropertyInfo = "implicit-trailing-newline"
    type AttrOrigin BufferImplicitTrailingNewlinePropertyInfo = Buffer
    attrGet _ = getBufferImplicitTrailingNewline
    attrSet _ = setBufferImplicitTrailingNewline
    attrConstruct _ = constructBufferImplicitTrailingNewline
    attrClear _ = undefined

-- VVV Prop "language"
   -- Type: TInterface (Name {namespace = "GtkSource", name = "Language"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just True,Just True)

getBufferLanguage :: (MonadIO m, IsBuffer o) => o -> m (Maybe GtkSource.Language.Language)
getBufferLanguage obj = liftIO $ getObjectPropertyObject obj "language" GtkSource.Language.Language

setBufferLanguage :: (MonadIO m, IsBuffer o, GtkSource.Language.IsLanguage a) => o -> a -> m ()
setBufferLanguage obj val = liftIO $ setObjectPropertyObject obj "language" (Just val)

constructBufferLanguage :: (IsBuffer o, GtkSource.Language.IsLanguage a) => a -> IO (GValueConstruct o)
constructBufferLanguage val = constructObjectPropertyObject "language" (Just val)

clearBufferLanguage :: (MonadIO m, IsBuffer o) => o -> m ()
clearBufferLanguage obj = liftIO $ setObjectPropertyObject obj "language" (Nothing :: Maybe GtkSource.Language.Language)

data BufferLanguagePropertyInfo
instance AttrInfo BufferLanguagePropertyInfo where
    type AttrAllowedOps BufferLanguagePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint BufferLanguagePropertyInfo = GtkSource.Language.IsLanguage
    type AttrBaseTypeConstraint BufferLanguagePropertyInfo = IsBuffer
    type AttrGetType BufferLanguagePropertyInfo = (Maybe GtkSource.Language.Language)
    type AttrLabel BufferLanguagePropertyInfo = "language"
    type AttrOrigin BufferLanguagePropertyInfo = Buffer
    attrGet _ = getBufferLanguage
    attrSet _ = setBufferLanguage
    attrConstruct _ = constructBufferLanguage
    attrClear _ = clearBufferLanguage

-- VVV Prop "max-undo-levels"
   -- Type: TBasicType TInt
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

getBufferMaxUndoLevels :: (MonadIO m, IsBuffer o) => o -> m Int32
getBufferMaxUndoLevels obj = liftIO $ getObjectPropertyInt32 obj "max-undo-levels"

setBufferMaxUndoLevels :: (MonadIO m, IsBuffer o) => o -> Int32 -> m ()
setBufferMaxUndoLevels obj val = liftIO $ setObjectPropertyInt32 obj "max-undo-levels" val

constructBufferMaxUndoLevels :: (IsBuffer o) => Int32 -> IO (GValueConstruct o)
constructBufferMaxUndoLevels val = constructObjectPropertyInt32 "max-undo-levels" val

data BufferMaxUndoLevelsPropertyInfo
instance AttrInfo BufferMaxUndoLevelsPropertyInfo where
    type AttrAllowedOps BufferMaxUndoLevelsPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint BufferMaxUndoLevelsPropertyInfo = (~) Int32
    type AttrBaseTypeConstraint BufferMaxUndoLevelsPropertyInfo = IsBuffer
    type AttrGetType BufferMaxUndoLevelsPropertyInfo = Int32
    type AttrLabel BufferMaxUndoLevelsPropertyInfo = "max-undo-levels"
    type AttrOrigin BufferMaxUndoLevelsPropertyInfo = Buffer
    attrGet _ = getBufferMaxUndoLevels
    attrSet _ = setBufferMaxUndoLevels
    attrConstruct _ = constructBufferMaxUndoLevels
    attrClear _ = undefined

-- VVV Prop "style-scheme"
   -- Type: TInterface (Name {namespace = "GtkSource", name = "StyleScheme"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just True,Just True)

getBufferStyleScheme :: (MonadIO m, IsBuffer o) => o -> m (Maybe GtkSource.StyleScheme.StyleScheme)
getBufferStyleScheme obj = liftIO $ getObjectPropertyObject obj "style-scheme" GtkSource.StyleScheme.StyleScheme

setBufferStyleScheme :: (MonadIO m, IsBuffer o, GtkSource.StyleScheme.IsStyleScheme a) => o -> a -> m ()
setBufferStyleScheme obj val = liftIO $ setObjectPropertyObject obj "style-scheme" (Just val)

constructBufferStyleScheme :: (IsBuffer o, GtkSource.StyleScheme.IsStyleScheme a) => a -> IO (GValueConstruct o)
constructBufferStyleScheme val = constructObjectPropertyObject "style-scheme" (Just val)

clearBufferStyleScheme :: (MonadIO m, IsBuffer o) => o -> m ()
clearBufferStyleScheme obj = liftIO $ setObjectPropertyObject obj "style-scheme" (Nothing :: Maybe GtkSource.StyleScheme.StyleScheme)

data BufferStyleSchemePropertyInfo
instance AttrInfo BufferStyleSchemePropertyInfo where
    type AttrAllowedOps BufferStyleSchemePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint BufferStyleSchemePropertyInfo = GtkSource.StyleScheme.IsStyleScheme
    type AttrBaseTypeConstraint BufferStyleSchemePropertyInfo = IsBuffer
    type AttrGetType BufferStyleSchemePropertyInfo = (Maybe GtkSource.StyleScheme.StyleScheme)
    type AttrLabel BufferStyleSchemePropertyInfo = "style-scheme"
    type AttrOrigin BufferStyleSchemePropertyInfo = Buffer
    attrGet _ = getBufferStyleScheme
    attrSet _ = setBufferStyleScheme
    attrConstruct _ = constructBufferStyleScheme
    attrClear _ = clearBufferStyleScheme

-- VVV Prop "undo-manager"
   -- Type: TInterface (Name {namespace = "GtkSource", name = "UndoManager"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
   -- Nullable: (Just True,Just True)

getBufferUndoManager :: (MonadIO m, IsBuffer o) => o -> m (Maybe GtkSource.UndoManager.UndoManager)
getBufferUndoManager obj = liftIO $ getObjectPropertyObject obj "undo-manager" GtkSource.UndoManager.UndoManager

setBufferUndoManager :: (MonadIO m, IsBuffer o, GtkSource.UndoManager.IsUndoManager a) => o -> a -> m ()
setBufferUndoManager obj val = liftIO $ setObjectPropertyObject obj "undo-manager" (Just val)

constructBufferUndoManager :: (IsBuffer o, GtkSource.UndoManager.IsUndoManager a) => a -> IO (GValueConstruct o)
constructBufferUndoManager val = constructObjectPropertyObject "undo-manager" (Just val)

clearBufferUndoManager :: (MonadIO m, IsBuffer o) => o -> m ()
clearBufferUndoManager obj = liftIO $ setObjectPropertyObject obj "undo-manager" (Nothing :: Maybe GtkSource.UndoManager.UndoManager)

data BufferUndoManagerPropertyInfo
instance AttrInfo BufferUndoManagerPropertyInfo where
    type AttrAllowedOps BufferUndoManagerPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint BufferUndoManagerPropertyInfo = GtkSource.UndoManager.IsUndoManager
    type AttrBaseTypeConstraint BufferUndoManagerPropertyInfo = IsBuffer
    type AttrGetType BufferUndoManagerPropertyInfo = (Maybe GtkSource.UndoManager.UndoManager)
    type AttrLabel BufferUndoManagerPropertyInfo = "undo-manager"
    type AttrOrigin BufferUndoManagerPropertyInfo = Buffer
    attrGet _ = getBufferUndoManager
    attrSet _ = setBufferUndoManager
    attrConstruct _ = constructBufferUndoManager
    attrClear _ = clearBufferUndoManager

instance O.HasAttributeList Buffer
type instance O.AttributeList Buffer = BufferAttributeList
type BufferAttributeList = ('[ '("canRedo", BufferCanRedoPropertyInfo), '("canUndo", BufferCanUndoPropertyInfo), '("copyTargetList", Gtk.TextBuffer.TextBufferCopyTargetListPropertyInfo), '("cursorPosition", Gtk.TextBuffer.TextBufferCursorPositionPropertyInfo), '("hasSelection", Gtk.TextBuffer.TextBufferHasSelectionPropertyInfo), '("highlightMatchingBrackets", BufferHighlightMatchingBracketsPropertyInfo), '("highlightSyntax", BufferHighlightSyntaxPropertyInfo), '("implicitTrailingNewline", BufferImplicitTrailingNewlinePropertyInfo), '("language", BufferLanguagePropertyInfo), '("maxUndoLevels", BufferMaxUndoLevelsPropertyInfo), '("pasteTargetList", Gtk.TextBuffer.TextBufferPasteTargetListPropertyInfo), '("styleScheme", BufferStyleSchemePropertyInfo), '("tagTable", Gtk.TextBuffer.TextBufferTagTablePropertyInfo), '("text", Gtk.TextBuffer.TextBufferTextPropertyInfo), '("undoManager", BufferUndoManagerPropertyInfo)] :: [(Symbol, *)])

bufferHighlightMatchingBrackets :: AttrLabelProxy "highlightMatchingBrackets"
bufferHighlightMatchingBrackets = AttrLabelProxy

bufferHighlightSyntax :: AttrLabelProxy "highlightSyntax"
bufferHighlightSyntax = AttrLabelProxy

bufferImplicitTrailingNewline :: AttrLabelProxy "implicitTrailingNewline"
bufferImplicitTrailingNewline = AttrLabelProxy

bufferLanguage :: AttrLabelProxy "language"
bufferLanguage = AttrLabelProxy

bufferMaxUndoLevels :: AttrLabelProxy "maxUndoLevels"
bufferMaxUndoLevels = AttrLabelProxy

bufferStyleScheme :: AttrLabelProxy "styleScheme"
bufferStyleScheme = AttrLabelProxy

bufferUndoManager :: AttrLabelProxy "undoManager"
bufferUndoManager = AttrLabelProxy

data BufferBracketMatchedSignalInfo
instance SignalInfo BufferBracketMatchedSignalInfo where
    type HaskellCallbackType BufferBracketMatchedSignalInfo = BufferBracketMatchedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_BufferBracketMatchedCallback cb
        cb'' <- mk_BufferBracketMatchedCallback cb'
        connectSignalFunPtr obj "bracket-matched" cb'' connectMode

data BufferHighlightUpdatedSignalInfo
instance SignalInfo BufferHighlightUpdatedSignalInfo where
    type HaskellCallbackType BufferHighlightUpdatedSignalInfo = BufferHighlightUpdatedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_BufferHighlightUpdatedCallback cb
        cb'' <- mk_BufferHighlightUpdatedCallback cb'
        connectSignalFunPtr obj "highlight-updated" cb'' connectMode

data BufferRedoSignalInfo
instance SignalInfo BufferRedoSignalInfo where
    type HaskellCallbackType BufferRedoSignalInfo = BufferRedoCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_BufferRedoCallback cb
        cb'' <- mk_BufferRedoCallback cb'
        connectSignalFunPtr obj "redo" cb'' connectMode

data BufferSourceMarkUpdatedSignalInfo
instance SignalInfo BufferSourceMarkUpdatedSignalInfo where
    type HaskellCallbackType BufferSourceMarkUpdatedSignalInfo = BufferSourceMarkUpdatedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_BufferSourceMarkUpdatedCallback cb
        cb'' <- mk_BufferSourceMarkUpdatedCallback cb'
        connectSignalFunPtr obj "source-mark-updated" cb'' connectMode

data BufferUndoSignalInfo
instance SignalInfo BufferUndoSignalInfo where
    type HaskellCallbackType BufferUndoSignalInfo = BufferUndoCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_BufferUndoCallback cb
        cb'' <- mk_BufferUndoCallback cb'
        connectSignalFunPtr obj "undo" cb'' connectMode

type instance O.SignalList Buffer = BufferSignalList
type BufferSignalList = ('[ '("applyTag", Gtk.TextBuffer.TextBufferApplyTagSignalInfo), '("beginUserAction", Gtk.TextBuffer.TextBufferBeginUserActionSignalInfo), '("bracketMatched", BufferBracketMatchedSignalInfo), '("changed", Gtk.TextBuffer.TextBufferChangedSignalInfo), '("deleteRange", Gtk.TextBuffer.TextBufferDeleteRangeSignalInfo), '("endUserAction", Gtk.TextBuffer.TextBufferEndUserActionSignalInfo), '("highlightUpdated", BufferHighlightUpdatedSignalInfo), '("insertChildAnchor", Gtk.TextBuffer.TextBufferInsertChildAnchorSignalInfo), '("insertPixbuf", Gtk.TextBuffer.TextBufferInsertPixbufSignalInfo), '("insertText", Gtk.TextBuffer.TextBufferInsertTextSignalInfo), '("markDeleted", Gtk.TextBuffer.TextBufferMarkDeletedSignalInfo), '("markSet", Gtk.TextBuffer.TextBufferMarkSetSignalInfo), '("modifiedChanged", Gtk.TextBuffer.TextBufferModifiedChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("pasteDone", Gtk.TextBuffer.TextBufferPasteDoneSignalInfo), '("redo", BufferRedoSignalInfo), '("removeTag", Gtk.TextBuffer.TextBufferRemoveTagSignalInfo), '("sourceMarkUpdated", BufferSourceMarkUpdatedSignalInfo), '("undo", BufferUndoSignalInfo)] :: [(Symbol, *)])

-- method Buffer::new
-- method type : Constructor
-- Args : [Arg {argCName = "table", argType = TInterface (Name {namespace = "Gtk", name = "TextTagTable"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GtkTextTagTable, or %NULL to create a new one.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "Buffer"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_buffer_new" gtk_source_buffer_new :: 
    Ptr Gtk.TextTagTable.TextTagTable ->    -- table : TInterface (Name {namespace = "Gtk", name = "TextTagTable"})
    IO (Ptr Buffer)

{- |
Creates a new source buffer.
-}
bufferNew ::
    (B.CallStack.HasCallStack, MonadIO m, Gtk.TextTagTable.IsTextTagTable a) =>
    Maybe (a)
    {- ^ /@table@/: a 'GI.Gtk.Objects.TextTagTable.TextTagTable', or 'Nothing' to create a new one. -}
    -> m Buffer
    {- ^ __Returns:__ a new source buffer. -}
bufferNew table = liftIO $ do
    maybeTable <- case table of
        Nothing -> return nullPtr
        Just jTable -> do
            jTable' <- unsafeManagedPtrCastPtr jTable
            return jTable'
    result <- gtk_source_buffer_new maybeTable
    checkUnexpectedReturnNULL "bufferNew" result
    result' <- (wrapObject Buffer) result
    whenJust table touchManagedPtr
    return result'

-- method Buffer::new_with_language
-- method type : Constructor
-- Args : [Arg {argCName = "language", argType = TInterface (Name {namespace = "GtkSource", name = "Language"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceLanguage.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "Buffer"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_buffer_new_with_language" gtk_source_buffer_new_with_language :: 
    Ptr GtkSource.Language.Language ->      -- language : TInterface (Name {namespace = "GtkSource", name = "Language"})
    IO (Ptr Buffer)

{- |
Creates a new source buffer using the highlighting patterns in
/@language@/.  This is equivalent to creating a new source buffer with
a new tag table and then calling 'GI.GtkSource.Objects.Buffer.bufferSetLanguage'.
-}
bufferNewWithLanguage ::
    (B.CallStack.HasCallStack, MonadIO m, GtkSource.Language.IsLanguage a) =>
    a
    {- ^ /@language@/: a 'GI.GtkSource.Objects.Language.Language'. -}
    -> m Buffer
    {- ^ __Returns:__ a new source buffer which will highlight text
according to the highlighting patterns in /@language@/. -}
bufferNewWithLanguage language = liftIO $ do
    language' <- unsafeManagedPtrCastPtr language
    result <- gtk_source_buffer_new_with_language language'
    checkUnexpectedReturnNULL "bufferNewWithLanguage" result
    result' <- (wrapObject Buffer) result
    touchManagedPtr language
    return result'

-- method Buffer::backward_iter_to_source_mark
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "iter", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an iterator.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "category", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "category to search for, or %NULL", 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 "gtk_source_buffer_backward_iter_to_source_mark" gtk_source_buffer_backward_iter_to_source_mark :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    Ptr Gtk.TextIter.TextIter ->            -- iter : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    CString ->                              -- category : TBasicType TUTF8
    IO CInt

{- |
Moves /@iter@/ to the position of the previous 'GI.GtkSource.Objects.Mark.Mark' of the given
category. Returns 'True' if /@iter@/ was moved. If /@category@/ is NULL, the
previous source mark can be of any category.

@since 2.2
-}
bufferBackwardIterToSourceMark ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@iter@/: an iterator. -}
    -> Maybe (T.Text)
    {- ^ /@category@/: category to search for, or 'Nothing' -}
    -> m Bool
    {- ^ __Returns:__ whether /@iter@/ was moved. -}
bufferBackwardIterToSourceMark buffer iter category = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    iter' <- unsafeManagedPtrGetPtr iter
    maybeCategory <- case category of
        Nothing -> return nullPtr
        Just jCategory -> do
            jCategory' <- textToCString jCategory
            return jCategory'
    result <- gtk_source_buffer_backward_iter_to_source_mark buffer' iter' maybeCategory
    let result' = (/= 0) result
    touchManagedPtr buffer
    touchManagedPtr iter
    freeMem maybeCategory
    return result'

data BufferBackwardIterToSourceMarkMethodInfo
instance (signature ~ (Gtk.TextIter.TextIter -> Maybe (T.Text) -> m Bool), MonadIO m, IsBuffer a) => O.MethodInfo BufferBackwardIterToSourceMarkMethodInfo a signature where
    overloadedMethod _ = bufferBackwardIterToSourceMark

-- method Buffer::begin_not_undoable_action
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_buffer_begin_not_undoable_action" gtk_source_buffer_begin_not_undoable_action :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    IO ()

{- |
Marks the beginning of a not undoable action on the buffer,
disabling the undo manager.  Typically you would call this function
before initially setting the contents of the buffer (e.g. when
loading a file in a text editor).

You may nest 'GI.GtkSource.Objects.Buffer.bufferBeginNotUndoableAction' \/
'GI.GtkSource.Objects.Buffer.bufferEndNotUndoableAction' blocks.
-}
bufferBeginNotUndoableAction ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> m ()
bufferBeginNotUndoableAction buffer = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    gtk_source_buffer_begin_not_undoable_action buffer'
    touchManagedPtr buffer
    return ()

data BufferBeginNotUndoableActionMethodInfo
instance (signature ~ (m ()), MonadIO m, IsBuffer a) => O.MethodInfo BufferBeginNotUndoableActionMethodInfo a signature where
    overloadedMethod _ = bufferBeginNotUndoableAction

-- method Buffer::can_redo
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", 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 "gtk_source_buffer_can_redo" gtk_source_buffer_can_redo :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    IO CInt

{- |
Determines whether a source buffer can redo the last action
(i.e. if the last operation was an undo).
-}
bufferCanRedo ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if a redo is possible. -}
bufferCanRedo buffer = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    result <- gtk_source_buffer_can_redo buffer'
    let result' = (/= 0) result
    touchManagedPtr buffer
    return result'

data BufferCanRedoMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsBuffer a) => O.MethodInfo BufferCanRedoMethodInfo a signature where
    overloadedMethod _ = bufferCanRedo

-- method Buffer::can_undo
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", 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 "gtk_source_buffer_can_undo" gtk_source_buffer_can_undo :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    IO CInt

{- |
Determines whether a source buffer can undo the last action.
-}
bufferCanUndo ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if it\'s possible to undo the last action. -}
bufferCanUndo buffer = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    result <- gtk_source_buffer_can_undo buffer'
    let result' = (/= 0) result
    touchManagedPtr buffer
    return result'

data BufferCanUndoMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsBuffer a) => O.MethodInfo BufferCanUndoMethodInfo a signature where
    overloadedMethod _ = bufferCanUndo

-- method Buffer::change_case
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "case_type", argType = TInterface (Name {namespace = "GtkSource", name = "ChangeCaseType"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "how to change the case.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkTextIter.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "end", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkTextIter.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_buffer_change_case" gtk_source_buffer_change_case :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    CUInt ->                                -- case_type : TInterface (Name {namespace = "GtkSource", name = "ChangeCaseType"})
    Ptr Gtk.TextIter.TextIter ->            -- start : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr Gtk.TextIter.TextIter ->            -- end : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    IO ()

{- |
Changes the case of the text between the specified iterators.

@since 3.12
-}
bufferChangeCase ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> GtkSource.Enums.ChangeCaseType
    {- ^ /@caseType@/: how to change the case. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@start@/: a 'GI.Gtk.Structs.TextIter.TextIter'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@end@/: a 'GI.Gtk.Structs.TextIter.TextIter'. -}
    -> m ()
bufferChangeCase buffer caseType start end = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    let caseType' = (fromIntegral . fromEnum) caseType
    start' <- unsafeManagedPtrGetPtr start
    end' <- unsafeManagedPtrGetPtr end
    gtk_source_buffer_change_case buffer' caseType' start' end'
    touchManagedPtr buffer
    touchManagedPtr start
    touchManagedPtr end
    return ()

data BufferChangeCaseMethodInfo
instance (signature ~ (GtkSource.Enums.ChangeCaseType -> Gtk.TextIter.TextIter -> Gtk.TextIter.TextIter -> m ()), MonadIO m, IsBuffer a) => O.MethodInfo BufferChangeCaseMethodInfo a signature where
    overloadedMethod _ = bufferChangeCase

-- method Buffer::create_source_mark
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the name of the mark, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "category", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a string defining the mark category.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "where", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to place the mark.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "Mark"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_buffer_create_source_mark" gtk_source_buffer_create_source_mark :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    CString ->                              -- name : TBasicType TUTF8
    CString ->                              -- category : TBasicType TUTF8
    Ptr Gtk.TextIter.TextIter ->            -- where : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    IO (Ptr GtkSource.Mark.Mark)

{- |
Creates a source mark in the /@buffer@/ of category /@category@/.  A source mark is
a 'GI.Gtk.Objects.TextMark.TextMark' but organised into categories. Depending on the category
a pixbuf can be specified that will be displayed along the line of the mark.

Like a 'GI.Gtk.Objects.TextMark.TextMark', a 'GI.GtkSource.Objects.Mark.Mark' can be anonymous if the
passed /@name@/ is 'Nothing'.  Also, the buffer owns the marks so you
shouldn\'t unreference it.

Marks always have left gravity and are moved to the beginning of
the line when the user deletes the line they were in.

Typical uses for a source mark are bookmarks, breakpoints, current
executing instruction indication in a source file, etc..

@since 2.2
-}
bufferCreateSourceMark ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> Maybe (T.Text)
    {- ^ /@name@/: the name of the mark, or 'Nothing'. -}
    -> T.Text
    {- ^ /@category@/: a string defining the mark category. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@where@/: location to place the mark. -}
    -> m GtkSource.Mark.Mark
    {- ^ __Returns:__ a new 'GI.GtkSource.Objects.Mark.Mark', owned by the buffer. -}
bufferCreateSourceMark buffer name category where_ = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    maybeName <- case name of
        Nothing -> return nullPtr
        Just jName -> do
            jName' <- textToCString jName
            return jName'
    category' <- textToCString category
    where_' <- unsafeManagedPtrGetPtr where_
    result <- gtk_source_buffer_create_source_mark buffer' maybeName category' where_'
    checkUnexpectedReturnNULL "bufferCreateSourceMark" result
    result' <- (newObject GtkSource.Mark.Mark) result
    touchManagedPtr buffer
    touchManagedPtr where_
    freeMem maybeName
    freeMem category'
    return result'

data BufferCreateSourceMarkMethodInfo
instance (signature ~ (Maybe (T.Text) -> T.Text -> Gtk.TextIter.TextIter -> m GtkSource.Mark.Mark), MonadIO m, IsBuffer a) => O.MethodInfo BufferCreateSourceMarkMethodInfo a signature where
    overloadedMethod _ = bufferCreateSourceMark

-- method Buffer::end_not_undoable_action
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_buffer_end_not_undoable_action" gtk_source_buffer_end_not_undoable_action :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    IO ()

{- |
Marks the end of a not undoable action on the buffer.  When the
last not undoable block is closed through the call to this
function, the list of undo actions is cleared and the undo manager
is re-enabled.
-}
bufferEndNotUndoableAction ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> m ()
bufferEndNotUndoableAction buffer = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    gtk_source_buffer_end_not_undoable_action buffer'
    touchManagedPtr buffer
    return ()

data BufferEndNotUndoableActionMethodInfo
instance (signature ~ (m ()), MonadIO m, IsBuffer a) => O.MethodInfo BufferEndNotUndoableActionMethodInfo a signature where
    overloadedMethod _ = bufferEndNotUndoableAction

-- method Buffer::ensure_highlight
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "start of the area to highlight.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "end", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "end of the area to highlight.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_buffer_ensure_highlight" gtk_source_buffer_ensure_highlight :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    Ptr Gtk.TextIter.TextIter ->            -- start : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr Gtk.TextIter.TextIter ->            -- end : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    IO ()

{- |
Forces buffer to analyze and highlight the given area synchronously.

\<note>
  \<para>
    This is a potentially slow operation and should be used only
    when you need to make sure that some text not currently
    visible is highlighted, for instance before printing.
  \<\/para>
\<\/note>
-}
bufferEnsureHighlight ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@start@/: start of the area to highlight. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@end@/: end of the area to highlight. -}
    -> m ()
bufferEnsureHighlight buffer start end = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    start' <- unsafeManagedPtrGetPtr start
    end' <- unsafeManagedPtrGetPtr end
    gtk_source_buffer_ensure_highlight buffer' start' end'
    touchManagedPtr buffer
    touchManagedPtr start
    touchManagedPtr end
    return ()

data BufferEnsureHighlightMethodInfo
instance (signature ~ (Gtk.TextIter.TextIter -> Gtk.TextIter.TextIter -> m ()), MonadIO m, IsBuffer a) => O.MethodInfo BufferEnsureHighlightMethodInfo a signature where
    overloadedMethod _ = bufferEnsureHighlight

-- method Buffer::forward_iter_to_source_mark
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "iter", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an iterator.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "category", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "category to search for, or %NULL", 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 "gtk_source_buffer_forward_iter_to_source_mark" gtk_source_buffer_forward_iter_to_source_mark :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    Ptr Gtk.TextIter.TextIter ->            -- iter : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    CString ->                              -- category : TBasicType TUTF8
    IO CInt

{- |
Moves /@iter@/ to the position of the next 'GI.GtkSource.Objects.Mark.Mark' of the given
/@category@/. Returns 'True' if /@iter@/ was moved. If /@category@/ is NULL, the
next source mark can be of any category.

@since 2.2
-}
bufferForwardIterToSourceMark ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@iter@/: an iterator. -}
    -> Maybe (T.Text)
    {- ^ /@category@/: category to search for, or 'Nothing' -}
    -> m Bool
    {- ^ __Returns:__ whether /@iter@/ was moved. -}
bufferForwardIterToSourceMark buffer iter category = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    iter' <- unsafeManagedPtrGetPtr iter
    maybeCategory <- case category of
        Nothing -> return nullPtr
        Just jCategory -> do
            jCategory' <- textToCString jCategory
            return jCategory'
    result <- gtk_source_buffer_forward_iter_to_source_mark buffer' iter' maybeCategory
    let result' = (/= 0) result
    touchManagedPtr buffer
    touchManagedPtr iter
    freeMem maybeCategory
    return result'

data BufferForwardIterToSourceMarkMethodInfo
instance (signature ~ (Gtk.TextIter.TextIter -> Maybe (T.Text) -> m Bool), MonadIO m, IsBuffer a) => O.MethodInfo BufferForwardIterToSourceMarkMethodInfo a signature where
    overloadedMethod _ = bufferForwardIterToSourceMark

-- method Buffer::get_context_classes_at_iter
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "iter", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkTextIter.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_buffer_get_context_classes_at_iter" gtk_source_buffer_get_context_classes_at_iter :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    Ptr Gtk.TextIter.TextIter ->            -- iter : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    IO (Ptr CString)

{- |
Get all defined context classes at /@iter@/.

See the 'GI.GtkSource.Objects.Buffer.Buffer' description for the list of default context classes.

@since 2.10
-}
bufferGetContextClassesAtIter ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@iter@/: a 'GI.Gtk.Structs.TextIter.TextIter'. -}
    -> m [T.Text]
    {- ^ __Returns:__ a new 'Nothing'
terminated array of context class names.
Use 'GI.GLib.Functions.strfreev' to free the array if it is no longer needed. -}
bufferGetContextClassesAtIter buffer iter = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    iter' <- unsafeManagedPtrGetPtr iter
    result <- gtk_source_buffer_get_context_classes_at_iter buffer' iter'
    checkUnexpectedReturnNULL "bufferGetContextClassesAtIter" result
    result' <- unpackZeroTerminatedUTF8CArray result
    mapZeroTerminatedCArray freeMem result
    freeMem result
    touchManagedPtr buffer
    touchManagedPtr iter
    return result'

data BufferGetContextClassesAtIterMethodInfo
instance (signature ~ (Gtk.TextIter.TextIter -> m [T.Text]), MonadIO m, IsBuffer a) => O.MethodInfo BufferGetContextClassesAtIterMethodInfo a signature where
    overloadedMethod _ = bufferGetContextClassesAtIter

-- method Buffer::get_highlight_matching_brackets
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", 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 "gtk_source_buffer_get_highlight_matching_brackets" gtk_source_buffer_get_highlight_matching_brackets :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    IO CInt

{- |
Determines whether bracket match highlighting is activated for the
source buffer.
-}
bufferGetHighlightMatchingBrackets ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the source buffer will highlight matching
brackets. -}
bufferGetHighlightMatchingBrackets buffer = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    result <- gtk_source_buffer_get_highlight_matching_brackets buffer'
    let result' = (/= 0) result
    touchManagedPtr buffer
    return result'

data BufferGetHighlightMatchingBracketsMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsBuffer a) => O.MethodInfo BufferGetHighlightMatchingBracketsMethodInfo a signature where
    overloadedMethod _ = bufferGetHighlightMatchingBrackets

-- method Buffer::get_highlight_syntax
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", 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 "gtk_source_buffer_get_highlight_syntax" gtk_source_buffer_get_highlight_syntax :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    IO CInt

{- |
Determines whether syntax highlighting is activated in the source
buffer.
-}
bufferGetHighlightSyntax ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if syntax highlighting is enabled, 'False' otherwise. -}
bufferGetHighlightSyntax buffer = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    result <- gtk_source_buffer_get_highlight_syntax buffer'
    let result' = (/= 0) result
    touchManagedPtr buffer
    return result'

data BufferGetHighlightSyntaxMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsBuffer a) => O.MethodInfo BufferGetHighlightSyntaxMethodInfo a signature where
    overloadedMethod _ = bufferGetHighlightSyntax

-- method Buffer::get_implicit_trailing_newline
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", 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 "gtk_source_buffer_get_implicit_trailing_newline" gtk_source_buffer_get_implicit_trailing_newline :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    IO CInt

{- |
/No description available in the introspection data./

@since 3.14
-}
bufferGetImplicitTrailingNewline ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> m Bool
    {- ^ __Returns:__ whether the /@buffer@/ has an implicit trailing newline. -}
bufferGetImplicitTrailingNewline buffer = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    result <- gtk_source_buffer_get_implicit_trailing_newline buffer'
    let result' = (/= 0) result
    touchManagedPtr buffer
    return result'

data BufferGetImplicitTrailingNewlineMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsBuffer a) => O.MethodInfo BufferGetImplicitTrailingNewlineMethodInfo a signature where
    overloadedMethod _ = bufferGetImplicitTrailingNewline

-- method Buffer::get_language
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "Language"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_buffer_get_language" gtk_source_buffer_get_language :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    IO (Ptr GtkSource.Language.Language)

{- |
Returns the 'GI.GtkSource.Objects.Language.Language' associated with the buffer,
see 'GI.GtkSource.Objects.Buffer.bufferSetLanguage'.  The returned object should not be
unreferenced by the user.
-}
bufferGetLanguage ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> m (Maybe GtkSource.Language.Language)
    {- ^ __Returns:__ the 'GI.GtkSource.Objects.Language.Language' associated
with the buffer, or 'Nothing'. -}
bufferGetLanguage buffer = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    result <- gtk_source_buffer_get_language buffer'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject GtkSource.Language.Language) result'
        return result''
    touchManagedPtr buffer
    return maybeResult

data BufferGetLanguageMethodInfo
instance (signature ~ (m (Maybe GtkSource.Language.Language)), MonadIO m, IsBuffer a) => O.MethodInfo BufferGetLanguageMethodInfo a signature where
    overloadedMethod _ = bufferGetLanguage

-- method Buffer::get_max_undo_levels
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", 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 "gtk_source_buffer_get_max_undo_levels" gtk_source_buffer_get_max_undo_levels :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    IO Int32

{- |
Determines the number of undo levels the buffer will track for buffer edits.
-}
bufferGetMaxUndoLevels ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> m Int32
    {- ^ __Returns:__ the maximum number of possible undo levels or -1 if no limit is set. -}
bufferGetMaxUndoLevels buffer = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    result <- gtk_source_buffer_get_max_undo_levels buffer'
    touchManagedPtr buffer
    return result

data BufferGetMaxUndoLevelsMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsBuffer a) => O.MethodInfo BufferGetMaxUndoLevelsMethodInfo a signature where
    overloadedMethod _ = bufferGetMaxUndoLevels

-- method Buffer::get_source_marks_at_iter
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "iter", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an iterator.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "category", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "category to search for, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGSList (TInterface (Name {namespace = "GtkSource", name = "Mark"})))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_buffer_get_source_marks_at_iter" gtk_source_buffer_get_source_marks_at_iter :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    Ptr Gtk.TextIter.TextIter ->            -- iter : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    CString ->                              -- category : TBasicType TUTF8
    IO (Ptr (GSList (Ptr GtkSource.Mark.Mark)))

{- |
Returns the list of marks of the given category at /@iter@/. If /@category@/
is 'Nothing' it returns all marks at /@iter@/.

@since 2.2
-}
bufferGetSourceMarksAtIter ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@iter@/: an iterator. -}
    -> Maybe (T.Text)
    {- ^ /@category@/: category to search for, or 'Nothing' -}
    -> m [GtkSource.Mark.Mark]
    {- ^ __Returns:__ 
a newly allocated 'GI.GLib.Structs.SList.SList'. -}
bufferGetSourceMarksAtIter buffer iter category = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    iter' <- unsafeManagedPtrGetPtr iter
    maybeCategory <- case category of
        Nothing -> return nullPtr
        Just jCategory -> do
            jCategory' <- textToCString jCategory
            return jCategory'
    result <- gtk_source_buffer_get_source_marks_at_iter buffer' iter' maybeCategory
    result' <- unpackGSList result
    result'' <- mapM (newObject GtkSource.Mark.Mark) result'
    g_slist_free result
    touchManagedPtr buffer
    touchManagedPtr iter
    freeMem maybeCategory
    return result''

data BufferGetSourceMarksAtIterMethodInfo
instance (signature ~ (Gtk.TextIter.TextIter -> Maybe (T.Text) -> m [GtkSource.Mark.Mark]), MonadIO m, IsBuffer a) => O.MethodInfo BufferGetSourceMarksAtIterMethodInfo a signature where
    overloadedMethod _ = bufferGetSourceMarksAtIter

-- method Buffer::get_source_marks_at_line
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", 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 "a line number.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "category", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "category to search for, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGSList (TInterface (Name {namespace = "GtkSource", name = "Mark"})))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_buffer_get_source_marks_at_line" gtk_source_buffer_get_source_marks_at_line :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    Int32 ->                                -- line : TBasicType TInt
    CString ->                              -- category : TBasicType TUTF8
    IO (Ptr (GSList (Ptr GtkSource.Mark.Mark)))

{- |
Returns the list of marks of the given category at /@line@/.
If /@category@/ is 'Nothing', all marks at /@line@/ are returned.

@since 2.2
-}
bufferGetSourceMarksAtLine ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> Int32
    {- ^ /@line@/: a line number. -}
    -> Maybe (T.Text)
    {- ^ /@category@/: category to search for, or 'Nothing' -}
    -> m [GtkSource.Mark.Mark]
    {- ^ __Returns:__ 
a newly allocated 'GI.GLib.Structs.SList.SList'. -}
bufferGetSourceMarksAtLine buffer line category = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    maybeCategory <- case category of
        Nothing -> return nullPtr
        Just jCategory -> do
            jCategory' <- textToCString jCategory
            return jCategory'
    result <- gtk_source_buffer_get_source_marks_at_line buffer' line maybeCategory
    result' <- unpackGSList result
    result'' <- mapM (newObject GtkSource.Mark.Mark) result'
    g_slist_free result
    touchManagedPtr buffer
    freeMem maybeCategory
    return result''

data BufferGetSourceMarksAtLineMethodInfo
instance (signature ~ (Int32 -> Maybe (T.Text) -> m [GtkSource.Mark.Mark]), MonadIO m, IsBuffer a) => O.MethodInfo BufferGetSourceMarksAtLineMethodInfo a signature where
    overloadedMethod _ = bufferGetSourceMarksAtLine

-- method Buffer::get_style_scheme
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "StyleScheme"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_buffer_get_style_scheme" gtk_source_buffer_get_style_scheme :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    IO (Ptr GtkSource.StyleScheme.StyleScheme)

{- |
Returns the 'GI.GtkSource.Objects.StyleScheme.StyleScheme' associated with the buffer,
see 'GI.GtkSource.Objects.Buffer.bufferSetStyleScheme'.
The returned object should not be unreferenced by the user.
-}
bufferGetStyleScheme ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> m (Maybe GtkSource.StyleScheme.StyleScheme)
    {- ^ __Returns:__ the 'GI.GtkSource.Objects.StyleScheme.StyleScheme'
associated with the buffer, or 'Nothing'. -}
bufferGetStyleScheme buffer = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    result <- gtk_source_buffer_get_style_scheme buffer'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject GtkSource.StyleScheme.StyleScheme) result'
        return result''
    touchManagedPtr buffer
    return maybeResult

data BufferGetStyleSchemeMethodInfo
instance (signature ~ (m (Maybe GtkSource.StyleScheme.StyleScheme)), MonadIO m, IsBuffer a) => O.MethodInfo BufferGetStyleSchemeMethodInfo a signature where
    overloadedMethod _ = bufferGetStyleScheme

-- method Buffer::get_undo_manager
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "UndoManager"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_buffer_get_undo_manager" gtk_source_buffer_get_undo_manager :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    IO (Ptr GtkSource.UndoManager.UndoManager)

{- |
Returns the 'GI.GtkSource.Interfaces.UndoManager.UndoManager' associated with the buffer,
see 'GI.GtkSource.Objects.Buffer.bufferSetUndoManager'.  The returned object should not be
unreferenced by the user.
-}
bufferGetUndoManager ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> m (Maybe GtkSource.UndoManager.UndoManager)
    {- ^ __Returns:__ the 'GI.GtkSource.Interfaces.UndoManager.UndoManager' associated
with the buffer, or 'Nothing'. -}
bufferGetUndoManager buffer = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    result <- gtk_source_buffer_get_undo_manager buffer'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject GtkSource.UndoManager.UndoManager) result'
        return result''
    touchManagedPtr buffer
    return maybeResult

data BufferGetUndoManagerMethodInfo
instance (signature ~ (m (Maybe GtkSource.UndoManager.UndoManager)), MonadIO m, IsBuffer a) => O.MethodInfo BufferGetUndoManagerMethodInfo a signature where
    overloadedMethod _ = bufferGetUndoManager

-- method Buffer::iter_backward_to_context_class_toggle
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "iter", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkTextIter.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "context_class", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the context class.", 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 "gtk_source_buffer_iter_backward_to_context_class_toggle" gtk_source_buffer_iter_backward_to_context_class_toggle :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    Ptr Gtk.TextIter.TextIter ->            -- iter : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    CString ->                              -- context_class : TBasicType TUTF8
    IO CInt

{- |
Moves backward to the next toggle (on or off) of the context class. If no
matching context class toggles are found, returns 'False', otherwise 'True'.
Does not return toggles located at /@iter@/, only toggles after /@iter@/. Sets
/@iter@/ to the location of the toggle, or to the end of the buffer if no
toggle is found.

See the 'GI.GtkSource.Objects.Buffer.Buffer' description for the list of default context classes.

@since 2.10
-}
bufferIterBackwardToContextClassToggle ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@iter@/: a 'GI.Gtk.Structs.TextIter.TextIter'. -}
    -> T.Text
    {- ^ /@contextClass@/: the context class. -}
    -> m Bool
    {- ^ __Returns:__ whether we found a context class toggle before /@iter@/ -}
bufferIterBackwardToContextClassToggle buffer iter contextClass = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    iter' <- unsafeManagedPtrGetPtr iter
    contextClass' <- textToCString contextClass
    result <- gtk_source_buffer_iter_backward_to_context_class_toggle buffer' iter' contextClass'
    let result' = (/= 0) result
    touchManagedPtr buffer
    touchManagedPtr iter
    freeMem contextClass'
    return result'

data BufferIterBackwardToContextClassToggleMethodInfo
instance (signature ~ (Gtk.TextIter.TextIter -> T.Text -> m Bool), MonadIO m, IsBuffer a) => O.MethodInfo BufferIterBackwardToContextClassToggleMethodInfo a signature where
    overloadedMethod _ = bufferIterBackwardToContextClassToggle

-- method Buffer::iter_forward_to_context_class_toggle
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "iter", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkTextIter.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "context_class", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the context class.", 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 "gtk_source_buffer_iter_forward_to_context_class_toggle" gtk_source_buffer_iter_forward_to_context_class_toggle :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    Ptr Gtk.TextIter.TextIter ->            -- iter : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    CString ->                              -- context_class : TBasicType TUTF8
    IO CInt

{- |
Moves forward to the next toggle (on or off) of the context class. If no
matching context class toggles are found, returns 'False', otherwise 'True'.
Does not return toggles located at /@iter@/, only toggles after /@iter@/. Sets
/@iter@/ to the location of the toggle, or to the end of the buffer if no
toggle is found.

See the 'GI.GtkSource.Objects.Buffer.Buffer' description for the list of default context classes.

@since 2.10
-}
bufferIterForwardToContextClassToggle ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@iter@/: a 'GI.Gtk.Structs.TextIter.TextIter'. -}
    -> T.Text
    {- ^ /@contextClass@/: the context class. -}
    -> m Bool
    {- ^ __Returns:__ whether we found a context class toggle after /@iter@/ -}
bufferIterForwardToContextClassToggle buffer iter contextClass = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    iter' <- unsafeManagedPtrGetPtr iter
    contextClass' <- textToCString contextClass
    result <- gtk_source_buffer_iter_forward_to_context_class_toggle buffer' iter' contextClass'
    let result' = (/= 0) result
    touchManagedPtr buffer
    touchManagedPtr iter
    freeMem contextClass'
    return result'

data BufferIterForwardToContextClassToggleMethodInfo
instance (signature ~ (Gtk.TextIter.TextIter -> T.Text -> m Bool), MonadIO m, IsBuffer a) => O.MethodInfo BufferIterForwardToContextClassToggleMethodInfo a signature where
    overloadedMethod _ = bufferIterForwardToContextClassToggle

-- method Buffer::iter_has_context_class
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "iter", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkTextIter.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "context_class", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "class to search for.", 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 "gtk_source_buffer_iter_has_context_class" gtk_source_buffer_iter_has_context_class :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    Ptr Gtk.TextIter.TextIter ->            -- iter : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    CString ->                              -- context_class : TBasicType TUTF8
    IO CInt

{- |
Check if the class /@contextClass@/ is set on /@iter@/.

See the 'GI.GtkSource.Objects.Buffer.Buffer' description for the list of default context classes.

@since 2.10
-}
bufferIterHasContextClass ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@iter@/: a 'GI.Gtk.Structs.TextIter.TextIter'. -}
    -> T.Text
    {- ^ /@contextClass@/: class to search for. -}
    -> m Bool
    {- ^ __Returns:__ whether /@iter@/ has the context class. -}
bufferIterHasContextClass buffer iter contextClass = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    iter' <- unsafeManagedPtrGetPtr iter
    contextClass' <- textToCString contextClass
    result <- gtk_source_buffer_iter_has_context_class buffer' iter' contextClass'
    let result' = (/= 0) result
    touchManagedPtr buffer
    touchManagedPtr iter
    freeMem contextClass'
    return result'

data BufferIterHasContextClassMethodInfo
instance (signature ~ (Gtk.TextIter.TextIter -> T.Text -> m Bool), MonadIO m, IsBuffer a) => O.MethodInfo BufferIterHasContextClassMethodInfo a signature where
    overloadedMethod _ = bufferIterHasContextClass

-- method Buffer::join_lines
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkTextIter.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "end", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkTextIter.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_buffer_join_lines" gtk_source_buffer_join_lines :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    Ptr Gtk.TextIter.TextIter ->            -- start : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr Gtk.TextIter.TextIter ->            -- end : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    IO ()

{- |
Joins the lines of text between the specified iterators.

@since 3.16
-}
bufferJoinLines ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@start@/: a 'GI.Gtk.Structs.TextIter.TextIter'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@end@/: a 'GI.Gtk.Structs.TextIter.TextIter'. -}
    -> m ()
bufferJoinLines buffer start end = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    start' <- unsafeManagedPtrGetPtr start
    end' <- unsafeManagedPtrGetPtr end
    gtk_source_buffer_join_lines buffer' start' end'
    touchManagedPtr buffer
    touchManagedPtr start
    touchManagedPtr end
    return ()

data BufferJoinLinesMethodInfo
instance (signature ~ (Gtk.TextIter.TextIter -> Gtk.TextIter.TextIter -> m ()), MonadIO m, IsBuffer a) => O.MethodInfo BufferJoinLinesMethodInfo a signature where
    overloadedMethod _ = bufferJoinLines

-- method Buffer::redo
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_buffer_redo" gtk_source_buffer_redo :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    IO ()

{- |
Redoes the last undo operation.  Use 'GI.GtkSource.Objects.Buffer.bufferCanRedo'
to check whether a call to this function will have any effect.

This function emits the 'GI.GtkSource.Objects.Buffer.Buffer'::@/redo/@ signal.
-}
bufferRedo ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> m ()
bufferRedo buffer = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    gtk_source_buffer_redo buffer'
    touchManagedPtr buffer
    return ()

data BufferRedoMethodInfo
instance (signature ~ (m ()), MonadIO m, IsBuffer a) => O.MethodInfo BufferRedoMethodInfo a signature where
    overloadedMethod _ = bufferRedo

-- method Buffer::remove_source_marks
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkTextIter.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "end", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkTextIter.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "category", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "category to search for, 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 "gtk_source_buffer_remove_source_marks" gtk_source_buffer_remove_source_marks :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    Ptr Gtk.TextIter.TextIter ->            -- start : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr Gtk.TextIter.TextIter ->            -- end : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    CString ->                              -- category : TBasicType TUTF8
    IO ()

{- |
Remove all marks of /@category@/ between /@start@/ and /@end@/ from the buffer.
If /@category@/ is NULL, all marks in the range will be removed.

@since 2.2
-}
bufferRemoveSourceMarks ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@start@/: a 'GI.Gtk.Structs.TextIter.TextIter'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@end@/: a 'GI.Gtk.Structs.TextIter.TextIter'. -}
    -> Maybe (T.Text)
    {- ^ /@category@/: category to search for, or 'Nothing'. -}
    -> m ()
bufferRemoveSourceMarks buffer start end category = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    start' <- unsafeManagedPtrGetPtr start
    end' <- unsafeManagedPtrGetPtr end
    maybeCategory <- case category of
        Nothing -> return nullPtr
        Just jCategory -> do
            jCategory' <- textToCString jCategory
            return jCategory'
    gtk_source_buffer_remove_source_marks buffer' start' end' maybeCategory
    touchManagedPtr buffer
    touchManagedPtr start
    touchManagedPtr end
    freeMem maybeCategory
    return ()

data BufferRemoveSourceMarksMethodInfo
instance (signature ~ (Gtk.TextIter.TextIter -> Gtk.TextIter.TextIter -> Maybe (T.Text) -> m ()), MonadIO m, IsBuffer a) => O.MethodInfo BufferRemoveSourceMarksMethodInfo a signature where
    overloadedMethod _ = bufferRemoveSourceMarks

-- method Buffer::set_highlight_matching_brackets
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "highlight", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "%TRUE if you want matching brackets highlighted.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_buffer_set_highlight_matching_brackets" gtk_source_buffer_set_highlight_matching_brackets :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    CInt ->                                 -- highlight : TBasicType TBoolean
    IO ()

{- |
Controls the bracket match highlighting function in the buffer.  If
activated, when you position your cursor over a bracket character
(a parenthesis, a square bracket, etc.) the matching opening or
closing bracket character will be highlighted.
-}
bufferSetHighlightMatchingBrackets ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> Bool
    {- ^ /@highlight@/: 'True' if you want matching brackets highlighted. -}
    -> m ()
bufferSetHighlightMatchingBrackets buffer highlight = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    let highlight' = (fromIntegral . fromEnum) highlight
    gtk_source_buffer_set_highlight_matching_brackets buffer' highlight'
    touchManagedPtr buffer
    return ()

data BufferSetHighlightMatchingBracketsMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsBuffer a) => O.MethodInfo BufferSetHighlightMatchingBracketsMethodInfo a signature where
    overloadedMethod _ = bufferSetHighlightMatchingBrackets

-- method Buffer::set_highlight_syntax
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "highlight", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "%TRUE to enable syntax highlighting, %FALSE to disable it.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_buffer_set_highlight_syntax" gtk_source_buffer_set_highlight_syntax :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    CInt ->                                 -- highlight : TBasicType TBoolean
    IO ()

{- |
Controls whether syntax is highlighted in the buffer.

If /@highlight@/ is 'True', the text will be highlighted according to the syntax
patterns specified in the 'GI.GtkSource.Objects.Language.Language' set with
'GI.GtkSource.Objects.Buffer.bufferSetLanguage'.

If /@highlight@/ is 'False', syntax highlighting is disabled and all the
'GI.Gtk.Objects.TextTag.TextTag' objects that have been added by the syntax highlighting engine
are removed from the buffer.
-}
bufferSetHighlightSyntax ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> Bool
    {- ^ /@highlight@/: 'True' to enable syntax highlighting, 'False' to disable it. -}
    -> m ()
bufferSetHighlightSyntax buffer highlight = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    let highlight' = (fromIntegral . fromEnum) highlight
    gtk_source_buffer_set_highlight_syntax buffer' highlight'
    touchManagedPtr buffer
    return ()

data BufferSetHighlightSyntaxMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsBuffer a) => O.MethodInfo BufferSetHighlightSyntaxMethodInfo a signature where
    overloadedMethod _ = bufferSetHighlightSyntax

-- method Buffer::set_implicit_trailing_newline
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "implicit_trailing_newline", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new value.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_buffer_set_implicit_trailing_newline" gtk_source_buffer_set_implicit_trailing_newline :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    CInt ->                                 -- implicit_trailing_newline : TBasicType TBoolean
    IO ()

{- |
Sets whether the /@buffer@/ has an implicit trailing newline.

If an explicit trailing newline is present in a 'GI.Gtk.Objects.TextBuffer.TextBuffer', 'GI.Gtk.Objects.TextView.TextView'
shows it as an empty line. This is generally not what the user expects.

If /@implicitTrailingNewline@/ is 'True' (the default value):
 - when a 'GI.GtkSource.Objects.FileLoader.FileLoader' loads the content of a file into the /@buffer@/,
   the trailing newline (if present in the file) is not inserted into the
   /@buffer@/.
 - when a 'GI.GtkSource.Objects.FileSaver.FileSaver' saves the content of the /@buffer@/ into a file, a
   trailing newline is added to the file.

On the other hand, if /@implicitTrailingNewline@/ is 'False', the file\'s
content is not modified when loaded into the /@buffer@/, and the /@buffer@/\'s
content is not modified when saved into a file.

@since 3.14
-}
bufferSetImplicitTrailingNewline ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> Bool
    {- ^ /@implicitTrailingNewline@/: the new value. -}
    -> m ()
bufferSetImplicitTrailingNewline buffer implicitTrailingNewline = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    let implicitTrailingNewline' = (fromIntegral . fromEnum) implicitTrailingNewline
    gtk_source_buffer_set_implicit_trailing_newline buffer' implicitTrailingNewline'
    touchManagedPtr buffer
    return ()

data BufferSetImplicitTrailingNewlineMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsBuffer a) => O.MethodInfo BufferSetImplicitTrailingNewlineMethodInfo a signature where
    overloadedMethod _ = bufferSetImplicitTrailingNewline

-- method Buffer::set_language
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "language", argType = TInterface (Name {namespace = "GtkSource", name = "Language"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GtkSourceLanguage to set, 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 "gtk_source_buffer_set_language" gtk_source_buffer_set_language :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    Ptr GtkSource.Language.Language ->      -- language : TInterface (Name {namespace = "GtkSource", name = "Language"})
    IO ()

{- |
Associates a 'GI.GtkSource.Objects.Language.Language' with the buffer.

Note that a 'GI.GtkSource.Objects.Language.Language' affects not only the syntax highlighting, but
also the [context classes][context-classes]. If you want to disable just the
syntax highlighting, see 'GI.GtkSource.Objects.Buffer.bufferSetHighlightSyntax'.

The buffer holds a reference to /@language@/.
-}
bufferSetLanguage ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a, GtkSource.Language.IsLanguage b) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> Maybe (b)
    {- ^ /@language@/: a 'GI.GtkSource.Objects.Language.Language' to set, or 'Nothing'. -}
    -> m ()
bufferSetLanguage buffer language = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    maybeLanguage <- case language of
        Nothing -> return nullPtr
        Just jLanguage -> do
            jLanguage' <- unsafeManagedPtrCastPtr jLanguage
            return jLanguage'
    gtk_source_buffer_set_language buffer' maybeLanguage
    touchManagedPtr buffer
    whenJust language touchManagedPtr
    return ()

data BufferSetLanguageMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsBuffer a, GtkSource.Language.IsLanguage b) => O.MethodInfo BufferSetLanguageMethodInfo a signature where
    overloadedMethod _ = bufferSetLanguage

-- method Buffer::set_max_undo_levels
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "max_undo_levels", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the desired maximum number of undo levels.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_buffer_set_max_undo_levels" gtk_source_buffer_set_max_undo_levels :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    Int32 ->                                -- max_undo_levels : TBasicType TInt
    IO ()

{- |
Sets the number of undo levels for user actions the buffer will
track.  If the number of user actions exceeds the limit set by this
function, older actions will be discarded.

If /@maxUndoLevels@/ is -1, the undo\/redo is unlimited.

If /@maxUndoLevels@/ is 0, the undo\/redo is disabled.
-}
bufferSetMaxUndoLevels ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> Int32
    {- ^ /@maxUndoLevels@/: the desired maximum number of undo levels. -}
    -> m ()
bufferSetMaxUndoLevels buffer maxUndoLevels = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    gtk_source_buffer_set_max_undo_levels buffer' maxUndoLevels
    touchManagedPtr buffer
    return ()

data BufferSetMaxUndoLevelsMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m, IsBuffer a) => O.MethodInfo BufferSetMaxUndoLevelsMethodInfo a signature where
    overloadedMethod _ = bufferSetMaxUndoLevels

-- method Buffer::set_style_scheme
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "scheme", argType = TInterface (Name {namespace = "GtkSource", name = "StyleScheme"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GtkSourceStyleScheme 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 "gtk_source_buffer_set_style_scheme" gtk_source_buffer_set_style_scheme :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    Ptr GtkSource.StyleScheme.StyleScheme -> -- scheme : TInterface (Name {namespace = "GtkSource", name = "StyleScheme"})
    IO ()

{- |
Sets a 'GI.GtkSource.Objects.StyleScheme.StyleScheme' to be used by the buffer and the view.

Note that a 'GI.GtkSource.Objects.StyleScheme.StyleScheme' affects not only the syntax highlighting,
but also other 'GI.GtkSource.Objects.View.View' features such as highlighting the current line,
matching brackets, the line numbers, etc.

Instead of setting a 'Nothing' /@scheme@/, it is better to disable syntax
highlighting with 'GI.GtkSource.Objects.Buffer.bufferSetHighlightSyntax', and setting the
'GI.GtkSource.Objects.StyleScheme.StyleScheme' with the \"classic\" or \"tango\" ID, because those two
style schemes follow more closely the GTK+ theme (for example for the
background color).

The buffer holds a reference to /@scheme@/.
-}
bufferSetStyleScheme ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a, GtkSource.StyleScheme.IsStyleScheme b) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> Maybe (b)
    {- ^ /@scheme@/: a 'GI.GtkSource.Objects.StyleScheme.StyleScheme' or 'Nothing'. -}
    -> m ()
bufferSetStyleScheme buffer scheme = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    maybeScheme <- case scheme of
        Nothing -> return nullPtr
        Just jScheme -> do
            jScheme' <- unsafeManagedPtrCastPtr jScheme
            return jScheme'
    gtk_source_buffer_set_style_scheme buffer' maybeScheme
    touchManagedPtr buffer
    whenJust scheme touchManagedPtr
    return ()

data BufferSetStyleSchemeMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsBuffer a, GtkSource.StyleScheme.IsStyleScheme b) => O.MethodInfo BufferSetStyleSchemeMethodInfo a signature where
    overloadedMethod _ = bufferSetStyleScheme

-- method Buffer::set_undo_manager
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "manager", argType = TInterface (Name {namespace = "GtkSource", name = "UndoManager"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GtkSourceUndoManager 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 "gtk_source_buffer_set_undo_manager" gtk_source_buffer_set_undo_manager :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    Ptr GtkSource.UndoManager.UndoManager -> -- manager : TInterface (Name {namespace = "GtkSource", name = "UndoManager"})
    IO ()

{- |
Set the buffer undo manager. If /@manager@/ is 'Nothing' the default undo manager
will be set.
-}
bufferSetUndoManager ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a, GtkSource.UndoManager.IsUndoManager b) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> Maybe (b)
    {- ^ /@manager@/: A 'GI.GtkSource.Interfaces.UndoManager.UndoManager' or 'Nothing'. -}
    -> m ()
bufferSetUndoManager buffer manager = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    maybeManager <- case manager of
        Nothing -> return nullPtr
        Just jManager -> do
            jManager' <- unsafeManagedPtrCastPtr jManager
            return jManager'
    gtk_source_buffer_set_undo_manager buffer' maybeManager
    touchManagedPtr buffer
    whenJust manager touchManagedPtr
    return ()

data BufferSetUndoManagerMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsBuffer a, GtkSource.UndoManager.IsUndoManager b) => O.MethodInfo BufferSetUndoManagerMethodInfo a signature where
    overloadedMethod _ = bufferSetUndoManager

-- method Buffer::sort_lines
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkTextIter.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "end", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkTextIter.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "GtkSource", name = "SortFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GtkSourceSortFlags specifying how the sort should behave", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "column", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "sort considering the text starting at the given column", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_buffer_sort_lines" gtk_source_buffer_sort_lines :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    Ptr Gtk.TextIter.TextIter ->            -- start : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    Ptr Gtk.TextIter.TextIter ->            -- end : TInterface (Name {namespace = "Gtk", name = "TextIter"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "GtkSource", name = "SortFlags"})
    Int32 ->                                -- column : TBasicType TInt
    IO ()

{- |
Sort the lines of text between the specified iterators.

@since 3.18
-}
bufferSortLines ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@start@/: a 'GI.Gtk.Structs.TextIter.TextIter'. -}
    -> Gtk.TextIter.TextIter
    {- ^ /@end@/: a 'GI.Gtk.Structs.TextIter.TextIter'. -}
    -> [GtkSource.Flags.SortFlags]
    {- ^ /@flags@/: 'GI.GtkSource.Flags.SortFlags' specifying how the sort should behave -}
    -> Int32
    {- ^ /@column@/: sort considering the text starting at the given column -}
    -> m ()
bufferSortLines buffer start end flags column = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    start' <- unsafeManagedPtrGetPtr start
    end' <- unsafeManagedPtrGetPtr end
    let flags' = gflagsToWord flags
    gtk_source_buffer_sort_lines buffer' start' end' flags' column
    touchManagedPtr buffer
    touchManagedPtr start
    touchManagedPtr end
    return ()

data BufferSortLinesMethodInfo
instance (signature ~ (Gtk.TextIter.TextIter -> Gtk.TextIter.TextIter -> [GtkSource.Flags.SortFlags] -> Int32 -> m ()), MonadIO m, IsBuffer a) => O.MethodInfo BufferSortLinesMethodInfo a signature where
    overloadedMethod _ = bufferSortLines

-- method Buffer::undo
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GtkSource", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_buffer_undo" gtk_source_buffer_undo :: 
    Ptr Buffer ->                           -- buffer : TInterface (Name {namespace = "GtkSource", name = "Buffer"})
    IO ()

{- |
Undoes the last user action which modified the buffer.  Use
'GI.GtkSource.Objects.Buffer.bufferCanUndo' to check whether a call to this
function will have any effect.

This function emits the 'GI.GtkSource.Objects.Buffer.Buffer'::@/undo/@ signal.
-}
bufferUndo ::
    (B.CallStack.HasCallStack, MonadIO m, IsBuffer a) =>
    a
    {- ^ /@buffer@/: a 'GI.GtkSource.Objects.Buffer.Buffer'. -}
    -> m ()
bufferUndo buffer = liftIO $ do
    buffer' <- unsafeManagedPtrCastPtr buffer
    gtk_source_buffer_undo buffer'
    touchManagedPtr buffer
    return ()

data BufferUndoMethodInfo
instance (signature ~ (m ()), MonadIO m, IsBuffer a) => O.MethodInfo BufferUndoMethodInfo a signature where
    overloadedMethod _ = bufferUndo