{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- Data type to hold information for a \"part\" component of a math-variant glyph.
-- Large variants for stretchable math glyphs (such as parentheses) can be constructed
-- on the fly from parts.
-- 
-- /Since: 1.3.3/

#if !defined(__HADDOCK_VERSION__)
#define ENABLE_OVERLOADING
#endif

module GI.HarfBuzz.Structs.OtMathGlyphPartT
    ( 

-- * Exported types
    OtMathGlyphPartT(..)                    ,
    newZeroOtMathGlyphPartT                 ,


 -- * Methods

#if defined(ENABLE_OVERLOADING)
    ResolveOtMathGlyphPartTMethod           ,
#endif



 -- * Properties


-- ** endConnectorLength #attr:endConnectorLength#
-- | The length of the connector on the ending side of the variant part

    getOtMathGlyphPartTEndConnectorLength   ,
#if defined(ENABLE_OVERLOADING)
    otMathGlyphPartT_endConnectorLength     ,
#endif
    setOtMathGlyphPartTEndConnectorLength   ,


-- ** flags #attr:flags#
-- | t'GI.HarfBuzz.Flags.OtMathGlyphPartFlagsT' flags for the part

    getOtMathGlyphPartTFlags                ,
#if defined(ENABLE_OVERLOADING)
    otMathGlyphPartT_flags                  ,
#endif
    setOtMathGlyphPartTFlags                ,


-- ** fullAdvance #attr:fullAdvance#
-- | The total advance of the part

    getOtMathGlyphPartTFullAdvance          ,
#if defined(ENABLE_OVERLOADING)
    otMathGlyphPartT_fullAdvance            ,
#endif
    setOtMathGlyphPartTFullAdvance          ,


-- ** glyph #attr:glyph#
-- | The glyph index of the variant part

    getOtMathGlyphPartTGlyph                ,
#if defined(ENABLE_OVERLOADING)
    otMathGlyphPartT_glyph                  ,
#endif
    setOtMathGlyphPartTGlyph                ,


-- ** startConnectorLength #attr:startConnectorLength#
-- | The length of the connector on the starting side of the variant part

    getOtMathGlyphPartTStartConnectorLength ,
#if defined(ENABLE_OVERLOADING)
    otMathGlyphPartT_startConnectorLength   ,
#endif
    setOtMathGlyphPartTStartConnectorLength ,




    ) 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.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 {-# SOURCE #-} qualified GI.HarfBuzz.Flags as HarfBuzz.Flags

-- | Memory-managed wrapper type.
newtype OtMathGlyphPartT = OtMathGlyphPartT (SP.ManagedPtr OtMathGlyphPartT)
    deriving (OtMathGlyphPartT -> OtMathGlyphPartT -> Bool
(OtMathGlyphPartT -> OtMathGlyphPartT -> Bool)
-> (OtMathGlyphPartT -> OtMathGlyphPartT -> Bool)
-> Eq OtMathGlyphPartT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OtMathGlyphPartT -> OtMathGlyphPartT -> Bool
$c/= :: OtMathGlyphPartT -> OtMathGlyphPartT -> Bool
== :: OtMathGlyphPartT -> OtMathGlyphPartT -> Bool
$c== :: OtMathGlyphPartT -> OtMathGlyphPartT -> Bool
Eq)

instance SP.ManagedPtrNewtype OtMathGlyphPartT where
    toManagedPtr :: OtMathGlyphPartT -> ManagedPtr OtMathGlyphPartT
toManagedPtr (OtMathGlyphPartT ManagedPtr OtMathGlyphPartT
p) = ManagedPtr OtMathGlyphPartT
p

foreign import ccall "hb_gobject_ot_math_glyph_part_get_type" c_hb_gobject_ot_math_glyph_part_get_type :: 
    IO GType

type instance O.ParentTypes OtMathGlyphPartT = '[]
instance O.HasParentTypes OtMathGlyphPartT

instance B.Types.TypedObject OtMathGlyphPartT where
    glibType :: IO GType
glibType = IO GType
c_hb_gobject_ot_math_glyph_part_get_type

instance B.Types.GBoxed OtMathGlyphPartT

-- | Convert 'OtMathGlyphPartT' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe OtMathGlyphPartT) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_hb_gobject_ot_math_glyph_part_get_type
    gvalueSet_ :: Ptr GValue -> Maybe OtMathGlyphPartT -> IO ()
gvalueSet_ Ptr GValue
gv Maybe OtMathGlyphPartT
P.Nothing = Ptr GValue -> Ptr OtMathGlyphPartT -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (Ptr OtMathGlyphPartT
forall a. Ptr a
FP.nullPtr :: FP.Ptr OtMathGlyphPartT)
    gvalueSet_ Ptr GValue
gv (P.Just OtMathGlyphPartT
obj) = OtMathGlyphPartT -> (Ptr OtMathGlyphPartT -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr OtMathGlyphPartT
obj (Ptr GValue -> Ptr OtMathGlyphPartT -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe OtMathGlyphPartT)
gvalueGet_ Ptr GValue
gv = do
        Ptr OtMathGlyphPartT
ptr <- Ptr GValue -> IO (Ptr OtMathGlyphPartT)
forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr OtMathGlyphPartT)
        if Ptr OtMathGlyphPartT
ptr Ptr OtMathGlyphPartT -> Ptr OtMathGlyphPartT -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr OtMathGlyphPartT
forall a. Ptr a
FP.nullPtr
        then OtMathGlyphPartT -> Maybe OtMathGlyphPartT
forall a. a -> Maybe a
P.Just (OtMathGlyphPartT -> Maybe OtMathGlyphPartT)
-> IO OtMathGlyphPartT -> IO (Maybe OtMathGlyphPartT)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr OtMathGlyphPartT -> OtMathGlyphPartT)
-> Ptr OtMathGlyphPartT -> IO OtMathGlyphPartT
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr OtMathGlyphPartT -> OtMathGlyphPartT
OtMathGlyphPartT Ptr OtMathGlyphPartT
ptr
        else Maybe OtMathGlyphPartT -> IO (Maybe OtMathGlyphPartT)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe OtMathGlyphPartT
