{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gtk.Structs.Border
(
Border(..) ,
newZeroBorder ,
noBorder ,
#if defined(ENABLE_OVERLOADING)
ResolveBorderMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
BorderCopyMethodInfo ,
#endif
borderCopy ,
#if defined(ENABLE_OVERLOADING)
BorderFreeMethodInfo ,
#endif
borderFree ,
borderNew ,
#if defined(ENABLE_OVERLOADING)
border_bottom ,
#endif
getBorderBottom ,
setBorderBottom ,
#if defined(ENABLE_OVERLOADING)
border_left ,
#endif
getBorderLeft ,
setBorderLeft ,
#if defined(ENABLE_OVERLOADING)
border_right ,
#endif
getBorderRight ,
setBorderRight ,
#if defined(ENABLE_OVERLOADING)
border_top ,
#endif
getBorderTop ,
setBorderTop ,
) 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.GI.Base.Signals as B.Signals
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 Border = Border (ManagedPtr Border)
deriving (Border -> Border -> Bool
(Border -> Border -> Bool)
-> (Border -> Border -> Bool) -> Eq Border
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Border -> Border -> Bool
$c/= :: Border -> Border -> Bool
== :: Border -> Border -> Bool
$c== :: Border -> Border -> Bool
Eq)
foreign import ccall "gtk_border_get_type" c_gtk_border_get_type ::
IO GType
instance BoxedObject Border where
boxedType :: Border -> IO GType
boxedType _ = IO GType
c_gtk_border_get_type
instance B.GValue.IsGValue Border where
toGValue :: Border -> IO GValue
toGValue o :: Border
o = do
GType
gtype <- IO GType
c_gtk_border_get_type
Border -> (Ptr Border -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Border
o (GType -> (GValue -> Ptr Border -> IO ()) -> Ptr Border -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Border -> IO ()
forall a. GValue -> Ptr a -> IO ()
B.GValue.set_boxed)
fromGValue :: GValue -> IO Border
fromGValue gv :: GValue
gv = do
Ptr Border
ptr <- GValue -> IO (Ptr Border)
forall b. GValue -> IO (Ptr b)
B.GValue.get_boxed GValue
gv :: IO (Ptr Border)
(ManagedPtr Border -> Border) -> Ptr Border -> IO Border
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr Border -> Border
Border Ptr Border
ptr
newZeroBorder :: MonadIO m => m Border
newZeroBorder :: m Border
newZeroBorder = IO Border -> m Border
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Border -> m Border) -> IO Border -> m Border
forall a b. (a -> b) -> a -> b
$ Int -> IO (Ptr Border)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 8 IO (Ptr Border) -> (Ptr Border -> IO Border) -> IO Border
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr Border -> Border) -> Ptr Border -> IO Border
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Border -> Border
Border
instance tag ~ 'AttrSet => Constructible Border tag where
new :: (ManagedPtr Border -> Border) -> [AttrOp Border tag] -> m Border
new _ attrs :: [AttrOp Border tag]
attrs = do
Border
o <- m Border
forall (m :: * -> *). MonadIO m => m Border
newZeroBorder
Border -> [AttrOp Border 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set Border
o [AttrOp Border tag]
[AttrOp Border 'AttrSet]
attrs
Border -> m Border
forall (m :: * -> *) a. Monad m => a -> m a
return Border
o
noBorder :: Maybe Border
noBorder :: Maybe Border
noBorder = Maybe Border
forall a. Maybe a
Nothing
getBorderLeft :: MonadIO m => Border -> m Int16
getBorderLeft :: Border -> m Int16
getBorderLeft s :: Border
s = IO Int16 -> m Int16
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int16 -> m Int16) -> IO Int16 -> m Int16
forall a b. (a -> b) -> a -> b
$ Border -> (Ptr Border -> IO Int16) -> IO Int16
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Border
s ((Ptr Border -> IO Int16) -> IO Int16)
-> (Ptr Border -> IO Int16) -> IO Int16
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Border
ptr -> do
Int16
val <- Ptr Int16 -> IO Int16
forall a. Storable a => Ptr a -> IO a
peek (Ptr Border
ptr Ptr Border -> Int -> Ptr Int16
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) :: IO Int16
Int16 -> IO Int16
forall (m :: * -> *) a. Monad m => a -> m a
return Int16
val
setBorderLeft :: MonadIO m => Border -> Int16 -> m ()
setBorderLeft :: Border -> Int16 -> m ()
setBorderLeft s :: Border
s val :: Int16
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ Border -> (Ptr Border -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Border
s ((Ptr Border -> IO ()) -> IO ()) -> (Ptr Border -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Border
ptr -> do
Ptr Int16 -> Int16 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Border
ptr Ptr Border -> Int -> Ptr Int16
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) (Int16
val :: Int16)
#if defined(ENABLE_OVERLOADING)
data BorderLeftFieldInfo
instance AttrInfo BorderLeftFieldInfo where
type AttrBaseTypeConstraint BorderLeftFieldInfo = (~) Border
type AttrAllowedOps BorderLeftFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint BorderLeftFieldInfo = (~) Int16
type AttrTransferTypeConstraint BorderLeftFieldInfo = (~)Int16
type AttrTransferType BorderLeftFieldInfo = Int16
type AttrGetType BorderLeftFieldInfo = Int16
type AttrLabel BorderLeftFieldInfo = "left"
type AttrOrigin BorderLeftFieldInfo = Border
attrGet = getBorderLeft
attrSet = setBorderLeft
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
border_left :: AttrLabelProxy "left"
border_left = AttrLabelProxy
#endif
getBorderRight :: MonadIO m => Border -> m Int16
getBorderRight :: Border -> m Int16
getBorderRight s :: Border
s = IO Int16 -> m Int16
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int16 -> m Int16) -> IO Int16 -> m Int16
forall a b. (a -> b) -> a -> b
$ Border -> (Ptr Border -> IO Int16) -> IO Int16
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Border
s ((Ptr Border -> IO Int16) -> IO Int16)
-> (Ptr Border -> IO Int16) -> IO Int16
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Border
ptr -> do
Int16
val <- Ptr Int16 -> IO Int16
forall a. Storable a => Ptr a -> IO a
peek (Ptr Border
ptr Ptr Border -> Int -> Ptr Int16
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 2) :: IO Int16
Int16 -> IO Int16
forall (m :: * -> *) a. Monad m => a -> m a
return Int16
val
setBorderRight :: MonadIO m => Border -> Int16 -> m ()
setBorderRight :: Border -> Int16 -> m ()
setBorderRight s :: Border
s val :: Int16
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ Border -> (Ptr Border -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Border
s ((Ptr Border -> IO ()) -> IO ()) -> (Ptr Border -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Border
ptr -> do
Ptr Int16 -> Int16 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Border
ptr Ptr Border -> Int -> Ptr Int16
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 2) (Int16
val :: Int16)
#if defined(ENABLE_OVERLOADING)
data BorderRightFieldInfo
instance AttrInfo BorderRightFieldInfo where
type AttrBaseTypeConstraint BorderRightFieldInfo = (~) Border
type AttrAllowedOps BorderRightFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint BorderRightFieldInfo = (~) Int16
type AttrTransferTypeConstraint BorderRightFieldInfo = (~)Int16
type AttrTransferType BorderRightFieldInfo = Int16
type AttrGetType BorderRightFieldInfo = Int16
type AttrLabel BorderRightFieldInfo = "right"
type AttrOrigin BorderRightFieldInfo = Border
attrGet = getBorderRight
attrSet = setBorderRight
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
border_right :: AttrLabelProxy "right"
border_right = AttrLabelProxy
#endif
getBorderTop :: MonadIO m => Border -> m Int16
getBorderTop :: Border -> m Int16
getBorderTop s :: Border
s = IO Int16 -> m Int16
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int16 -> m Int16) -> IO Int16 -> m Int16
forall a b. (a -> b) -> a -> b
$ Border -> (Ptr Border -> IO Int16) -> IO Int16
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Border
s ((Ptr Border -> IO Int16) -> IO Int16)
-> (Ptr Border -> IO Int16) -> IO Int16
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Border
ptr -> do
Int16
val <- Ptr Int16 -> IO Int16
forall a. Storable a => Ptr a -> IO a
peek (Ptr Border
ptr Ptr Border -> Int -> Ptr Int16
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4) :: IO Int16
Int16 -> IO Int16
forall (m :: * -> *) a. Monad m => a -> m a
return Int16
val
setBorderTop :: MonadIO m => Border -> Int16 -> m ()
setBorderTop :: Border -> Int16 -> m ()
setBorderTop s :: Border
s val :: Int16
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ Border -> (Ptr Border -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Border
s ((Ptr Border -> IO ()) -> IO ()) -> (Ptr Border -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Border
ptr -> do
Ptr Int16 -> Int16 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Border
ptr Ptr Border -> Int -> Ptr Int16
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4) (Int16
val :: Int16)
#if defined(ENABLE_OVERLOADING)
data BorderTopFieldInfo
instance AttrInfo BorderTopFieldInfo where
type AttrBaseTypeConstraint BorderTopFieldInfo = (~) Border
type AttrAllowedOps BorderTopFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint BorderTopFieldInfo = (~) Int16
type AttrTransferTypeConstraint BorderTopFieldInfo = (~)Int16
type AttrTransferType BorderTopFieldInfo = Int16
type AttrGetType BorderTopFieldInfo = Int16
type AttrLabel BorderTopFieldInfo = "top"
type AttrOrigin BorderTopFieldInfo = Border
attrGet = getBorderTop
attrSet = setBorderTop
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
border_top :: AttrLabelProxy "top"
border_top = AttrLabelProxy
#endif
getBorderBottom :: MonadIO m => Border -> m Int16
getBorderBottom :: Border -> m Int16
getBorderBottom s :: Border
s = IO Int16 -> m Int16
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int16 -> m Int16) -> IO Int16 -> m Int16
forall a b. (a -> b) -> a -> b
$ Border -> (Ptr Border -> IO Int16) -> IO Int16
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Border
s ((Ptr Border -> IO Int16) -> IO Int16)
-> (Ptr Border -> IO Int16) -> IO Int16
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Border
ptr -> do
Int16
val <- Ptr Int16 -> IO Int16
forall a. Storable a => Ptr a -> IO a
peek (Ptr Border
ptr Ptr Border -> Int -> Ptr Int16
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 6) :: IO Int16
Int16 -> IO Int16
forall (m :: * -> *) a. Monad m => a -> m a
return Int16
val
setBorderBottom :: MonadIO m => Border -> Int16 -> m ()
setBorderBottom :: Border -> Int16 -> m ()
setBorderBottom s :: Border
s val :: Int16
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ Border -> (Ptr Border -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Border
s ((Ptr Border -> IO ()) -> IO ()) -> (Ptr Border -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Border
ptr -> do
Ptr Int16 -> Int16 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Border
ptr Ptr Border -> Int -> Ptr Int16
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 6) (Int16
val :: Int16)
#if defined(ENABLE_OVERLOADING)
data BorderBottomFieldInfo
instance AttrInfo BorderBottomFieldInfo where
type AttrBaseTypeConstraint BorderBottomFieldInfo = (~) Border
type AttrAllowedOps BorderBottomFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint BorderBottomFieldInfo = (~) Int16
type AttrTransferTypeConstraint BorderBottomFieldInfo = (~)Int16
type AttrTransferType BorderBottomFieldInfo = Int16
type AttrGetType BorderBottomFieldInfo = Int16
type AttrLabel BorderBottomFieldInfo = "bottom"
type AttrOrigin BorderBottomFieldInfo = Border
attrGet = getBorderBottom
attrSet = setBorderBottom
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
border_bottom :: AttrLabelProxy "bottom"
border_bottom = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Border
type instance O.AttributeList Border = BorderAttributeList
type BorderAttributeList = ('[ '("left", BorderLeftFieldInfo), '("right", BorderRightFieldInfo), '("top", BorderTopFieldInfo), '("bottom", BorderBottomFieldInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "gtk_border_new" gtk_border_new ::
IO (Ptr Border)
borderNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Border
borderNew :: m Border
borderNew = IO Border -> m Border
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Border -> m Border) -> IO Border -> m Border
forall a b. (a -> b) -> a -> b
$ do
Ptr Border
result <- IO (Ptr Border)
gtk_border_new
Text -> Ptr Border -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "borderNew" Ptr Border
result
Border
result' <- ((ManagedPtr Border -> Border) -> Ptr Border -> IO Border
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Border -> Border
Border) Ptr Border
result
Border -> IO Border
forall (m :: * -> *) a. Monad m => a -> m a
return Border
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gtk_border_copy" gtk_border_copy ::
Ptr Border ->
IO (Ptr Border)
borderCopy ::
(B.CallStack.HasCallStack, MonadIO m) =>
Border
-> m Border
borderCopy :: Border -> m Border
borderCopy border_ :: Border
border_ = IO Border -> m Border
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Border -> m Border) -> IO Border -> m Border
forall a b. (a -> b) -> a -> b
$ do
Ptr Border
border_' <- Border -> IO (Ptr Border)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Border
border_
Ptr Border
result <- Ptr Border -> IO (Ptr Border)
gtk_border_copy Ptr Border
border_'
Text -> Ptr Border -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "borderCopy" Ptr Border
result
Border
result' <- ((ManagedPtr Border -> Border) -> Ptr Border -> IO Border
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Border -> Border
Border) Ptr Border
result
Border -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Border
border_
Border -> IO Border
forall (m :: * -> *) a. Monad m => a -> m a
return Border
result'
#if defined(ENABLE_OVERLOADING)
data BorderCopyMethodInfo
instance (signature ~ (m Border), MonadIO m) => O.MethodInfo BorderCopyMethodInfo Border signature where
overloadedMethod = borderCopy
#endif
foreign import ccall "gtk_border_free" gtk_border_free ::
Ptr Border ->
IO ()
borderFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
Border
-> m ()
borderFree :: Border -> m ()
borderFree border_ :: Border
border_ = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Border
border_' <- Border -> IO (Ptr Border)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Border
border_
Ptr Border -> IO ()
gtk_border_free Ptr Border
border_'
Border -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Border
border_
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data BorderFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo BorderFreeMethodInfo Border signature where
overloadedMethod = borderFree
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveBorderMethod (t :: Symbol) (o :: *) :: * where
ResolveBorderMethod "copy" o = BorderCopyMethodInfo
ResolveBorderMethod "free" o = BorderFreeMethodInfo
ResolveBorderMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveBorderMethod t Border, O.MethodInfo info Border p) => OL.IsLabel t (Border -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif