{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc) Helper structure representing a rectangular area. -} #define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \ && !defined(__HADDOCK_VERSION__)) module GI.GstVideo.Structs.VideoRectangle ( -- * Exported types VideoRectangle(..) , newZeroVideoRectangle , noVideoRectangle , -- * Properties -- ** h #attr:h# {- | height of the rectangle -} getVideoRectangleH , setVideoRectangleH , #if ENABLE_OVERLOADING videoRectangle_h , #endif -- ** w #attr:w# {- | width of the rectangle -} getVideoRectangleW , setVideoRectangleW , #if ENABLE_OVERLOADING videoRectangle_w , #endif -- ** x #attr:x# {- | X coordinate of rectangle\'s top-left point -} getVideoRectangleX , setVideoRectangleX , #if ENABLE_OVERLOADING videoRectangle_x , #endif -- ** y #attr:y# {- | Y coordinate of rectangle\'s top-left point -} getVideoRectangleY , setVideoRectangleY , #if ENABLE_OVERLOADING videoRectangle_y , #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 -- | Memory-managed wrapper type. newtype VideoRectangle = VideoRectangle (ManagedPtr VideoRectangle) instance WrappedPtr VideoRectangle where wrappedPtrCalloc = callocBytes 16 wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 16 >=> wrapPtr VideoRectangle) wrappedPtrFree = Just ptr_to_g_free -- | Construct a `VideoRectangle` struct initialized to zero. newZeroVideoRectangle :: MonadIO m => m VideoRectangle newZeroVideoRectangle = liftIO $ wrappedPtrCalloc >>= wrapPtr VideoRectangle instance tag ~ 'AttrSet => Constructible VideoRectangle tag where new _ attrs = do o <- newZeroVideoRectangle GI.Attributes.set o attrs return o -- | A convenience alias for `Nothing` :: `Maybe` `VideoRectangle`. noVideoRectangle :: Maybe VideoRectangle noVideoRectangle = Nothing {- | Get the value of the “@x@” field. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' videoRectangle #x @ -} getVideoRectangleX :: MonadIO m => VideoRectangle -> m Int32 getVideoRectangleX s = liftIO $ withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 0) :: IO Int32 return val {- | Set the value of the “@x@” field. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.set' videoRectangle [ #x 'Data.GI.Base.Attributes.:=' value ] @ -} setVideoRectangleX :: MonadIO m => VideoRectangle -> Int32 -> m () setVideoRectangleX s val = liftIO $ withManagedPtr s $ \ptr -> do poke (ptr `plusPtr` 0) (val :: Int32) #if ENABLE_OVERLOADING data VideoRectangleXFieldInfo instance AttrInfo VideoRectangleXFieldInfo where type AttrAllowedOps VideoRectangleXFieldInfo = '[ 'AttrSet, 'AttrGet] type AttrSetTypeConstraint VideoRectangleXFieldInfo = (~) Int32 type AttrBaseTypeConstraint VideoRectangleXFieldInfo = (~) VideoRectangle type AttrGetType VideoRectangleXFieldInfo = Int32 type AttrLabel VideoRectangleXFieldInfo = "x" type AttrOrigin VideoRectangleXFieldInfo = VideoRectangle attrGet _ = getVideoRectangleX attrSet _ = setVideoRectangleX attrConstruct = undefined attrClear _ = undefined videoRectangle_x :: AttrLabelProxy "x" videoRectangle_x = AttrLabelProxy #endif {- | Get the value of the “@y@” field. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' videoRectangle #y @ -} getVideoRectangleY :: MonadIO m => VideoRectangle -> m Int32 getVideoRectangleY s = liftIO $ withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 4) :: IO Int32 return val {- | Set the value of the “@y@” field. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.set' videoRectangle [ #y 'Data.GI.Base.Attributes.:=' value ] @ -} setVideoRectangleY :: MonadIO m => VideoRectangle -> Int32 -> m () setVideoRectangleY s val = liftIO $ withManagedPtr s $ \ptr -> do poke (ptr `plusPtr` 4) (val :: Int32) #if ENABLE_OVERLOADING data VideoRectangleYFieldInfo instance AttrInfo VideoRectangleYFieldInfo where type AttrAllowedOps VideoRectangleYFieldInfo = '[ 'AttrSet, 'AttrGet] type AttrSetTypeConstraint VideoRectangleYFieldInfo = (~) Int32 type AttrBaseTypeConstraint VideoRectangleYFieldInfo = (~) VideoRectangle type AttrGetType VideoRectangleYFieldInfo = Int32 type AttrLabel VideoRectangleYFieldInfo = "y" type AttrOrigin VideoRectangleYFieldInfo = VideoRectangle attrGet _ = getVideoRectangleY attrSet _ = setVideoRectangleY attrConstruct = undefined attrClear _ = undefined videoRectangle_y :: AttrLabelProxy "y" videoRectangle_y = AttrLabelProxy #endif {- | Get the value of the “@w@” field. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' videoRectangle #w @ -} getVideoRectangleW :: MonadIO m => VideoRectangle -> m Int32 getVideoRectangleW s = liftIO $ withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 8) :: IO Int32 return val {- | Set the value of the “@w@” field. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.set' videoRectangle [ #w 'Data.GI.Base.Attributes.:=' value ] @ -} setVideoRectangleW :: MonadIO m => VideoRectangle -> Int32 -> m () setVideoRectangleW s val = liftIO $ withManagedPtr s $ \ptr -> do poke (ptr `plusPtr` 8) (val :: Int32) #if ENABLE_OVERLOADING data VideoRectangleWFieldInfo instance AttrInfo VideoRectangleWFieldInfo where type AttrAllowedOps VideoRectangleWFieldInfo = '[ 'AttrSet, 'AttrGet] type AttrSetTypeConstraint VideoRectangleWFieldInfo = (~) Int32 type AttrBaseTypeConstraint VideoRectangleWFieldInfo = (~) VideoRectangle type AttrGetType VideoRectangleWFieldInfo = Int32 type AttrLabel VideoRectangleWFieldInfo = "w" type AttrOrigin VideoRectangleWFieldInfo = VideoRectangle attrGet _ = getVideoRectangleW attrSet _ = setVideoRectangleW attrConstruct = undefined attrClear _ = undefined videoRectangle_w :: AttrLabelProxy "w" videoRectangle_w = AttrLabelProxy #endif {- | Get the value of the “@h@” field. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' videoRectangle #h @ -} getVideoRectangleH :: MonadIO m => VideoRectangle -> m Int32 getVideoRectangleH s = liftIO $ withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 12) :: IO Int32 return val {- | Set the value of the “@h@” field. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.set' videoRectangle [ #h 'Data.GI.Base.Attributes.:=' value ] @ -} setVideoRectangleH :: MonadIO m => VideoRectangle -> Int32 -> m () setVideoRectangleH s val = liftIO $ withManagedPtr s $ \ptr -> do poke (ptr `plusPtr` 12) (val :: Int32) #if ENABLE_OVERLOADING data VideoRectangleHFieldInfo instance AttrInfo VideoRectangleHFieldInfo where type AttrAllowedOps VideoRectangleHFieldInfo = '[ 'AttrSet, 'AttrGet] type AttrSetTypeConstraint VideoRectangleHFieldInfo = (~) Int32 type AttrBaseTypeConstraint VideoRectangleHFieldInfo = (~) VideoRectangle type AttrGetType VideoRectangleHFieldInfo = Int32 type AttrLabel VideoRectangleHFieldInfo = "h" type AttrOrigin VideoRectangleHFieldInfo = VideoRectangle attrGet _ = getVideoRectangleH attrSet _ = setVideoRectangleH attrConstruct = undefined attrClear _ = undefined videoRectangle_h :: AttrLabelProxy "h" videoRectangle_h = AttrLabelProxy #endif #if ENABLE_OVERLOADING instance O.HasAttributeList VideoRectangle type instance O.AttributeList VideoRectangle = VideoRectangleAttributeList type VideoRectangleAttributeList = ('[ '("x", VideoRectangleXFieldInfo), '("y", VideoRectangleYFieldInfo), '("w", VideoRectangleWFieldInfo), '("h", VideoRectangleHFieldInfo)] :: [(Symbol, *)]) #endif #if ENABLE_OVERLOADING type family ResolveVideoRectangleMethod (t :: Symbol) (o :: *) :: * where ResolveVideoRectangleMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveVideoRectangleMethod t VideoRectangle, O.MethodInfo info VideoRectangle p) => OL.IsLabel t (VideoRectangle -> 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