{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Pango.Structs.TabArray
(
TabArray(..) ,
noTabArray ,
#if defined(ENABLE_OVERLOADING)
ResolveTabArrayMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
TabArrayCopyMethodInfo ,
#endif
tabArrayCopy ,
#if defined(ENABLE_OVERLOADING)
TabArrayFreeMethodInfo ,
#endif
tabArrayFree ,
#if defined(ENABLE_OVERLOADING)
TabArrayGetPositionsInPixelsMethodInfo ,
#endif
tabArrayGetPositionsInPixels ,
#if defined(ENABLE_OVERLOADING)
TabArrayGetSizeMethodInfo ,
#endif
tabArrayGetSize ,
#if defined(ENABLE_OVERLOADING)
TabArrayGetTabMethodInfo ,
#endif
tabArrayGetTab ,
tabArrayNew ,
#if defined(ENABLE_OVERLOADING)
TabArrayResizeMethodInfo ,
#endif
tabArrayResize ,
#if defined(ENABLE_OVERLOADING)
TabArraySetTabMethodInfo ,
#endif
tabArraySetTab ,
) 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
import {-# SOURCE #-} qualified GI.Pango.Enums as Pango.Enums
newtype TabArray = TabArray (ManagedPtr TabArray)
deriving (TabArray -> TabArray -> Bool
(TabArray -> TabArray -> Bool)
-> (TabArray -> TabArray -> Bool) -> Eq TabArray
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TabArray -> TabArray -> Bool
$c/= :: TabArray -> TabArray -> Bool
== :: TabArray -> TabArray -> Bool
$c== :: TabArray -> TabArray -> Bool
Eq)
foreign import ccall "pango_tab_array_get_type" c_pango_tab_array_get_type ::
IO GType
instance BoxedObject TabArray where
boxedType :: TabArray -> IO GType
boxedType _ = IO GType
c_pango_tab_array_get_type
instance B.GValue.IsGValue TabArray where
toGValue :: TabArray -> IO GValue
toGValue o :: TabArray
o = do
GType
gtype <- IO GType
c_pango_tab_array_get_type
TabArray -> (Ptr TabArray -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr TabArray
o (GType
-> (GValue -> Ptr TabArray -> IO ()) -> Ptr TabArray -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr TabArray -> IO ()
forall a. GValue -> Ptr a -> IO ()
B.GValue.set_boxed)
fromGValue :: GValue -> IO TabArray
fromGValue gv :: GValue
gv = do
Ptr TabArray
ptr <- GValue -> IO (Ptr TabArray)
forall b. GValue -> IO (Ptr b)
B.GValue.get_boxed GValue
gv :: IO (Ptr TabArray)
(ManagedPtr TabArray -> TabArray) -> Ptr TabArray -> IO TabArray
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr TabArray -> TabArray
TabArray Ptr TabArray
ptr
noTabArray :: Maybe TabArray
noTabArray :: Maybe TabArray
noTabArray = Maybe TabArray
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList TabArray
type instance O.AttributeList TabArray = TabArrayAttributeList
type TabArrayAttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "pango_tab_array_new" pango_tab_array_new ::
Int32 ->
CInt ->
IO (Ptr TabArray)
tabArrayNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
Int32
-> Bool
-> m TabArray
tabArrayNew :: Int32 -> Bool -> m TabArray
tabArrayNew initialSize :: Int32
initialSize positionsInPixels :: Bool
positionsInPixels = IO TabArray -> m TabArray
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO TabArray -> m TabArray) -> IO TabArray -> m TabArray
forall a b. (a -> b) -> a -> b
$ do
let positionsInPixels' :: CInt
positionsInPixels' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
positionsInPixels
Ptr TabArray
result <- Int32 -> CInt -> IO (Ptr TabArray)
pango_tab_array_new Int32
initialSize CInt
positionsInPixels'
Text -> Ptr TabArray -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "tabArrayNew" Ptr TabArray
result
TabArray
result' <- ((ManagedPtr TabArray -> TabArray) -> Ptr TabArray -> IO TabArray
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr TabArray -> TabArray
TabArray) Ptr TabArray
result
TabArray -> IO TabArray
forall (m :: * -> *) a. Monad m => a -> m a
return TabArray
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "pango_tab_array_copy" pango_tab_array_copy ::
Ptr TabArray ->
IO (Ptr TabArray)
tabArrayCopy ::
(B.CallStack.HasCallStack, MonadIO m) =>
TabArray
-> m TabArray
tabArrayCopy :: TabArray -> m TabArray
tabArrayCopy src :: TabArray
src = IO TabArray -> m TabArray
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO TabArray -> m TabArray) -> IO TabArray -> m TabArray
forall a b. (a -> b) -> a -> b
$ do
Ptr TabArray
src' <- TabArray -> IO (Ptr TabArray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TabArray
src
Ptr TabArray
result <- Ptr TabArray -> IO (Ptr TabArray)
pango_tab_array_copy Ptr TabArray
src'
Text -> Ptr TabArray -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "tabArrayCopy" Ptr TabArray
result
TabArray
result' <- ((ManagedPtr TabArray -> TabArray) -> Ptr TabArray -> IO TabArray
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr TabArray -> TabArray
TabArray) Ptr TabArray
result
TabArray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TabArray
src
TabArray -> IO TabArray
forall (m :: * -> *) a. Monad m => a -> m a
return TabArray
result'
#if defined(ENABLE_OVERLOADING)
data TabArrayCopyMethodInfo
instance (signature ~ (m TabArray), MonadIO m) => O.MethodInfo TabArrayCopyMethodInfo TabArray signature where
overloadedMethod = tabArrayCopy
#endif
foreign import ccall "pango_tab_array_free" pango_tab_array_free ::
Ptr TabArray ->
IO ()
tabArrayFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
TabArray
-> m ()
tabArrayFree :: TabArray -> m ()
tabArrayFree tabArray :: TabArray
tabArray = 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 TabArray
tabArray' <- TabArray -> IO (Ptr TabArray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TabArray
tabArray
Ptr TabArray -> IO ()
pango_tab_array_free Ptr TabArray
tabArray'
TabArray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TabArray
tabArray
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data TabArrayFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo TabArrayFreeMethodInfo TabArray signature where
overloadedMethod = tabArrayFree
#endif
foreign import ccall "pango_tab_array_get_positions_in_pixels" pango_tab_array_get_positions_in_pixels ::
Ptr TabArray ->
IO CInt
tabArrayGetPositionsInPixels ::
(B.CallStack.HasCallStack, MonadIO m) =>
TabArray
-> m Bool
tabArrayGetPositionsInPixels :: TabArray -> m Bool
tabArrayGetPositionsInPixels tabArray :: TabArray
tabArray = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr TabArray
tabArray' <- TabArray -> IO (Ptr TabArray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TabArray
tabArray
CInt
result <- Ptr TabArray -> IO CInt
pango_tab_array_get_positions_in_pixels Ptr TabArray
tabArray'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
TabArray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TabArray
tabArray
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data TabArrayGetPositionsInPixelsMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo TabArrayGetPositionsInPixelsMethodInfo TabArray signature where
overloadedMethod = tabArrayGetPositionsInPixels
#endif
foreign import ccall "pango_tab_array_get_size" pango_tab_array_get_size ::
Ptr TabArray ->
IO Int32
tabArrayGetSize ::
(B.CallStack.HasCallStack, MonadIO m) =>
TabArray
-> m Int32
tabArrayGetSize :: TabArray -> m Int32
tabArrayGetSize tabArray :: TabArray
tabArray = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
Ptr TabArray
tabArray' <- TabArray -> IO (Ptr TabArray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TabArray
tabArray
Int32
result <- Ptr TabArray -> IO Int32
pango_tab_array_get_size Ptr TabArray
tabArray'
TabArray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TabArray
tabArray
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result
#if defined(ENABLE_OVERLOADING)
data TabArrayGetSizeMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo TabArrayGetSizeMethodInfo TabArray signature where
overloadedMethod = tabArrayGetSize
#endif
foreign import ccall "pango_tab_array_get_tab" pango_tab_array_get_tab ::
Ptr TabArray ->
Int32 ->
Ptr CUInt ->
Ptr Int32 ->
IO ()
tabArrayGetTab ::
(B.CallStack.HasCallStack, MonadIO m) =>
TabArray
-> Int32
-> m ((Pango.Enums.TabAlign, Int32))
tabArrayGetTab :: TabArray -> Int32 -> m (TabAlign, Int32)
tabArrayGetTab tabArray :: TabArray
tabArray tabIndex :: Int32
tabIndex = IO (TabAlign, Int32) -> m (TabAlign, Int32)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (TabAlign, Int32) -> m (TabAlign, Int32))
-> IO (TabAlign, Int32) -> m (TabAlign, Int32)
forall a b. (a -> b) -> a -> b
$ do
Ptr TabArray
tabArray' <- TabArray -> IO (Ptr TabArray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TabArray
tabArray
Ptr CUInt
alignment <- IO (Ptr CUInt)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CUInt)
Ptr Int32
location <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
Ptr TabArray -> Int32 -> Ptr CUInt -> Ptr Int32 -> IO ()
pango_tab_array_get_tab Ptr TabArray
tabArray' Int32
tabIndex Ptr CUInt
alignment Ptr Int32
location
CUInt
alignment' <- Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
alignment
let alignment'' :: TabAlign
alignment'' = (Int -> TabAlign
forall a. Enum a => Int -> a
toEnum (Int -> TabAlign) -> (CUInt -> Int) -> CUInt -> TabAlign
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
alignment'
Int32
location' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
location
TabArray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TabArray
tabArray
Ptr CUInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CUInt
alignment
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
location
(TabAlign, Int32) -> IO (TabAlign, Int32)
forall (m :: * -> *) a. Monad m => a -> m a
return (TabAlign
alignment'', Int32
location')
#if defined(ENABLE_OVERLOADING)
data TabArrayGetTabMethodInfo
instance (signature ~ (Int32 -> m ((Pango.Enums.TabAlign, Int32))), MonadIO m) => O.MethodInfo TabArrayGetTabMethodInfo TabArray signature where
overloadedMethod = tabArrayGetTab
#endif
foreign import ccall "pango_tab_array_resize" pango_tab_array_resize ::
Ptr TabArray ->
Int32 ->
IO ()
tabArrayResize ::
(B.CallStack.HasCallStack, MonadIO m) =>
TabArray
-> Int32
-> m ()
tabArrayResize :: TabArray -> Int32 -> m ()
tabArrayResize tabArray :: TabArray
tabArray newSize :: Int32
newSize = 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 TabArray
tabArray' <- TabArray -> IO (Ptr TabArray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TabArray
tabArray
Ptr TabArray -> Int32 -> IO ()
pango_tab_array_resize Ptr TabArray
tabArray' Int32
newSize
TabArray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TabArray
tabArray
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data TabArrayResizeMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m) => O.MethodInfo TabArrayResizeMethodInfo TabArray signature where
overloadedMethod = tabArrayResize
#endif
foreign import ccall "pango_tab_array_set_tab" pango_tab_array_set_tab ::
Ptr TabArray ->
Int32 ->
CUInt ->
Int32 ->
IO ()
tabArraySetTab ::
(B.CallStack.HasCallStack, MonadIO m) =>
TabArray
-> Int32
-> Pango.Enums.TabAlign
-> Int32
-> m ()
tabArraySetTab :: TabArray -> Int32 -> TabAlign -> Int32 -> m ()
tabArraySetTab tabArray :: TabArray
tabArray tabIndex :: Int32
tabIndex alignment :: TabAlign
alignment location :: Int32
location = 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 TabArray
tabArray' <- TabArray -> IO (Ptr TabArray)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TabArray
tabArray
let alignment' :: CUInt
alignment' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (TabAlign -> Int) -> TabAlign -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TabAlign -> Int
forall a. Enum a => a -> Int
fromEnum) TabAlign
alignment
Ptr TabArray -> Int32 -> CUInt -> Int32 -> IO ()
pango_tab_array_set_tab Ptr TabArray
tabArray' Int32
tabIndex CUInt
alignment' Int32
location
TabArray -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TabArray
tabArray
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data TabArraySetTabMethodInfo
instance (signature ~ (Int32 -> Pango.Enums.TabAlign -> Int32 -> m ()), MonadIO m) => O.MethodInfo TabArraySetTabMethodInfo TabArray signature where
overloadedMethod = tabArraySetTab
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveTabArrayMethod (t :: Symbol) (o :: *) :: * where
ResolveTabArrayMethod "copy" o = TabArrayCopyMethodInfo
ResolveTabArrayMethod "free" o = TabArrayFreeMethodInfo
ResolveTabArrayMethod "resize" o = TabArrayResizeMethodInfo
ResolveTabArrayMethod "getPositionsInPixels" o = TabArrayGetPositionsInPixelsMethodInfo
ResolveTabArrayMethod "getSize" o = TabArrayGetSizeMethodInfo
ResolveTabArrayMethod "getTab" o = TabArrayGetTabMethodInfo
ResolveTabArrayMethod "setTab" o = TabArraySetTabMethodInfo
ResolveTabArrayMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveTabArrayMethod t TabArray, O.MethodInfo info TabArray p) => OL.IsLabel t (TabArray -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif