{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Pango.Objects.FontFamily
(
FontFamily(..) ,
IsFontFamily ,
toFontFamily ,
#if defined(ENABLE_OVERLOADING)
ResolveFontFamilyMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
FontFamilyGetNameMethodInfo ,
#endif
fontFamilyGetName ,
#if defined(ENABLE_OVERLOADING)
FontFamilyIsMonospaceMethodInfo ,
#endif
fontFamilyIsMonospace ,
#if defined(ENABLE_OVERLOADING)
FontFamilyIsVariableMethodInfo ,
#endif
fontFamilyIsVariable ,
#if defined(ENABLE_OVERLOADING)
FontFamilyListFacesMethodInfo ,
#endif
fontFamilyListFaces ,
) 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.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 Control.Monad.IO.Class as MIO
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 GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Pango.Objects.FontFace as Pango.FontFace
newtype FontFamily = FontFamily (SP.ManagedPtr FontFamily)
deriving (FontFamily -> FontFamily -> Bool
(FontFamily -> FontFamily -> Bool)
-> (FontFamily -> FontFamily -> Bool) -> Eq FontFamily
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FontFamily -> FontFamily -> Bool
$c/= :: FontFamily -> FontFamily -> Bool
== :: FontFamily -> FontFamily -> Bool
$c== :: FontFamily -> FontFamily -> Bool
Eq)
instance SP.ManagedPtrNewtype FontFamily where
toManagedPtr :: FontFamily -> ManagedPtr FontFamily
toManagedPtr (FontFamily ManagedPtr FontFamily
p) = ManagedPtr FontFamily
p
foreign import ccall "pango_font_family_get_type"
c_pango_font_family_get_type :: IO B.Types.GType
instance B.Types.TypedObject FontFamily where
glibType :: IO GType
glibType = IO GType
c_pango_font_family_get_type
instance B.Types.GObject FontFamily
instance B.GValue.IsGValue FontFamily where
toGValue :: FontFamily -> IO GValue
toGValue FontFamily
o = do
GType
gtype <- IO GType
c_pango_font_family_get_type
FontFamily -> (Ptr FontFamily -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr FontFamily
o (GType
-> (GValue -> Ptr FontFamily -> IO ())
-> Ptr FontFamily
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr FontFamily -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO FontFamily
fromGValue GValue
gv = do
Ptr FontFamily
ptr <- GValue -> IO (Ptr FontFamily)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr FontFamily)
(ManagedPtr FontFamily -> FontFamily)
-> Ptr FontFamily -> IO FontFamily
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr FontFamily -> FontFamily
FontFamily Ptr FontFamily
ptr
class (SP.GObject o, O.IsDescendantOf FontFamily o) => IsFontFamily o
instance (SP.GObject o, O.IsDescendantOf FontFamily o) => IsFontFamily o
instance O.HasParentTypes FontFamily
type instance O.ParentTypes FontFamily = '[GObject.Object.Object]
toFontFamily :: (MonadIO m, IsFontFamily o) => o -> m FontFamily
toFontFamily :: o -> m FontFamily
toFontFamily = IO FontFamily -> m FontFamily
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FontFamily -> m FontFamily)
-> (o -> IO FontFamily) -> o -> m FontFamily
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr FontFamily -> FontFamily) -> o -> IO FontFamily
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr FontFamily -> FontFamily
FontFamily
#if defined(ENABLE_OVERLOADING)
type family ResolveFontFamilyMethod (t :: Symbol) (o :: *) :: * where
ResolveFontFamilyMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveFontFamilyMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveFontFamilyMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveFontFamilyMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveFontFamilyMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveFontFamilyMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveFontFamilyMethod "isMonospace" o = FontFamilyIsMonospaceMethodInfo
ResolveFontFamilyMethod "isVariable" o = FontFamilyIsVariableMethodInfo
ResolveFontFamilyMethod "listFaces" o = FontFamilyListFacesMethodInfo
ResolveFontFamilyMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveFontFamilyMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveFontFamilyMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveFontFamilyMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveFontFamilyMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveFontFamilyMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveFontFamilyMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveFontFamilyMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveFontFamilyMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveFontFamilyMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveFontFamilyMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveFontFamilyMethod "getName" o = FontFamilyGetNameMethodInfo
ResolveFontFamilyMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveFontFamilyMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveFontFamilyMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveFontFamilyMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveFontFamilyMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveFontFamilyMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveFontFamilyMethod t FontFamily, O.MethodInfo info FontFamily p) => OL.IsLabel t (FontFamily -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList FontFamily
type instance O.AttributeList FontFamily = FontFamilyAttributeList
type FontFamilyAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList FontFamily = FontFamilySignalList
type FontFamilySignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "pango_font_family_get_name" pango_font_family_get_name ::
Ptr FontFamily ->
IO CString
fontFamilyGetName ::
(B.CallStack.HasCallStack, MonadIO m, IsFontFamily a) =>
a
-> m T.Text
fontFamilyGetName :: a -> m Text
fontFamilyGetName a
family = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
Ptr FontFamily
family' <- a -> IO (Ptr FontFamily)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
family
CString
result <- Ptr FontFamily -> IO CString
pango_font_family_get_name Ptr FontFamily
family'
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"fontFamilyGetName" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
family
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
#if defined(ENABLE_OVERLOADING)
data FontFamilyGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsFontFamily a) => O.MethodInfo FontFamilyGetNameMethodInfo a signature where
overloadedMethod = fontFamilyGetName
#endif
foreign import ccall "pango_font_family_is_monospace" pango_font_family_is_monospace ::
Ptr FontFamily ->
IO CInt
fontFamilyIsMonospace ::
(B.CallStack.HasCallStack, MonadIO m, IsFontFamily a) =>
a
-> m Bool
fontFamilyIsMonospace :: a -> m Bool
fontFamilyIsMonospace a
family = 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 FontFamily
family' <- a -> IO (Ptr FontFamily)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
family
CInt
result <- Ptr FontFamily -> IO CInt
pango_font_family_is_monospace Ptr FontFamily
family'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
family
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data FontFamilyIsMonospaceMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsFontFamily a) => O.MethodInfo FontFamilyIsMonospaceMethodInfo a signature where
overloadedMethod = fontFamilyIsMonospace
#endif
foreign import ccall "pango_font_family_is_variable" pango_font_family_is_variable ::
Ptr FontFamily ->
IO CInt
fontFamilyIsVariable ::
(B.CallStack.HasCallStack, MonadIO m, IsFontFamily a) =>
a
-> m Bool
fontFamilyIsVariable :: a -> m Bool
fontFamilyIsVariable a
family = 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 FontFamily
family' <- a -> IO (Ptr FontFamily)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
family
CInt
result <- Ptr FontFamily -> IO CInt
pango_font_family_is_variable Ptr FontFamily
family'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
family
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data FontFamilyIsVariableMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsFontFamily a) => O.MethodInfo FontFamilyIsVariableMethodInfo a signature where
overloadedMethod = fontFamilyIsVariable
#endif
foreign import ccall "pango_font_family_list_faces" pango_font_family_list_faces ::
Ptr FontFamily ->
Ptr (Ptr (Ptr Pango.FontFace.FontFace)) ->
Ptr Int32 ->
IO ()
fontFamilyListFaces ::
(B.CallStack.HasCallStack, MonadIO m, IsFontFamily a) =>
a
-> m ([Pango.FontFace.FontFace])
fontFamilyListFaces :: a -> m [FontFace]
fontFamilyListFaces a
family = IO [FontFace] -> m [FontFace]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [FontFace] -> m [FontFace]) -> IO [FontFace] -> m [FontFace]
forall a b. (a -> b) -> a -> b
$ do
Ptr FontFamily
family' <- a -> IO (Ptr FontFamily)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
family
Ptr (Ptr (Ptr FontFace))
faces <- IO (Ptr (Ptr (Ptr FontFace)))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr (Ptr Pango.FontFace.FontFace)))
Ptr Int32
nFaces <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
Ptr FontFamily -> Ptr (Ptr (Ptr FontFace)) -> Ptr Int32 -> IO ()
pango_font_family_list_faces Ptr FontFamily
family' Ptr (Ptr (Ptr FontFace))
faces Ptr Int32
nFaces
Int32
nFaces' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
nFaces
Ptr (Ptr FontFace)
faces' <- Ptr (Ptr (Ptr FontFace)) -> IO (Ptr (Ptr FontFace))
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr (Ptr FontFace))
faces
[Ptr FontFace]
faces'' <- (Int32 -> Ptr (Ptr FontFace) -> IO [Ptr FontFace]
forall a b. Integral a => a -> Ptr (Ptr b) -> IO [Ptr b]
unpackPtrArrayWithLength Int32
nFaces') Ptr (Ptr FontFace)
faces'
[FontFace]
faces''' <- (Ptr FontFace -> IO FontFace) -> [Ptr FontFace] -> IO [FontFace]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((ManagedPtr FontFace -> FontFace) -> Ptr FontFace -> IO FontFace
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr FontFace -> FontFace
Pango.FontFace.FontFace) [Ptr FontFace]
faces''
Ptr (Ptr FontFace) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr FontFace)
faces'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
family
Ptr (Ptr (Ptr FontFace)) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr (Ptr FontFace))
faces
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
nFaces
[FontFace] -> IO [FontFace]
forall (m :: * -> *) a. Monad m => a -> m a
return [FontFace]
faces'''
#if defined(ENABLE_OVERLOADING)
data FontFamilyListFacesMethodInfo
instance (signature ~ (m ([Pango.FontFace.FontFace])), MonadIO m, IsFontFamily a) => O.MethodInfo FontFamilyListFacesMethodInfo a signature where
overloadedMethod = fontFamilyListFaces
#endif