{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.PangoCairo.Interfaces.Font
(
Font(..) ,
IsFont ,
toFont ,
#if defined(ENABLE_OVERLOADING)
ResolveFontMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
FontGetScaledFontMethodInfo ,
#endif
fontGetScaledFont ,
) 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.Kind as DK
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 qualified GI.Cairo.Structs.ScaledFont as Cairo.ScaledFont
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Pango.Objects.Font as Pango.Font
newtype Font = Font (SP.ManagedPtr Font)
deriving (Font -> Font -> Bool
(Font -> Font -> Bool) -> (Font -> Font -> Bool) -> Eq Font
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Font -> Font -> Bool
== :: Font -> Font -> Bool
$c/= :: Font -> Font -> Bool
/= :: Font -> Font -> Bool
Eq)
instance SP.ManagedPtrNewtype Font where
toManagedPtr :: Font -> ManagedPtr Font
toManagedPtr (Font ManagedPtr Font
p) = ManagedPtr Font
p
foreign import ccall "pango_cairo_font_get_type"
c_pango_cairo_font_get_type :: IO B.Types.GType
instance B.Types.TypedObject Font where
glibType :: IO GType
glibType = IO GType
c_pango_cairo_font_get_type
instance B.Types.GObject Font
class (SP.GObject o, O.IsDescendantOf Font o) => IsFont o
instance (SP.GObject o, O.IsDescendantOf Font o) => IsFont o
instance O.HasParentTypes Font
type instance O.ParentTypes Font = '[Pango.Font.Font, GObject.Object.Object]
toFont :: (MIO.MonadIO m, IsFont o) => o -> m Font
toFont :: forall (m :: * -> *) o. (MonadIO m, IsFont o) => o -> m Font
toFont = IO Font -> m Font
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Font -> m Font) -> (o -> IO Font) -> o -> m Font
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Font -> Font) -> o -> IO Font
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Font -> Font
Font
instance B.GValue.IsGValue (Maybe Font) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_pango_cairo_font_get_type
gvalueSet_ :: Ptr GValue -> Maybe Font -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Font
P.Nothing = Ptr GValue -> Ptr Font -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr Font
forall a. Ptr a
FP.nullPtr :: FP.Ptr Font)
gvalueSet_ Ptr GValue
gv (P.Just Font
obj) = Font -> (Ptr Font -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Font
obj (Ptr GValue -> Ptr Font -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe Font)
gvalueGet_ Ptr GValue
gv = do
Ptr Font
ptr <- Ptr GValue -> IO (Ptr Font)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr Font)
if Ptr Font
ptr Ptr Font -> Ptr Font -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Font
forall a. Ptr a
FP.nullPtr
then Font -> Maybe Font
forall a. a -> Maybe a
P.Just (Font -> Maybe Font) -> IO Font -> IO (Maybe Font)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr Font -> Font) -> Ptr Font -> IO Font
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Font -> Font
Font Ptr Font
ptr
else Maybe Font -> IO (Maybe Font)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Font
forall a. Maybe a
P.Nothing
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Font
type instance O.AttributeList Font = FontAttributeList
type FontAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveFontMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveFontMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveFontMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveFontMethod "describe" o = Pango.Font.FontDescribeMethodInfo
ResolveFontMethod "describeWithAbsoluteSize" o = Pango.Font.FontDescribeWithAbsoluteSizeMethodInfo
ResolveFontMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveFontMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveFontMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveFontMethod "hasChar" o = Pango.Font.FontHasCharMethodInfo
ResolveFontMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveFontMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveFontMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveFontMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveFontMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveFontMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveFontMethod "serialize" o = Pango.Font.FontSerializeMethodInfo
ResolveFontMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveFontMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveFontMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveFontMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveFontMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveFontMethod "getCoverage" o = Pango.Font.FontGetCoverageMethodInfo
ResolveFontMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveFontMethod "getFace" o = Pango.Font.FontGetFaceMethodInfo
ResolveFontMethod "getFeatures" o = Pango.Font.FontGetFeaturesMethodInfo
ResolveFontMethod "getFontMap" o = Pango.Font.FontGetFontMapMethodInfo
ResolveFontMethod "getGlyphExtents" o = Pango.Font.FontGetGlyphExtentsMethodInfo
ResolveFontMethod "getLanguages" o = Pango.Font.FontGetLanguagesMethodInfo
ResolveFontMethod "getMetrics" o = Pango.Font.FontGetMetricsMethodInfo
ResolveFontMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveFontMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveFontMethod "getScaledFont" o = FontGetScaledFontMethodInfo
ResolveFontMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveFontMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveFontMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveFontMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveFontMethod t Font, O.OverloadedMethod info Font p) => OL.IsLabel t (Font -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveFontMethod t Font, O.OverloadedMethod info Font p, R.HasField t Font p) => R.HasField t Font p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveFontMethod t Font, O.OverloadedMethodInfo info Font) => OL.IsLabel t (O.MethodProxy info Font) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
foreign import ccall "pango_cairo_font_get_scaled_font" pango_cairo_font_get_scaled_font ::
Ptr Font ->
IO (Ptr Cairo.ScaledFont.ScaledFont)
fontGetScaledFont ::
(B.CallStack.HasCallStack, MonadIO m, IsFont a) =>
a
-> m (Maybe Cairo.ScaledFont.ScaledFont)
fontGetScaledFont :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFont a) =>
a -> m (Maybe ScaledFont)
fontGetScaledFont a
font = IO (Maybe ScaledFont) -> m (Maybe ScaledFont)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe ScaledFont) -> m (Maybe ScaledFont))
-> IO (Maybe ScaledFont) -> m (Maybe ScaledFont)
forall a b. (a -> b) -> a -> b
$ do
Ptr Font
font' <- a -> IO (Ptr Font)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
font
Ptr ScaledFont
result <- Ptr Font -> IO (Ptr ScaledFont)
pango_cairo_font_get_scaled_font Ptr Font
font'
Maybe ScaledFont
maybeResult <- Ptr ScaledFont
-> (Ptr ScaledFont -> IO ScaledFont) -> IO (Maybe ScaledFont)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr ScaledFont
result ((Ptr ScaledFont -> IO ScaledFont) -> IO (Maybe ScaledFont))
-> (Ptr ScaledFont -> IO ScaledFont) -> IO (Maybe ScaledFont)
forall a b. (a -> b) -> a -> b
$ \Ptr ScaledFont
result' -> do
ScaledFont
result'' <- ((ManagedPtr ScaledFont -> ScaledFont)
-> Ptr ScaledFont -> IO ScaledFont
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr ScaledFont -> ScaledFont
Cairo.ScaledFont.ScaledFont) Ptr ScaledFont
result'
ScaledFont -> IO ScaledFont
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ScaledFont
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
font
Maybe ScaledFont -> IO (Maybe ScaledFont)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe ScaledFont
maybeResult
#if defined(ENABLE_OVERLOADING)
data FontGetScaledFontMethodInfo
instance (signature ~ (m (Maybe Cairo.ScaledFont.ScaledFont)), MonadIO m, IsFont a) => O.OverloadedMethod FontGetScaledFontMethodInfo a signature where
overloadedMethod = fontGetScaledFont
instance O.OverloadedMethodInfo FontGetScaledFontMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.PangoCairo.Interfaces.Font.fontGetScaledFont",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pangocairo-1.0.30/docs/GI-PangoCairo-Interfaces-Font.html#v:fontGetScaledFont"
})
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Font = FontSignalList
type FontSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif