{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Objects.BytesIcon
(
BytesIcon(..) ,
IsBytesIcon ,
toBytesIcon ,
#if defined(ENABLE_OVERLOADING)
ResolveBytesIconMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
BytesIconGetBytesMethodInfo ,
#endif
bytesIconGetBytes ,
bytesIconNew ,
#if defined(ENABLE_OVERLOADING)
BytesIconBytesPropertyInfo ,
#endif
#if defined(ENABLE_OVERLOADING)
bytesIconBytes ,
#endif
constructBytesIconBytes ,
getBytesIconBytes ,
) 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 Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT
#if MIN_VERSION_base(4,18,0)
import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GLib.Structs.PollFD as GLib.PollFD
import qualified GI.GLib.Structs.Source as GLib.Source
import qualified GI.GObject.Callbacks as GObject.Callbacks
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Icon as Gio.Icon
import {-# SOURCE #-} qualified GI.Gio.Interfaces.LoadableIcon as Gio.LoadableIcon
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Gio.Objects.InputStream as Gio.InputStream
#else
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Icon as Gio.Icon
import {-# SOURCE #-} qualified GI.Gio.Interfaces.LoadableIcon as Gio.LoadableIcon
#endif
newtype BytesIcon = BytesIcon (SP.ManagedPtr BytesIcon)
deriving (BytesIcon -> BytesIcon -> Bool
(BytesIcon -> BytesIcon -> Bool)
-> (BytesIcon -> BytesIcon -> Bool) -> Eq BytesIcon
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BytesIcon -> BytesIcon -> Bool
== :: BytesIcon -> BytesIcon -> Bool
$c/= :: BytesIcon -> BytesIcon -> Bool
/= :: BytesIcon -> BytesIcon -> Bool
Eq)
instance SP.ManagedPtrNewtype BytesIcon where
toManagedPtr :: BytesIcon -> ManagedPtr BytesIcon
toManagedPtr (BytesIcon ManagedPtr BytesIcon
p) = ManagedPtr BytesIcon
p
foreign import ccall "g_bytes_icon_get_type"
c_g_bytes_icon_get_type :: IO B.Types.GType
instance B.Types.TypedObject BytesIcon where
glibType :: IO GType
glibType = IO GType
c_g_bytes_icon_get_type
instance B.Types.GObject BytesIcon
class (SP.GObject o, O.IsDescendantOf BytesIcon o) => IsBytesIcon o
instance (SP.GObject o, O.IsDescendantOf BytesIcon o) => IsBytesIcon o
instance O.HasParentTypes BytesIcon
type instance O.ParentTypes BytesIcon = '[GObject.Object.Object, Gio.Icon.Icon, Gio.LoadableIcon.LoadableIcon]
toBytesIcon :: (MIO.MonadIO m, IsBytesIcon o) => o -> m BytesIcon
toBytesIcon :: forall (m :: * -> *) o.
(MonadIO m, IsBytesIcon o) =>
o -> m BytesIcon
toBytesIcon = IO BytesIcon -> m BytesIcon
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO BytesIcon -> m BytesIcon)
-> (o -> IO BytesIcon) -> o -> m BytesIcon
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr BytesIcon -> BytesIcon) -> o -> IO BytesIcon
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr BytesIcon -> BytesIcon
BytesIcon
instance B.GValue.IsGValue (Maybe BytesIcon) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_g_bytes_icon_get_type
gvalueSet_ :: Ptr GValue -> Maybe BytesIcon -> IO ()
gvalueSet_ Ptr GValue
gv Maybe BytesIcon
P.Nothing = Ptr GValue -> Ptr BytesIcon -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr BytesIcon
forall a. Ptr a
FP.nullPtr :: FP.Ptr BytesIcon)
gvalueSet_ Ptr GValue
gv (P.Just BytesIcon
obj) = BytesIcon -> (Ptr BytesIcon -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr BytesIcon
obj (Ptr GValue -> Ptr BytesIcon -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe BytesIcon)
gvalueGet_ Ptr GValue
gv = do
ptr <- Ptr GValue -> IO (Ptr BytesIcon)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr BytesIcon)
if ptr /= FP.nullPtr
then P.Just <$> B.ManagedPtr.newObject BytesIcon ptr
else return P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveBytesIconMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveBytesIconMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveBytesIconMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveBytesIconMethod "equal" o = Gio.Icon.IconEqualMethodInfo
ResolveBytesIconMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveBytesIconMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveBytesIconMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveBytesIconMethod "hash" o = Gio.Icon.IconHashMethodInfo
ResolveBytesIconMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveBytesIconMethod "load" o = Gio.LoadableIcon.LoadableIconLoadMethodInfo
ResolveBytesIconMethod "loadAsync" o = Gio.LoadableIcon.LoadableIconLoadAsyncMethodInfo
ResolveBytesIconMethod "loadFinish" o = Gio.LoadableIcon.LoadableIconLoadFinishMethodInfo
ResolveBytesIconMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveBytesIconMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveBytesIconMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveBytesIconMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveBytesIconMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveBytesIconMethod "serialize" o = Gio.Icon.IconSerializeMethodInfo
ResolveBytesIconMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveBytesIconMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveBytesIconMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveBytesIconMethod "toString" o = Gio.Icon.IconToStringMethodInfo
ResolveBytesIconMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveBytesIconMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveBytesIconMethod "getBytes" o = BytesIconGetBytesMethodInfo
ResolveBytesIconMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveBytesIconMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveBytesIconMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveBytesIconMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveBytesIconMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveBytesIconMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveBytesIconMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveBytesIconMethod t BytesIcon, O.OverloadedMethod info BytesIcon p) => OL.IsLabel t (BytesIcon -> 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 ~ ResolveBytesIconMethod t BytesIcon, O.OverloadedMethod info BytesIcon p, R.HasField t BytesIcon p) => R.HasField t BytesIcon p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveBytesIconMethod t BytesIcon, O.OverloadedMethodInfo info BytesIcon) => OL.IsLabel t (O.MethodProxy info BytesIcon) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
getBytesIconBytes :: (MonadIO m, IsBytesIcon o) => o -> m GLib.Bytes.Bytes
getBytesIconBytes :: forall (m :: * -> *) o. (MonadIO m, IsBytesIcon o) => o -> m Bytes
getBytesIconBytes o
obj = IO Bytes -> m Bytes
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Bytes -> m Bytes) -> IO Bytes -> m Bytes
forall a b. (a -> b) -> a -> b
$ Text -> IO (Maybe Bytes) -> IO Bytes
forall a. HasCallStack => Text -> IO (Maybe a) -> IO a
checkUnexpectedNothing Text
"getBytesIconBytes" (IO (Maybe Bytes) -> IO Bytes) -> IO (Maybe Bytes) -> IO Bytes
forall a b. (a -> b) -> a -> b
$ o -> String -> (ManagedPtr Bytes -> Bytes) -> IO (Maybe Bytes)
forall a b.
(GObject a, GBoxed b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyBoxed o
obj String
"bytes" ManagedPtr Bytes -> Bytes
GLib.Bytes.Bytes
constructBytesIconBytes :: (IsBytesIcon o, MIO.MonadIO m) => GLib.Bytes.Bytes -> m (GValueConstruct o)
constructBytesIconBytes :: forall o (m :: * -> *).
(IsBytesIcon o, MonadIO m) =>
Bytes -> m (GValueConstruct o)
constructBytesIconBytes Bytes
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe Bytes -> IO (GValueConstruct o)
forall a o. GBoxed a => String -> Maybe a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyBoxed String
"bytes" (Bytes -> Maybe Bytes
forall a. a -> Maybe a
P.Just Bytes
val)
#if defined(ENABLE_OVERLOADING)
data BytesIconBytesPropertyInfo
instance AttrInfo BytesIconBytesPropertyInfo where
type AttrAllowedOps BytesIconBytesPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrBaseTypeConstraint BytesIconBytesPropertyInfo = IsBytesIcon
type AttrSetTypeConstraint BytesIconBytesPropertyInfo = (~) GLib.Bytes.Bytes
type AttrTransferTypeConstraint BytesIconBytesPropertyInfo = (~) GLib.Bytes.Bytes
type AttrTransferType BytesIconBytesPropertyInfo = GLib.Bytes.Bytes
type AttrGetType BytesIconBytesPropertyInfo = GLib.Bytes.Bytes
type AttrLabel BytesIconBytesPropertyInfo = "bytes"
type AttrOrigin BytesIconBytesPropertyInfo = BytesIcon
attrGet = getBytesIconBytes
attrSet = undefined
attrTransfer _ v = do
return v
attrConstruct = constructBytesIconBytes
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.BytesIcon.bytes"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-BytesIcon.html#g:attr:bytes"
})
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList BytesIcon
type instance O.AttributeList BytesIcon = BytesIconAttributeList
type BytesIconAttributeList = ('[ '("bytes", BytesIconBytesPropertyInfo)] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
bytesIconBytes :: AttrLabelProxy "bytes"
bytesIconBytes = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList BytesIcon = BytesIconSignalList
type BytesIconSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "g_bytes_icon_new" g_bytes_icon_new ::
Ptr GLib.Bytes.Bytes ->
IO (Ptr BytesIcon)
bytesIconNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
GLib.Bytes.Bytes
-> m BytesIcon
bytesIconNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Bytes -> m BytesIcon
bytesIconNew Bytes
bytes = IO BytesIcon -> m BytesIcon
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO BytesIcon -> m BytesIcon) -> IO BytesIcon -> m BytesIcon
forall a b. (a -> b) -> a -> b
$ do
bytes' <- Bytes -> IO (Ptr Bytes)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Bytes
bytes
result <- g_bytes_icon_new bytes'
checkUnexpectedReturnNULL "bytesIconNew" result
result' <- (wrapObject BytesIcon) result
touchManagedPtr bytes
return result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_bytes_icon_get_bytes" g_bytes_icon_get_bytes ::
Ptr BytesIcon ->
IO (Ptr GLib.Bytes.Bytes)
bytesIconGetBytes ::
(B.CallStack.HasCallStack, MonadIO m, IsBytesIcon a) =>
a
-> m GLib.Bytes.Bytes
bytesIconGetBytes :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsBytesIcon a) =>
a -> m Bytes
bytesIconGetBytes a
icon = IO Bytes -> m Bytes
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bytes -> m Bytes) -> IO Bytes -> m Bytes
forall a b. (a -> b) -> a -> b
$ do
icon' <- a -> IO (Ptr BytesIcon)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
icon
result <- g_bytes_icon_get_bytes icon'
checkUnexpectedReturnNULL "bytesIconGetBytes" result
result' <- (newBoxed GLib.Bytes.Bytes) result
touchManagedPtr icon
return result'
#if defined(ENABLE_OVERLOADING)
data BytesIconGetBytesMethodInfo
instance (signature ~ (m GLib.Bytes.Bytes), MonadIO m, IsBytesIcon a) => O.OverloadedMethod BytesIconGetBytesMethodInfo a signature where
overloadedMethod = bytesIconGetBytes
instance O.OverloadedMethodInfo BytesIconGetBytesMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.BytesIcon.bytesIconGetBytes",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-BytesIcon.html#v:bytesIconGetBytes"
})
#endif