#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gtk.Structs.PageRange
(
PageRange(..) ,
newZeroPageRange ,
noPageRange ,
getPageRangeEnd ,
#if ENABLE_OVERLOADING
pageRange_end ,
#endif
setPageRangeEnd ,
getPageRangeStart ,
#if ENABLE_OVERLOADING
pageRange_start ,
#endif
setPageRangeStart ,
) 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
newtype PageRange = PageRange (ManagedPtr PageRange)
instance WrappedPtr PageRange where
wrappedPtrCalloc = callocBytes 8
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 8 >=> wrapPtr PageRange)
wrappedPtrFree = Just ptr_to_g_free
newZeroPageRange :: MonadIO m => m PageRange
newZeroPageRange = liftIO $ wrappedPtrCalloc >>= wrapPtr PageRange
instance tag ~ 'AttrSet => Constructible PageRange tag where
new _ attrs = do
o <- newZeroPageRange
GI.Attributes.set o attrs
return o
noPageRange :: Maybe PageRange
noPageRange = Nothing
getPageRangeStart :: MonadIO m => PageRange -> m Int32
getPageRangeStart s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO Int32
return val
setPageRangeStart :: MonadIO m => PageRange -> Int32 -> m ()
setPageRangeStart s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (val :: Int32)
#if ENABLE_OVERLOADING
data PageRangeStartFieldInfo
instance AttrInfo PageRangeStartFieldInfo where
type AttrAllowedOps PageRangeStartFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint PageRangeStartFieldInfo = (~) Int32
type AttrBaseTypeConstraint PageRangeStartFieldInfo = (~) PageRange
type AttrGetType PageRangeStartFieldInfo = Int32
type AttrLabel PageRangeStartFieldInfo = "start"
type AttrOrigin PageRangeStartFieldInfo = PageRange
attrGet _ = getPageRangeStart
attrSet _ = setPageRangeStart
attrConstruct = undefined
attrClear _ = undefined
pageRange_start :: AttrLabelProxy "start"
pageRange_start = AttrLabelProxy
#endif
getPageRangeEnd :: MonadIO m => PageRange -> m Int32
getPageRangeEnd s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 4) :: IO Int32
return val
setPageRangeEnd :: MonadIO m => PageRange -> Int32 -> m ()
setPageRangeEnd s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 4) (val :: Int32)
#if ENABLE_OVERLOADING
data PageRangeEndFieldInfo
instance AttrInfo PageRangeEndFieldInfo where
type AttrAllowedOps PageRangeEndFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint PageRangeEndFieldInfo = (~) Int32
type AttrBaseTypeConstraint PageRangeEndFieldInfo = (~) PageRange
type AttrGetType PageRangeEndFieldInfo = Int32
type AttrLabel PageRangeEndFieldInfo = "end"
type AttrOrigin PageRangeEndFieldInfo = PageRange
attrGet _ = getPageRangeEnd
attrSet _ = setPageRangeEnd
attrConstruct = undefined
attrClear _ = undefined
pageRange_end :: AttrLabelProxy "end"
pageRange_end = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList PageRange
type instance O.AttributeList PageRange = PageRangeAttributeList
type PageRangeAttributeList = ('[ '("start", PageRangeStartFieldInfo), '("end", PageRangeEndFieldInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
type family ResolvePageRangeMethod (t :: Symbol) (o :: *) :: * where
ResolvePageRangeMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolvePageRangeMethod t PageRange, O.MethodInfo info PageRange p) => OL.IsLabel t (PageRange -> 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