{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) A structure used to store a rectangle used by AtkText. -} module GI.Atk.Structs.TextRectangle ( -- * Exported types TextRectangle(..) , newZeroTextRectangle , noTextRectangle , -- * Properties -- ** Height textRectangleReadHeight , -- ** Width textRectangleReadWidth , -- ** X textRectangleReadX , -- ** Y textRectangleReadY , ) 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.Atk.Types import GI.Atk.Callbacks newtype TextRectangle = TextRectangle (ForeignPtr TextRectangle) -- | Construct a `TextRectangle` struct initialized to zero. newZeroTextRectangle :: MonadIO m => m TextRectangle newZeroTextRectangle = liftIO $ callocBytes 16 >>= wrapPtr TextRectangle noTextRectangle :: Maybe TextRectangle noTextRectangle = Nothing textRectangleReadX :: TextRectangle -> IO Int32 textRectangleReadX s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 0) :: IO Int32 return val textRectangleReadY :: TextRectangle -> IO Int32 textRectangleReadY s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 4) :: IO Int32 return val textRectangleReadWidth :: TextRectangle -> IO Int32 textRectangleReadWidth s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 8) :: IO Int32 return val textRectangleReadHeight :: TextRectangle -> IO Int32 textRectangleReadHeight s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 12) :: IO Int32 return val type family ResolveTextRectangleMethod (t :: Symbol) (o :: *) :: * where ResolveTextRectangleMethod l o = MethodResolutionFailed l o instance (info ~ ResolveTextRectangleMethod t TextRectangle, MethodInfo info TextRectangle p) => IsLabelProxy t (TextRectangle -> p) where fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info) #if MIN_VERSION_base(4,9,0) instance (info ~ ResolveTextRectangleMethod t TextRectangle, MethodInfo info TextRectangle p) => IsLabel t (TextRectangle -> p) where fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info) #endif