gi-gtk-0.3.18.13: GI/Gtk/Structs/RequestedSize.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
Represents a request of a screen object in a given orientation. These
are primarily used in container implementations when allocating a natural
size for children calling. See gtk_distribute_natural_allocation().
-}
module GI.Gtk.Structs.RequestedSize
(
-- * Exported types
RequestedSize(..) ,
newZeroRequestedSize ,
noRequestedSize ,
-- * Properties
-- ** Data
requestedSizeReadData ,
-- ** MinimumSize
requestedSizeReadMinimumSize ,
-- ** NaturalSize
requestedSizeReadNaturalSize ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.Gtk.Types
import GI.Gtk.Callbacks
newtype RequestedSize = RequestedSize (ForeignPtr RequestedSize)
-- | Construct a `RequestedSize` struct initialized to zero.
newZeroRequestedSize :: MonadIO m => m RequestedSize
newZeroRequestedSize = liftIO $ callocBytes 16 >>= wrapPtr RequestedSize
noRequestedSize :: Maybe RequestedSize
noRequestedSize = Nothing
requestedSizeReadData :: RequestedSize -> IO (Ptr ())
requestedSizeReadData s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO (Ptr ())
return val
requestedSizeReadMinimumSize :: RequestedSize -> IO Int32
requestedSizeReadMinimumSize s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO Int32
return val
requestedSizeReadNaturalSize :: RequestedSize -> IO Int32
requestedSizeReadNaturalSize s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 12) :: IO Int32
return val
type family ResolveRequestedSizeMethod (t :: Symbol) (o :: *) :: * where
ResolveRequestedSizeMethod l o = MethodResolutionFailed l o
instance (info ~ ResolveRequestedSizeMethod t RequestedSize, MethodInfo info RequestedSize p) => IsLabelProxy t (RequestedSize -> p) where
fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveRequestedSizeMethod t RequestedSize, MethodInfo info RequestedSize p) => IsLabel t (RequestedSize -> p) where
fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif