gi-gtksource-3.0.18: GI/GtkSource/Objects/Region.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)
/No description available in the introspection data./
-}
#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.GtkSource.Objects.Region
(
-- * Exported types
Region(..) ,
IsRegion ,
toRegion ,
noRegion ,
-- * Methods
-- ** addRegion #method:addRegion#
#if ENABLE_OVERLOADING
RegionAddRegionMethodInfo ,
#endif
regionAddRegion ,
-- ** addSubregion #method:addSubregion#
#if ENABLE_OVERLOADING
RegionAddSubregionMethodInfo ,
#endif
regionAddSubregion ,
-- ** getBounds #method:getBounds#
#if ENABLE_OVERLOADING
RegionGetBoundsMethodInfo ,
#endif
regionGetBounds ,
-- ** getBuffer #method:getBuffer#
#if ENABLE_OVERLOADING
RegionGetBufferMethodInfo ,
#endif
regionGetBuffer ,
-- ** getStartRegionIter #method:getStartRegionIter#
#if ENABLE_OVERLOADING
RegionGetStartRegionIterMethodInfo ,
#endif
regionGetStartRegionIter ,
-- ** intersectRegion #method:intersectRegion#
#if ENABLE_OVERLOADING
RegionIntersectRegionMethodInfo ,
#endif
regionIntersectRegion ,
-- ** intersectSubregion #method:intersectSubregion#
#if ENABLE_OVERLOADING
RegionIntersectSubregionMethodInfo ,
#endif
regionIntersectSubregion ,
-- ** isEmpty #method:isEmpty#
#if ENABLE_OVERLOADING
RegionIsEmptyMethodInfo ,
#endif
regionIsEmpty ,
-- ** new #method:new#
regionNew ,
-- ** subtractRegion #method:subtractRegion#
#if ENABLE_OVERLOADING
RegionSubtractRegionMethodInfo ,
#endif
regionSubtractRegion ,
-- ** subtractSubregion #method:subtractSubregion#
#if ENABLE_OVERLOADING
RegionSubtractSubregionMethodInfo ,
#endif
regionSubtractSubregion ,
-- ** toString #method:toString#
#if ENABLE_OVERLOADING
RegionToStringMethodInfo ,
#endif
regionToString ,
-- * Properties
-- ** buffer #attr:buffer#
{- | The 'GI.Gtk.Objects.TextBuffer.TextBuffer'. The 'GI.GtkSource.Objects.Region.Region' has a weak reference to the
buffer.
/Since: 3.22/
-}
#if ENABLE_OVERLOADING
RegionBufferPropertyInfo ,
#endif
constructRegionBuffer ,
getRegionBuffer ,
#if ENABLE_OVERLOADING
regionBuffer ,
#endif
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gtk.Objects.TextBuffer as Gtk.TextBuffer
import qualified GI.Gtk.Structs.TextIter as Gtk.TextIter
import {-# SOURCE #-} qualified GI.GtkSource.Structs.RegionIter as GtkSource.RegionIter
-- | Memory-managed wrapper type.
newtype Region = Region (ManagedPtr Region)
foreign import ccall "gtk_source_region_get_type"
c_gtk_source_region_get_type :: IO GType
instance GObject Region where
gobjectType = c_gtk_source_region_get_type
-- | Type class for types which can be safely cast to `Region`, for instance with `toRegion`.
class (GObject o, O.IsDescendantOf Region o) => IsRegion o
instance (GObject o, O.IsDescendantOf Region o) => IsRegion o
instance O.HasParentTypes Region
type instance O.ParentTypes Region = '[GObject.Object.Object]
-- | Cast to `Region`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toRegion :: (MonadIO m, IsRegion o) => o -> m Region
toRegion = liftIO . unsafeCastTo Region
-- | A convenience alias for `Nothing` :: `Maybe` `Region`.
noRegion :: Maybe Region
noRegion = Nothing
#if ENABLE_OVERLOADING
type family ResolveRegionMethod (t :: Symbol) (o :: *) :: * where
ResolveRegionMethod "addRegion" o = RegionAddRegionMethodInfo
ResolveRegionMethod "addSubregion" o = RegionAddSubregionMethodInfo
ResolveRegionMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveRegionMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveRegionMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveRegionMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveRegionMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveRegionMethod "intersectRegion" o = RegionIntersectRegionMethodInfo
ResolveRegionMethod "intersectSubregion" o = RegionIntersectSubregionMethodInfo
ResolveRegionMethod "isEmpty" o = RegionIsEmptyMethodInfo
ResolveRegionMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveRegionMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveRegionMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveRegionMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveRegionMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveRegionMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveRegionMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveRegionMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveRegionMethod "subtractRegion" o = RegionSubtractRegionMethodInfo
ResolveRegionMethod "subtractSubregion" o = RegionSubtractSubregionMethodInfo
ResolveRegionMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveRegionMethod "toString" o = RegionToStringMethodInfo
ResolveRegionMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveRegionMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveRegionMethod "getBounds" o = RegionGetBoundsMethodInfo
ResolveRegionMethod "getBuffer" o = RegionGetBufferMethodInfo
ResolveRegionMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveRegionMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveRegionMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveRegionMethod "getStartRegionIter" o = RegionGetStartRegionIterMethodInfo
ResolveRegionMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveRegionMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveRegionMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveRegionMethod t Region, O.MethodInfo info Region p) => OL.IsLabel t (Region -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
-- VVV Prop "buffer"
-- Type: TInterface (Name {namespace = "Gtk", name = "TextBuffer"})
-- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
-- Nullable: (Just True,Nothing)
{- |
Get the value of the “@buffer@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' region #buffer
@
-}
getRegionBuffer :: (MonadIO m, IsRegion o) => o -> m (Maybe Gtk.TextBuffer.TextBuffer)
getRegionBuffer obj = liftIO $ B.Properties.getObjectPropertyObject obj "buffer" Gtk.TextBuffer.TextBuffer
{- |
Construct a `GValueConstruct` with valid value for the “@buffer@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructRegionBuffer :: (IsRegion o, Gtk.TextBuffer.IsTextBuffer a) => a -> IO (GValueConstruct o)
constructRegionBuffer val = B.Properties.constructObjectPropertyObject "buffer" (Just val)
#if ENABLE_OVERLOADING
data RegionBufferPropertyInfo
instance AttrInfo RegionBufferPropertyInfo where
type AttrAllowedOps RegionBufferPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint RegionBufferPropertyInfo = Gtk.TextBuffer.IsTextBuffer
type AttrBaseTypeConstraint RegionBufferPropertyInfo = IsRegion
type AttrGetType RegionBufferPropertyInfo = (Maybe Gtk.TextBuffer.TextBuffer)
type AttrLabel RegionBufferPropertyInfo = "buffer"
type AttrOrigin RegionBufferPropertyInfo = Region
attrGet _ = getRegionBuffer
attrSet _ = undefined
attrConstruct _ = constructRegionBuffer
attrClear _ = undefined
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList Region
type instance O.AttributeList Region = RegionAttributeList
type RegionAttributeList = ('[ '("buffer", RegionBufferPropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
regionBuffer :: AttrLabelProxy "buffer"
regionBuffer = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList Region = RegionSignalList
type RegionSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
-- method Region::new
-- method type : Constructor
-- Args : [Arg {argCName = "buffer", argType = TInterface (Name {namespace = "Gtk", name = "TextBuffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkTextBuffer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "Region"}))
-- throws : False
-- Skip return : False
foreign import ccall "gtk_source_region_new" gtk_source_region_new ::
Ptr Gtk.TextBuffer.TextBuffer -> -- buffer : TInterface (Name {namespace = "Gtk", name = "TextBuffer"})
IO (Ptr Region)
{- |
/No description available in the introspection data./
/Since: 3.22/
-}
regionNew ::
(B.CallStack.HasCallStack, MonadIO m, Gtk.TextBuffer.IsTextBuffer a) =>
a
{- ^ /@buffer@/: a 'GI.Gtk.Objects.TextBuffer.TextBuffer'. -}
-> m Region
{- ^ __Returns:__ a new 'GI.GtkSource.Objects.Region.Region' object for /@buffer@/. -}
regionNew buffer = liftIO $ do
buffer' <- unsafeManagedPtrCastPtr buffer
result <- gtk_source_region_new buffer'
checkUnexpectedReturnNULL "regionNew" result
result' <- (wrapObject Region) result
touchManagedPtr buffer
return result'
#if ENABLE_OVERLOADING
#endif
-- method Region::add_region
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "region", argType = TInterface (Name {namespace = "GtkSource", name = "Region"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceRegion.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "region_to_add", argType = TInterface (Name {namespace = "GtkSource", name = "Region"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the #GtkSourceRegion to add to @region, 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_region_add_region" gtk_source_region_add_region ::
Ptr Region -> -- region : TInterface (Name {namespace = "GtkSource", name = "Region"})
Ptr Region -> -- region_to_add : TInterface (Name {namespace = "GtkSource", name = "Region"})
IO ()
{- |
Adds /@regionToAdd@/ to /@region@/. /@regionToAdd@/ is not modified.
/Since: 3.22/
-}
regionAddRegion ::
(B.CallStack.HasCallStack, MonadIO m, IsRegion a, IsRegion b) =>
a
{- ^ /@region@/: a 'GI.GtkSource.Objects.Region.Region'. -}
-> Maybe (b)
{- ^ /@regionToAdd@/: the 'GI.GtkSource.Objects.Region.Region' to add to /@region@/, or 'Nothing'. -}
-> m ()
regionAddRegion region regionToAdd = liftIO $ do
region' <- unsafeManagedPtrCastPtr region
maybeRegionToAdd <- case regionToAdd of
Nothing -> return nullPtr
Just jRegionToAdd -> do
jRegionToAdd' <- unsafeManagedPtrCastPtr jRegionToAdd
return jRegionToAdd'
gtk_source_region_add_region region' maybeRegionToAdd
touchManagedPtr region
whenJust regionToAdd touchManagedPtr
return ()
#if ENABLE_OVERLOADING
data RegionAddRegionMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsRegion a, IsRegion b) => O.MethodInfo RegionAddRegionMethodInfo a signature where
overloadedMethod _ = regionAddRegion
#endif
-- method Region::add_subregion
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "region", argType = TInterface (Name {namespace = "GtkSource", name = "Region"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceRegion.", 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 "the start of the subregion.", 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 "the end of the subregion.", 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_region_add_subregion" gtk_source_region_add_subregion ::
Ptr Region -> -- region : TInterface (Name {namespace = "GtkSource", name = "Region"})
Ptr Gtk.TextIter.TextIter -> -- _start : TInterface (Name {namespace = "Gtk", name = "TextIter"})
Ptr Gtk.TextIter.TextIter -> -- _end : TInterface (Name {namespace = "Gtk", name = "TextIter"})
IO ()
{- |
Adds the subregion delimited by /@start_@/ and /@end_@/ to /@region@/.
/Since: 3.22/
-}
regionAddSubregion ::
(B.CallStack.HasCallStack, MonadIO m, IsRegion a) =>
a
{- ^ /@region@/: a 'GI.GtkSource.Objects.Region.Region'. -}
-> Gtk.TextIter.TextIter
{- ^ /@start_@/: the start of the subregion. -}
-> Gtk.TextIter.TextIter
{- ^ /@end_@/: the end of the subregion. -}
-> m ()
regionAddSubregion region _start _end = liftIO $ do
region' <- unsafeManagedPtrCastPtr region
_start' <- unsafeManagedPtrGetPtr _start
_end' <- unsafeManagedPtrGetPtr _end
gtk_source_region_add_subregion region' _start' _end'
touchManagedPtr region
touchManagedPtr _start
touchManagedPtr _end
return ()
#if ENABLE_OVERLOADING
data RegionAddSubregionMethodInfo
instance (signature ~ (Gtk.TextIter.TextIter -> Gtk.TextIter.TextIter -> m ()), MonadIO m, IsRegion a) => O.MethodInfo RegionAddSubregionMethodInfo a signature where
overloadedMethod _ = regionAddSubregion
#endif
-- method Region::get_bounds
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "region", argType = TInterface (Name {namespace = "GtkSource", name = "Region"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceRegion.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "iterator to initialize with the start of @region,\n or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "end", argType = TInterface (Name {namespace = "Gtk", name = "TextIter"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "iterator to initialize with the end of @region,\n or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False
foreign import ccall "gtk_source_region_get_bounds" gtk_source_region_get_bounds ::
Ptr Region -> -- region : TInterface (Name {namespace = "GtkSource", name = "Region"})
Ptr Gtk.TextIter.TextIter -> -- start : TInterface (Name {namespace = "Gtk", name = "TextIter"})
Ptr Gtk.TextIter.TextIter -> -- end : TInterface (Name {namespace = "Gtk", name = "TextIter"})
IO CInt
{- |
Gets the /@start@/ and /@end@/ bounds of the /@region@/.
/Since: 3.22/
-}
regionGetBounds ::
(B.CallStack.HasCallStack, MonadIO m, IsRegion a) =>
a
{- ^ /@region@/: a 'GI.GtkSource.Objects.Region.Region'. -}
-> m ((Bool, Gtk.TextIter.TextIter, Gtk.TextIter.TextIter))
{- ^ __Returns:__ 'True' if /@start@/ and /@end@/ have been set successfully (if non-'Nothing'),
or 'False' if the /@region@/ is empty. -}
regionGetBounds region = liftIO $ do
region' <- unsafeManagedPtrCastPtr region
start <- callocBoxedBytes 80 :: IO (Ptr Gtk.TextIter.TextIter)
end <- callocBoxedBytes 80 :: IO (Ptr Gtk.TextIter.TextIter)
result <- gtk_source_region_get_bounds region' start end
let result' = (/= 0) result
start' <- (wrapBoxed Gtk.TextIter.TextIter) start
end' <- (wrapBoxed Gtk.TextIter.TextIter) end
touchManagedPtr region
return (result', start', end')
#if ENABLE_OVERLOADING
data RegionGetBoundsMethodInfo
instance (signature ~ (m ((Bool, Gtk.TextIter.TextIter, Gtk.TextIter.TextIter))), MonadIO m, IsRegion a) => O.MethodInfo RegionGetBoundsMethodInfo a signature where
overloadedMethod _ = regionGetBounds
#endif
-- method Region::get_buffer
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "region", argType = TInterface (Name {namespace = "GtkSource", name = "Region"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceRegion.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gtk", name = "TextBuffer"}))
-- throws : False
-- Skip return : False
foreign import ccall "gtk_source_region_get_buffer" gtk_source_region_get_buffer ::
Ptr Region -> -- region : TInterface (Name {namespace = "GtkSource", name = "Region"})
IO (Ptr Gtk.TextBuffer.TextBuffer)
{- |
/No description available in the introspection data./
/Since: 3.22/
-}
regionGetBuffer ::
(B.CallStack.HasCallStack, MonadIO m, IsRegion a) =>
a
{- ^ /@region@/: a 'GI.GtkSource.Objects.Region.Region'. -}
-> m (Maybe Gtk.TextBuffer.TextBuffer)
{- ^ __Returns:__ the 'GI.Gtk.Objects.TextBuffer.TextBuffer'. -}
regionGetBuffer region = liftIO $ do
region' <- unsafeManagedPtrCastPtr region
result <- gtk_source_region_get_buffer region'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (newObject Gtk.TextBuffer.TextBuffer) result'
return result''
touchManagedPtr region
return maybeResult
#if ENABLE_OVERLOADING
data RegionGetBufferMethodInfo
instance (signature ~ (m (Maybe Gtk.TextBuffer.TextBuffer)), MonadIO m, IsRegion a) => O.MethodInfo RegionGetBufferMethodInfo a signature where
overloadedMethod _ = regionGetBuffer
#endif
-- method Region::get_start_region_iter
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "region", argType = TInterface (Name {namespace = "GtkSource", name = "Region"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceRegion.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "iter", argType = TInterface (Name {namespace = "GtkSource", name = "RegionIter"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "iterator to initialize to the first subregion.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "gtk_source_region_get_start_region_iter" gtk_source_region_get_start_region_iter ::
Ptr Region -> -- region : TInterface (Name {namespace = "GtkSource", name = "Region"})
Ptr GtkSource.RegionIter.RegionIter -> -- iter : TInterface (Name {namespace = "GtkSource", name = "RegionIter"})
IO ()
{- |
Initializes a 'GI.GtkSource.Structs.RegionIter.RegionIter' to the first subregion of /@region@/. If
/@region@/ is empty, /@iter@/ will be initialized to the end iterator.
/Since: 3.22/
-}
regionGetStartRegionIter ::
(B.CallStack.HasCallStack, MonadIO m, IsRegion a) =>
a
{- ^ /@region@/: a 'GI.GtkSource.Objects.Region.Region'. -}
-> m (GtkSource.RegionIter.RegionIter)
regionGetStartRegionIter region = liftIO $ do
region' <- unsafeManagedPtrCastPtr region
iter <- callocBytes 24 :: IO (Ptr GtkSource.RegionIter.RegionIter)
gtk_source_region_get_start_region_iter region' iter
iter' <- (wrapPtr GtkSource.RegionIter.RegionIter) iter
touchManagedPtr region
return iter'
#if ENABLE_OVERLOADING
data RegionGetStartRegionIterMethodInfo
instance (signature ~ (m (GtkSource.RegionIter.RegionIter)), MonadIO m, IsRegion a) => O.MethodInfo RegionGetStartRegionIterMethodInfo a signature where
overloadedMethod _ = regionGetStartRegionIter
#endif
-- method Region::intersect_region
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "region1", argType = TInterface (Name {namespace = "GtkSource", name = "Region"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceRegion, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "region2", argType = TInterface (Name {namespace = "GtkSource", name = "Region"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GtkSourceRegion, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "Region"}))
-- throws : False
-- Skip return : False
foreign import ccall "gtk_source_region_intersect_region" gtk_source_region_intersect_region ::
Ptr Region -> -- region1 : TInterface (Name {namespace = "GtkSource", name = "Region"})
Ptr Region -> -- region2 : TInterface (Name {namespace = "GtkSource", name = "Region"})
IO (Ptr Region)
{- |
Returns the intersection between /@region1@/ and /@region2@/. /@region1@/ and
/@region2@/ are not modified.
/Since: 3.22/
-}
regionIntersectRegion ::
(B.CallStack.HasCallStack, MonadIO m, IsRegion a, IsRegion b) =>
a
{- ^ /@region1@/: a 'GI.GtkSource.Objects.Region.Region', or 'Nothing'. -}
-> Maybe (b)
{- ^ /@region2@/: a 'GI.GtkSource.Objects.Region.Region', or 'Nothing'. -}
-> m (Maybe Region)
{- ^ __Returns:__ the intersection as a 'GI.GtkSource.Objects.Region.Region'
object. -}
regionIntersectRegion region1 region2 = liftIO $ do
region1' <- unsafeManagedPtrCastPtr region1
maybeRegion2 <- case region2 of
Nothing -> return nullPtr
Just jRegion2 -> do
jRegion2' <- unsafeManagedPtrCastPtr jRegion2
return jRegion2'
result <- gtk_source_region_intersect_region region1' maybeRegion2
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapObject Region) result'
return result''
touchManagedPtr region1
whenJust region2 touchManagedPtr
return maybeResult
#if ENABLE_OVERLOADING
data RegionIntersectRegionMethodInfo
instance (signature ~ (Maybe (b) -> m (Maybe Region)), MonadIO m, IsRegion a, IsRegion b) => O.MethodInfo RegionIntersectRegionMethodInfo a signature where
overloadedMethod _ = regionIntersectRegion
#endif
-- method Region::intersect_subregion
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "region", argType = TInterface (Name {namespace = "GtkSource", name = "Region"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceRegion.", 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 "the start of the subregion.", 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 "the end of the subregion.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "Region"}))
-- throws : False
-- Skip return : False
foreign import ccall "gtk_source_region_intersect_subregion" gtk_source_region_intersect_subregion ::
Ptr Region -> -- region : TInterface (Name {namespace = "GtkSource", name = "Region"})
Ptr Gtk.TextIter.TextIter -> -- _start : TInterface (Name {namespace = "Gtk", name = "TextIter"})
Ptr Gtk.TextIter.TextIter -> -- _end : TInterface (Name {namespace = "Gtk", name = "TextIter"})
IO (Ptr Region)
{- |
Returns the intersection between /@region@/ and the subregion delimited by
/@start_@/ and /@end_@/. /@region@/ is not modified.
/Since: 3.22/
-}
regionIntersectSubregion ::
(B.CallStack.HasCallStack, MonadIO m, IsRegion a) =>
a
{- ^ /@region@/: a 'GI.GtkSource.Objects.Region.Region'. -}
-> Gtk.TextIter.TextIter
{- ^ /@start_@/: the start of the subregion. -}
-> Gtk.TextIter.TextIter
{- ^ /@end_@/: the end of the subregion. -}
-> m (Maybe Region)
{- ^ __Returns:__ the intersection as a new
'GI.GtkSource.Objects.Region.Region'. -}
regionIntersectSubregion region _start _end = liftIO $ do
region' <- unsafeManagedPtrCastPtr region
_start' <- unsafeManagedPtrGetPtr _start
_end' <- unsafeManagedPtrGetPtr _end
result <- gtk_source_region_intersect_subregion region' _start' _end'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapObject Region) result'
return result''
touchManagedPtr region
touchManagedPtr _start
touchManagedPtr _end
return maybeResult
#if ENABLE_OVERLOADING
data RegionIntersectSubregionMethodInfo
instance (signature ~ (Gtk.TextIter.TextIter -> Gtk.TextIter.TextIter -> m (Maybe Region)), MonadIO m, IsRegion a) => O.MethodInfo RegionIntersectSubregionMethodInfo a signature where
overloadedMethod _ = regionIntersectSubregion
#endif
-- method Region::is_empty
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "region", argType = TInterface (Name {namespace = "GtkSource", name = "Region"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceRegion, 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_region_is_empty" gtk_source_region_is_empty ::
Ptr Region -> -- region : TInterface (Name {namespace = "GtkSource", name = "Region"})
IO CInt
{- |
Returns whether the /@region@/ is empty. A 'Nothing' /@region@/ is considered empty.
/Since: 3.22/
-}
regionIsEmpty ::
(B.CallStack.HasCallStack, MonadIO m, IsRegion a) =>
a
{- ^ /@region@/: a 'GI.GtkSource.Objects.Region.Region', or 'Nothing'. -}
-> m Bool
{- ^ __Returns:__ whether the /@region@/ is empty. -}
regionIsEmpty region = liftIO $ do
region' <- unsafeManagedPtrCastPtr region
result <- gtk_source_region_is_empty region'
let result' = (/= 0) result
touchManagedPtr region
return result'
#if ENABLE_OVERLOADING
data RegionIsEmptyMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsRegion a) => O.MethodInfo RegionIsEmptyMethodInfo a signature where
overloadedMethod _ = regionIsEmpty
#endif
-- method Region::subtract_region
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "region", argType = TInterface (Name {namespace = "GtkSource", name = "Region"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceRegion.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "region_to_subtract", argType = TInterface (Name {namespace = "GtkSource", name = "Region"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the #GtkSourceRegion to subtract from\n @region, 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_region_subtract_region" gtk_source_region_subtract_region ::
Ptr Region -> -- region : TInterface (Name {namespace = "GtkSource", name = "Region"})
Ptr Region -> -- region_to_subtract : TInterface (Name {namespace = "GtkSource", name = "Region"})
IO ()
{- |
Subtracts /@regionToSubtract@/ from /@region@/. /@regionToSubtract@/ is not
modified.
/Since: 3.22/
-}
regionSubtractRegion ::
(B.CallStack.HasCallStack, MonadIO m, IsRegion a, IsRegion b) =>
a
{- ^ /@region@/: a 'GI.GtkSource.Objects.Region.Region'. -}
-> Maybe (b)
{- ^ /@regionToSubtract@/: the 'GI.GtkSource.Objects.Region.Region' to subtract from
/@region@/, or 'Nothing'. -}
-> m ()
regionSubtractRegion region regionToSubtract = liftIO $ do
region' <- unsafeManagedPtrCastPtr region
maybeRegionToSubtract <- case regionToSubtract of
Nothing -> return nullPtr
Just jRegionToSubtract -> do
jRegionToSubtract' <- unsafeManagedPtrCastPtr jRegionToSubtract
return jRegionToSubtract'
gtk_source_region_subtract_region region' maybeRegionToSubtract
touchManagedPtr region
whenJust regionToSubtract touchManagedPtr
return ()
#if ENABLE_OVERLOADING
data RegionSubtractRegionMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsRegion a, IsRegion b) => O.MethodInfo RegionSubtractRegionMethodInfo a signature where
overloadedMethod _ = regionSubtractRegion
#endif
-- method Region::subtract_subregion
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "region", argType = TInterface (Name {namespace = "GtkSource", name = "Region"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceRegion.", 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 "the start of the subregion.", 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 "the end of the subregion.", 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_region_subtract_subregion" gtk_source_region_subtract_subregion ::
Ptr Region -> -- region : TInterface (Name {namespace = "GtkSource", name = "Region"})
Ptr Gtk.TextIter.TextIter -> -- _start : TInterface (Name {namespace = "Gtk", name = "TextIter"})
Ptr Gtk.TextIter.TextIter -> -- _end : TInterface (Name {namespace = "Gtk", name = "TextIter"})
IO ()
{- |
Subtracts the subregion delimited by /@start_@/ and /@end_@/ from /@region@/.
/Since: 3.22/
-}
regionSubtractSubregion ::
(B.CallStack.HasCallStack, MonadIO m, IsRegion a) =>
a
{- ^ /@region@/: a 'GI.GtkSource.Objects.Region.Region'. -}
-> Gtk.TextIter.TextIter
{- ^ /@start_@/: the start of the subregion. -}
-> Gtk.TextIter.TextIter
{- ^ /@end_@/: the end of the subregion. -}
-> m ()
regionSubtractSubregion region _start _end = liftIO $ do
region' <- unsafeManagedPtrCastPtr region
_start' <- unsafeManagedPtrGetPtr _start
_end' <- unsafeManagedPtrGetPtr _end
gtk_source_region_subtract_subregion region' _start' _end'
touchManagedPtr region
touchManagedPtr _start
touchManagedPtr _end
return ()
#if ENABLE_OVERLOADING
data RegionSubtractSubregionMethodInfo
instance (signature ~ (Gtk.TextIter.TextIter -> Gtk.TextIter.TextIter -> m ()), MonadIO m, IsRegion a) => O.MethodInfo RegionSubtractSubregionMethodInfo a signature where
overloadedMethod _ = regionSubtractSubregion
#endif
-- method Region::to_string
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "region", argType = TInterface (Name {namespace = "GtkSource", name = "Region"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceRegion.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False
foreign import ccall "gtk_source_region_to_string" gtk_source_region_to_string ::
Ptr Region -> -- region : TInterface (Name {namespace = "GtkSource", name = "Region"})
IO CString
{- |
Gets a string represention of /@region@/, for debugging purposes.
The returned string contains the character offsets of the subregions. It
doesn\'t include a newline character at the end of the string.
/Since: 3.22/
-}
regionToString ::
(B.CallStack.HasCallStack, MonadIO m, IsRegion a) =>
a
{- ^ /@region@/: a 'GI.GtkSource.Objects.Region.Region'. -}
-> m (Maybe T.Text)
{- ^ __Returns:__ a string represention of /@region@/. Free
with 'GI.GLib.Functions.free' when no longer needed. -}
regionToString region = liftIO $ do
region' <- unsafeManagedPtrCastPtr region
result <- gtk_source_region_to_string region'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- cstringToText result'
freeMem result'
return result''
touchManagedPtr region
return maybeResult
#if ENABLE_OVERLOADING
data RegionToStringMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsRegion a) => O.MethodInfo RegionToStringMethodInfo a signature where
overloadedMethod _ = regionToString
#endif