{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gtk.Objects.Filter
(
Filter(..) ,
IsFilter ,
toFilter ,
#if defined(ENABLE_OVERLOADING)
ResolveFilterMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
FilterChangedMethodInfo ,
#endif
filterChanged ,
#if defined(ENABLE_OVERLOADING)
FilterGetStrictnessMethodInfo ,
#endif
filterGetStrictness ,
#if defined(ENABLE_OVERLOADING)
FilterMatchMethodInfo ,
#endif
filterMatch ,
C_FilterChangedCallback ,
FilterChangedCallback ,
#if defined(ENABLE_OVERLOADING)
FilterChangedSignalInfo ,
#endif
afterFilterChanged ,
genClosure_FilterChanged ,
mk_FilterChangedCallback ,
noFilterChangedCallback ,
onFilterChanged ,
wrap_FilterChangedCallback ,
) 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.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 GHC.Records as R
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gtk.Enums as Gtk.Enums
newtype Filter = Filter (SP.ManagedPtr Filter)
deriving (Filter -> Filter -> Bool
(Filter -> Filter -> Bool)
-> (Filter -> Filter -> Bool) -> Eq Filter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Filter -> Filter -> Bool
$c/= :: Filter -> Filter -> Bool
== :: Filter -> Filter -> Bool
$c== :: Filter -> Filter -> Bool
Eq)
instance SP.ManagedPtrNewtype Filter where
toManagedPtr :: Filter -> ManagedPtr Filter
toManagedPtr (Filter ManagedPtr Filter
p) = ManagedPtr Filter
p
foreign import ccall "gtk_filter_get_type"
c_gtk_filter_get_type :: IO B.Types.GType
instance B.Types.TypedObject Filter where
glibType :: IO GType
glibType = IO GType
c_gtk_filter_get_type
instance B.Types.GObject Filter
class (SP.GObject o, O.IsDescendantOf Filter o) => IsFilter o
instance (SP.GObject o, O.IsDescendantOf Filter o) => IsFilter o
instance O.HasParentTypes Filter
type instance O.ParentTypes Filter = '[GObject.Object.Object]
toFilter :: (MIO.MonadIO m, IsFilter o) => o -> m Filter
toFilter :: forall (m :: * -> *) o. (MonadIO m, IsFilter o) => o -> m Filter
toFilter = IO Filter -> m Filter
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Filter -> m Filter) -> (o -> IO Filter) -> o -> m Filter
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Filter -> Filter) -> o -> IO Filter
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Filter -> Filter
Filter
instance B.GValue.IsGValue (Maybe Filter) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gtk_filter_get_type
gvalueSet_ :: Ptr GValue -> Maybe Filter -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Filter
P.Nothing = Ptr GValue -> Ptr Filter -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr Filter
forall a. Ptr a
FP.nullPtr :: FP.Ptr Filter)
gvalueSet_ Ptr GValue
gv (P.Just Filter
obj) = Filter -> (Ptr Filter -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Filter
obj (Ptr GValue -> Ptr Filter -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe Filter)
gvalueGet_ Ptr GValue
gv = do
Ptr Filter
ptr <- Ptr GValue -> IO (Ptr Filter)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr Filter)
if Ptr Filter
ptr Ptr Filter -> Ptr Filter -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Filter
forall a. Ptr a
FP.nullPtr
then Filter -> Maybe Filter
forall a. a -> Maybe a
P.Just (Filter -> Maybe Filter) -> IO Filter -> IO (Maybe Filter)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr Filter -> Filter) -> Ptr Filter -> IO Filter
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Filter -> Filter
Filter Ptr Filter
ptr
else Maybe Filter -> IO (Maybe Filter)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Filter
forall a. Maybe a
P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveFilterMethod (t :: Symbol) (o :: *) :: * where
ResolveFilterMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveFilterMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveFilterMethod "changed" o = FilterChangedMethodInfo
ResolveFilterMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveFilterMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveFilterMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveFilterMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveFilterMethod "match" o = FilterMatchMethodInfo
ResolveFilterMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveFilterMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveFilterMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveFilterMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveFilterMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveFilterMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveFilterMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveFilterMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveFilterMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveFilterMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveFilterMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveFilterMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveFilterMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveFilterMethod "getStrictness" o = FilterGetStrictnessMethodInfo
ResolveFilterMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveFilterMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveFilterMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveFilterMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveFilterMethod t Filter, O.OverloadedMethod info Filter p) => OL.IsLabel t (Filter -> 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 ~ ResolveFilterMethod t Filter, O.OverloadedMethod info Filter p, R.HasField t Filter p) => R.HasField t Filter p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveFilterMethod t Filter, O.OverloadedMethodInfo info Filter) => OL.IsLabel t (O.MethodProxy info Filter) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
type FilterChangedCallback =
Gtk.Enums.FilterChange
-> IO ()
noFilterChangedCallback :: Maybe FilterChangedCallback
noFilterChangedCallback :: Maybe FilterChangedCallback
noFilterChangedCallback = Maybe FilterChangedCallback
forall a. Maybe a
Nothing
type C_FilterChangedCallback =
Ptr () ->
CUInt ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mk_FilterChangedCallback :: C_FilterChangedCallback -> IO (FunPtr C_FilterChangedCallback)
genClosure_FilterChanged :: MonadIO m => FilterChangedCallback -> m (GClosure C_FilterChangedCallback)
genClosure_FilterChanged :: forall (m :: * -> *).
MonadIO m =>
FilterChangedCallback -> m (GClosure C_FilterChangedCallback)
genClosure_FilterChanged FilterChangedCallback
cb = IO (GClosure C_FilterChangedCallback)
-> m (GClosure C_FilterChangedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_FilterChangedCallback)
-> m (GClosure C_FilterChangedCallback))
-> IO (GClosure C_FilterChangedCallback)
-> m (GClosure C_FilterChangedCallback)
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_FilterChangedCallback
cb' = FilterChangedCallback -> C_FilterChangedCallback
wrap_FilterChangedCallback FilterChangedCallback
cb
C_FilterChangedCallback -> IO (FunPtr C_FilterChangedCallback)
mk_FilterChangedCallback C_FilterChangedCallback
cb' IO (FunPtr C_FilterChangedCallback)
-> (FunPtr C_FilterChangedCallback
-> IO (GClosure C_FilterChangedCallback))
-> IO (GClosure C_FilterChangedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_FilterChangedCallback
-> IO (GClosure C_FilterChangedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure
wrap_FilterChangedCallback ::
FilterChangedCallback ->
C_FilterChangedCallback
wrap_FilterChangedCallback :: FilterChangedCallback -> C_FilterChangedCallback
wrap_FilterChangedCallback FilterChangedCallback
_cb Ptr ()
_ CUInt
change Ptr ()
_ = do
let change' :: FilterChange
change' = (Int -> FilterChange
forall a. Enum a => Int -> a
toEnum (Int -> FilterChange) -> (CUInt -> Int) -> CUInt -> FilterChange
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
change
FilterChangedCallback
_cb FilterChange
change'
onFilterChanged :: (IsFilter a, MonadIO m) => a -> FilterChangedCallback -> m SignalHandlerId
onFilterChanged :: forall a (m :: * -> *).
(IsFilter a, MonadIO m) =>
a -> FilterChangedCallback -> m SignalHandlerId
onFilterChanged a
obj FilterChangedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_FilterChangedCallback
cb' = FilterChangedCallback -> C_FilterChangedCallback
wrap_FilterChangedCallback FilterChangedCallback
cb
FunPtr C_FilterChangedCallback
cb'' <- C_FilterChangedCallback -> IO (FunPtr C_FilterChangedCallback)
mk_FilterChangedCallback C_FilterChangedCallback
cb'
a
-> Text
-> FunPtr C_FilterChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"changed" FunPtr C_FilterChangedCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing
afterFilterChanged :: (IsFilter a, MonadIO m) => a -> FilterChangedCallback -> m SignalHandlerId
afterFilterChanged :: forall a (m :: * -> *).
(IsFilter a, MonadIO m) =>
a -> FilterChangedCallback -> m SignalHandlerId
afterFilterChanged a
obj FilterChangedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_FilterChangedCallback
cb' = FilterChangedCallback -> C_FilterChangedCallback
wrap_FilterChangedCallback FilterChangedCallback
cb
FunPtr C_FilterChangedCallback
cb'' <- C_FilterChangedCallback -> IO (FunPtr C_FilterChangedCallback)
mk_FilterChangedCallback C_FilterChangedCallback
cb'
a
-> Text
-> FunPtr C_FilterChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"changed" FunPtr C_FilterChangedCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
data FilterChangedSignalInfo
instance SignalInfo FilterChangedSignalInfo where
type HaskellCallbackType FilterChangedSignalInfo = FilterChangedCallback
connectSignal obj cb connectMode detail = do
let cb' = wrap_FilterChangedCallback cb
cb'' <- mk_FilterChangedCallback cb'
connectSignalFunPtr obj "changed" cb'' connectMode detail
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Filter
type instance O.AttributeList Filter = FilterAttributeList
type FilterAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Filter = FilterSignalList
type FilterSignalList = ('[ '("changed", FilterChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "gtk_filter_changed" gtk_filter_changed ::
Ptr Filter ->
CUInt ->
IO ()
filterChanged ::
(B.CallStack.HasCallStack, MonadIO m, IsFilter a) =>
a
-> Gtk.Enums.FilterChange
-> m ()
filterChanged :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFilter a) =>
a -> FilterChange -> m ()
filterChanged a
self FilterChange
change = 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 Filter
self' <- a -> IO (Ptr Filter)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
let change' :: CUInt
change' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (FilterChange -> Int) -> FilterChange -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FilterChange -> Int
forall a. Enum a => a -> Int
fromEnum) FilterChange
change
Ptr Filter -> CUInt -> IO ()
gtk_filter_changed Ptr Filter
self' CUInt
change'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data FilterChangedMethodInfo
instance (signature ~ (Gtk.Enums.FilterChange -> m ()), MonadIO m, IsFilter a) => O.OverloadedMethod FilterChangedMethodInfo a signature where
overloadedMethod = filterChanged
instance O.OverloadedMethodInfo FilterChangedMethodInfo a where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Gtk.Objects.Filter.filterChanged",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gtk-4.0.4/docs/GI-Gtk-Objects-Filter.html#v:filterChanged"
}
#endif
foreign import ccall "gtk_filter_get_strictness" gtk_filter_get_strictness ::
Ptr Filter ->
IO CUInt
filterGetStrictness ::
(B.CallStack.HasCallStack, MonadIO m, IsFilter a) =>
a
-> m Gtk.Enums.FilterMatch
filterGetStrictness :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFilter a) =>
a -> m FilterMatch
filterGetStrictness a
self = IO FilterMatch -> m FilterMatch
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FilterMatch -> m FilterMatch)
-> IO FilterMatch -> m FilterMatch
forall a b. (a -> b) -> a -> b
$ do
Ptr Filter
self' <- a -> IO (Ptr Filter)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
CUInt
result <- Ptr Filter -> IO CUInt
gtk_filter_get_strictness Ptr Filter
self'
let result' :: FilterMatch
result' = (Int -> FilterMatch
forall a. Enum a => Int -> a
toEnum (Int -> FilterMatch) -> (CUInt -> Int) -> CUInt -> FilterMatch
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
FilterMatch -> IO FilterMatch
forall (m :: * -> *) a. Monad m => a -> m a
return FilterMatch
result'
#if defined(ENABLE_OVERLOADING)
data FilterGetStrictnessMethodInfo
instance (signature ~ (m Gtk.Enums.FilterMatch), MonadIO m, IsFilter a) => O.OverloadedMethod FilterGetStrictnessMethodInfo a signature where
overloadedMethod = filterGetStrictness
instance O.OverloadedMethodInfo FilterGetStrictnessMethodInfo a where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Gtk.Objects.Filter.filterGetStrictness",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gtk-4.0.4/docs/GI-Gtk-Objects-Filter.html#v:filterGetStrictness"
}
#endif
foreign import ccall "gtk_filter_match" gtk_filter_match ::
Ptr Filter ->
Ptr GObject.Object.Object ->
IO CInt
filterMatch ::
(B.CallStack.HasCallStack, MonadIO m, IsFilter a, GObject.Object.IsObject b) =>
a
-> b
-> m Bool
filterMatch :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsFilter a, IsObject b) =>
a -> b -> m Bool
filterMatch a
self b
item = 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 Filter
self' <- a -> IO (Ptr Filter)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
Ptr Object
item' <- b -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
item
CInt
result <- Ptr Filter -> Ptr Object -> IO CInt
gtk_filter_match Ptr Filter
self' Ptr Object
item'
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
self
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
item
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data FilterMatchMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsFilter a, GObject.Object.IsObject b) => O.OverloadedMethod FilterMatchMethodInfo a signature where
overloadedMethod = filterMatch
instance O.OverloadedMethodInfo FilterMatchMethodInfo a where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Gtk.Objects.Filter.filterMatch",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gtk-4.0.4/docs/GI-Gtk-Objects-Filter.html#v:filterMatch"
}
#endif