forall a. Maybe a
P.Nothing
        
    

-- | Construct a `OtMathGlyphPartT` struct initialized to zero.
newZeroOtMathGlyphPartT :: MonadIO m => m OtMathGlyphPartT
newZeroOtMathGlyphPartT :: forall (m :: * -> *). MonadIO m => m OtMathGlyphPartT
newZeroOtMathGlyphPartT = IO OtMathGlyphPartT -> m OtMathGlyphPartT
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO OtMathGlyphPartT -> m OtMathGlyphPartT)
-> IO OtMathGlyphPartT -> m OtMathGlyphPartT
forall a b. (a -> b) -> a -> b
$ Int -> IO (Ptr OtMathGlyphPartT)
forall a. GBoxed a => Int -> IO (Ptr a)
callocBoxedBytes Int
20 IO (Ptr OtMathGlyphPartT)
-> (Ptr OtMathGlyphPartT -> IO OtMathGlyphPartT)
-> IO OtMathGlyphPartT
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr OtMathGlyphPartT -> OtMathGlyphPartT)
-> Ptr OtMathGlyphPartT -> IO OtMathGlyphPartT
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr OtMathGlyphPartT -> OtMathGlyphPartT
OtMathGlyphPartT

instance tag ~ 'AttrSet => Constructible OtMathGlyphPartT tag where
    new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr OtMathGlyphPartT -> OtMathGlyphPartT)
-> [AttrOp OtMathGlyphPartT tag] -> m OtMathGlyphPartT
new ManagedPtr OtMathGlyphPartT -> OtMathGlyphPartT
_ [AttrOp OtMathGlyphPartT tag]
attrs = do
        OtMathGlyphPartT
o <- m OtMathGlyphPartT
forall (m :: * -> *). MonadIO m => m OtMathGlyphPartT
newZeroOtMathGlyphPartT
        OtMathGlyphPartT -> [AttrOp OtMathGlyphPartT 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set OtMathGlyphPartT
o [AttrOp OtMathGlyphPartT tag]
[AttrOp OtMathGlyphPartT 'AttrSet]
attrs
        OtMathGlyphPartT -> m OtMathGlyphPartT
forall (m :: * -> *) a. Monad m => a -> m a
return OtMathGlyphPartT
o


-- | Get the value of the “@glyph@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' otMathGlyphPartT #glyph
-- @
getOtMathGlyphPartTGlyph