{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gdk.Structs.ToplevelSize
(
ToplevelSize(..) ,
#if defined(ENABLE_OVERLOADING)
ResolveToplevelSizeMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
ToplevelSizeGetBoundsMethodInfo ,
#endif
toplevelSizeGetBounds ,
#if defined(ENABLE_OVERLOADING)
ToplevelSizeSetMinSizeMethodInfo ,
#endif
toplevelSizeSetMinSize ,
#if defined(ENABLE_OVERLOADING)
ToplevelSizeSetShadowWidthMethodInfo ,
#endif
toplevelSizeSetShadowWidth ,
#if defined(ENABLE_OVERLOADING)
ToplevelSizeSetSizeMethodInfo ,
#endif
toplevelSizeSetSize ,
) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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 Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
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 GHC.Records as R
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT
#if MIN_VERSION_base(4,18,0)
#else
#endif
newtype ToplevelSize = ToplevelSize (SP.ManagedPtr ToplevelSize)
deriving (ToplevelSize -> ToplevelSize -> Bool
(ToplevelSize -> ToplevelSize -> Bool)
-> (ToplevelSize -> ToplevelSize -> Bool) -> Eq ToplevelSize
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ToplevelSize -> ToplevelSize -> Bool
== :: ToplevelSize -> ToplevelSize -> Bool
$c/= :: ToplevelSize -> ToplevelSize -> Bool
/= :: ToplevelSize -> ToplevelSize -> Bool
Eq)
instance SP.ManagedPtrNewtype ToplevelSize where
toManagedPtr :: ToplevelSize -> ManagedPtr ToplevelSize
toManagedPtr (ToplevelSize ManagedPtr ToplevelSize
p) = ManagedPtr ToplevelSize
p
instance BoxedPtr ToplevelSize where
boxedPtrCopy :: ToplevelSize -> IO ToplevelSize
boxedPtrCopy = ToplevelSize -> IO ToplevelSize
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return
boxedPtrFree :: ToplevelSize -> IO ()
boxedPtrFree = \ToplevelSize
_x -> () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList ToplevelSize
type instance O.AttributeList ToplevelSize = ToplevelSizeAttributeList
type ToplevelSizeAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "gdk_toplevel_size_get_bounds" gdk_toplevel_size_get_bounds ::
Ptr ToplevelSize ->
Ptr Int32 ->
Ptr Int32 ->
IO ()
toplevelSizeGetBounds ::
(B.CallStack.HasCallStack, MonadIO m) =>
ToplevelSize
-> m ((Int32, Int32))
toplevelSizeGetBounds :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ToplevelSize -> m (Int32, Int32)
toplevelSizeGetBounds ToplevelSize
size = IO (Int32, Int32) -> m (Int32, Int32)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Int32, Int32) -> m (Int32, Int32))
-> IO (Int32, Int32) -> m (Int32, Int32)
forall a b. (a -> b) -> a -> b
$ do
size' <- ToplevelSize -> IO (Ptr ToplevelSize)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ToplevelSize
size
boundsWidth <- allocMem :: IO (Ptr Int32)
boundsHeight <- allocMem :: IO (Ptr Int32)
gdk_toplevel_size_get_bounds size' boundsWidth boundsHeight
boundsWidth' <- peek boundsWidth
boundsHeight' <- peek boundsHeight
touchManagedPtr size
freeMem boundsWidth
freeMem boundsHeight
return (boundsWidth', boundsHeight')
#if defined(ENABLE_OVERLOADING)
data ToplevelSizeGetBoundsMethodInfo
instance (signature ~ (m ((Int32, Int32))), MonadIO m) => O.OverloadedMethod ToplevelSizeGetBoundsMethodInfo ToplevelSize signature where
overloadedMethod = toplevelSizeGetBounds
instance O.OverloadedMethodInfo ToplevelSizeGetBoundsMethodInfo ToplevelSize where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gdk.Structs.ToplevelSize.toplevelSizeGetBounds",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.9/docs/GI-Gdk-Structs-ToplevelSize.html#v:toplevelSizeGetBounds"
})
#endif
foreign import ccall "gdk_toplevel_size_set_min_size" gdk_toplevel_size_set_min_size ::
Ptr ToplevelSize ->
Int32 ->
Int32 ->
IO ()
toplevelSizeSetMinSize ::
(B.CallStack.HasCallStack, MonadIO m) =>
ToplevelSize
-> Int32
-> Int32
-> m ()
toplevelSizeSetMinSize :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ToplevelSize -> Int32 -> Int32 -> m ()
toplevelSizeSetMinSize ToplevelSize
size Int32
minWidth Int32
minHeight = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
size' <- ToplevelSize -> IO (Ptr ToplevelSize)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ToplevelSize
size
gdk_toplevel_size_set_min_size size' minWidth minHeight
touchManagedPtr size
return ()
#if defined(ENABLE_OVERLOADING)
data ToplevelSizeSetMinSizeMethodInfo
instance (signature ~ (Int32 -> Int32 -> m ()), MonadIO m) => O.OverloadedMethod ToplevelSizeSetMinSizeMethodInfo ToplevelSize signature where
overloadedMethod = toplevelSizeSetMinSize
instance O.OverloadedMethodInfo ToplevelSizeSetMinSizeMethodInfo ToplevelSize where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gdk.Structs.ToplevelSize.toplevelSizeSetMinSize",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.9/docs/GI-Gdk-Structs-ToplevelSize.html#v:toplevelSizeSetMinSize"
})
#endif
foreign import ccall "gdk_toplevel_size_set_shadow_width" gdk_toplevel_size_set_shadow_width ::
Ptr ToplevelSize ->
Int32 ->
Int32 ->
Int32 ->
Int32 ->
IO ()
toplevelSizeSetShadowWidth ::
(B.CallStack.HasCallStack, MonadIO m) =>
ToplevelSize
-> Int32
-> Int32
-> Int32
-> Int32
-> m ()
toplevelSizeSetShadowWidth :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ToplevelSize -> Int32 -> Int32 -> Int32 -> Int32 -> m ()
toplevelSizeSetShadowWidth ToplevelSize
size Int32
left Int32
right Int32
top Int32
bottom = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
size' <- ToplevelSize -> IO (Ptr ToplevelSize)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ToplevelSize
size
gdk_toplevel_size_set_shadow_width size' left right top bottom
touchManagedPtr size
return ()
#if defined(ENABLE_OVERLOADING)
data ToplevelSizeSetShadowWidthMethodInfo
instance (signature ~ (Int32 -> Int32 -> Int32 -> Int32 -> m ()), MonadIO m) => O.OverloadedMethod ToplevelSizeSetShadowWidthMethodInfo ToplevelSize signature where
overloadedMethod = toplevelSizeSetShadowWidth
instance O.OverloadedMethodInfo ToplevelSizeSetShadowWidthMethodInfo ToplevelSize where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gdk.Structs.ToplevelSize.toplevelSizeSetShadowWidth",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.9/docs/GI-Gdk-Structs-ToplevelSize.html#v:toplevelSizeSetShadowWidth"
})
#endif
foreign import ccall "gdk_toplevel_size_set_size" gdk_toplevel_size_set_size ::
Ptr ToplevelSize ->
Int32 ->
Int32 ->
IO ()
toplevelSizeSetSize ::
(B.CallStack.HasCallStack, MonadIO m) =>
ToplevelSize
-> Int32
-> Int32
-> m ()
toplevelSizeSetSize :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ToplevelSize -> Int32 -> Int32 -> m ()
toplevelSizeSetSize ToplevelSize
size Int32
width Int32
height = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
size' <- ToplevelSize -> IO (Ptr ToplevelSize)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ToplevelSize
size
gdk_toplevel_size_set_size size' width height
touchManagedPtr size
return ()
#if defined(ENABLE_OVERLOADING)
data ToplevelSizeSetSizeMethodInfo
instance (signature ~ (Int32 -> Int32 -> m ()), MonadIO m) => O.OverloadedMethod ToplevelSizeSetSizeMethodInfo ToplevelSize signature where
overloadedMethod = toplevelSizeSetSize
instance O.OverloadedMethodInfo ToplevelSizeSetSizeMethodInfo ToplevelSize where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gdk.Structs.ToplevelSize.toplevelSizeSetSize",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.9/docs/GI-Gdk-Structs-ToplevelSize.html#v:toplevelSizeSetSize"
})
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveToplevelSizeMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveToplevelSizeMethod "getBounds" o = ToplevelSizeGetBoundsMethodInfo
ResolveToplevelSizeMethod "setMinSize" o = ToplevelSizeSetMinSizeMethodInfo
ResolveToplevelSizeMethod "setShadowWidth" o = ToplevelSizeSetShadowWidthMethodInfo
ResolveToplevelSizeMethod "setSize" o = ToplevelSizeSetSizeMethodInfo
ResolveToplevelSizeMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveToplevelSizeMethod t ToplevelSize, O.OverloadedMethod info ToplevelSize p) => OL.IsLabel t (ToplevelSize -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveToplevelSizeMethod t ToplevelSize, O.OverloadedMethod info ToplevelSize p, R.HasField t ToplevelSize p) => R.HasField t ToplevelSize p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveToplevelSizeMethod t ToplevelSize, O.OverloadedMethodInfo info ToplevelSize) => OL.IsLabel t (O.MethodProxy info ToplevelSize) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif