Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- newtype Class = Class (ManagedPtr Class)
- class (GObject o, IsDescendantOf Class o) => IsClass o
- toClass :: (MonadIO m, IsClass o) => o -> m Class
- classAddConstructor :: (HasCallStack, MonadIO m, IsClass a) => a -> Maybe Text -> Callback -> GType -> Maybe [GType] -> m Value
- classAddConstructorVariadic :: (HasCallStack, MonadIO m, IsClass a) => a -> Maybe Text -> Callback -> GType -> m Value
- classAddMethod :: (HasCallStack, MonadIO m, IsClass a) => a -> Text -> Callback -> GType -> Maybe [GType] -> m ()
- classAddMethodVariadic :: (HasCallStack, MonadIO m, IsClass a) => a -> Text -> Callback -> GType -> m ()
- classAddProperty :: (HasCallStack, MonadIO m, IsClass a) => a -> Text -> GType -> Maybe Callback -> Maybe Callback -> m ()
- classGetName :: (HasCallStack, MonadIO m, IsClass a) => a -> m Text
- classGetParent :: (HasCallStack, MonadIO m, IsClass a) => a -> m Class
- constructClassContext :: (IsClass o, MonadIO m, IsContext a) => a -> m (GValueConstruct o)
- constructClassName :: (IsClass o, MonadIO m) => Text -> m (GValueConstruct o)
- getClassName :: (MonadIO m, IsClass o) => o -> m Text
- constructClassParent :: (IsClass o, MonadIO m, IsClass a) => a -> m (GValueConstruct o)
- getClassParent :: (MonadIO m, IsClass o) => o -> m Class
Exported types
Memory-managed wrapper type.
Instances
Eq Class Source # | |
GObject Class Source # | |
Defined in GI.JavaScriptCore.Objects.Class | |
ManagedPtrNewtype Class Source # | |
Defined in GI.JavaScriptCore.Objects.Class toManagedPtr :: Class -> ManagedPtr Class | |
TypedObject Class Source # | |
Defined in GI.JavaScriptCore.Objects.Class | |
HasParentTypes Class Source # | |
Defined in GI.JavaScriptCore.Objects.Class | |
IsGValue (Maybe Class) Source # | Convert |
Defined in GI.JavaScriptCore.Objects.Class gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Class -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Class) | |
type ParentTypes Class Source # | |
Defined in GI.JavaScriptCore.Objects.Class type ParentTypes Class = '[Object] |
class (GObject o, IsDescendantOf Class o) => IsClass o Source #
Instances
(GObject o, IsDescendantOf Class o) => IsClass o Source # | |
Defined in GI.JavaScriptCore.Objects.Class |
Methods
Click to display all available methods, including inherited ones
Methods
addConstructor, addConstructorVariadic, addMethod, addMethodVariadic, addProperty, bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getData, getName, getParent, getProperty, getQdata.
Setters
addConstructor
:: (HasCallStack, MonadIO m, IsClass a) | |
=> a |
|
-> Maybe Text |
|
-> Callback |
|
-> GType |
|
-> Maybe [GType] |
|
-> m Value | Returns: a |
Add a constructor to jscClass
. If name
is Nothing
, the class name will be used. When <function>new</function>
is used with the constructor or jsc_value_constructor_call()
is called, callback
is invoked receiving the
parameters and userData
as the last parameter. When the constructor object is cleared in the Class
context,
destroyNotify
is called with userData
as parameter.
This function creates the constructor, which needs to be added to an object as a property to be able to use it. Use
contextSetValue
to make the constructor available in the global object.
Note that the value returned by callback
is adopted by jscClass
, and the DestroyNotify
passed to
contextRegisterClass
is responsible for disposing of it.
addConstructorVariadic
classAddConstructorVariadic Source #
:: (HasCallStack, MonadIO m, IsClass a) | |
=> a |
|
-> Maybe Text |
|
-> Callback |
|
-> GType |
|
-> m Value | Returns: a |
Add a constructor to jscClass
. If name
is Nothing
, the class name will be used. When <function>new</function>
is used with the constructor or jsc_value_constructor_call()
is called, callback
is invoked receiving
a PtrArray
of Value
s as arguments and userData
as the last parameter. When the constructor object
is cleared in the Class
context, destroyNotify
is called with userData
as parameter.
This function creates the constructor, which needs to be added to an object as a property to be able to use it. Use
contextSetValue
to make the constructor available in the global object.
Note that the value returned by callback
is adopted by jscClass
, and the DestroyNotify
passed to
contextRegisterClass
is responsible for disposing of it.
addMethod
:: (HasCallStack, MonadIO m, IsClass a) | |
=> a |
|
-> Text |
|
-> Callback |
|
-> GType |
|
-> Maybe [GType] |
|
-> m () |
Add method with name
to jscClass
. When the method is called by JavaScript or jsc_value_object_invoke_method()
,
callback
is called receiving the class instance as first parameter, followed by the method parameters and then
userData
as last parameter. When the method is cleared in the Class
context, destroyNotify
is called with
userData
as parameter.
Note that the value returned by callback
must be transfer full. In case of non-refcounted boxed types, you should use
G_TYPE_POINTER
instead of the actual boxed GType
to ensure that the instance owned by Class
is used.
If you really want to return a new copy of the boxed type, use JSC_TYPE_VALUE
and return a Value
created
with valueNewObject
that receives the copy as the instance parameter.
addMethodVariadic
classAddMethodVariadic Source #
:: (HasCallStack, MonadIO m, IsClass a) | |
=> a |
|
-> Text |
|
-> Callback |
|
-> GType |
|
-> m () |
Add method with name
to jscClass
. When the method is called by JavaScript or jsc_value_object_invoke_method()
,
callback
is called receiving the class instance as first parameter, followed by a PtrArray
of Value
s
with the method arguments and then userData
as last parameter. When the method is cleared in the Class
context,
destroyNotify
is called with userData
as parameter.
Note that the value returned by callback
must be transfer full. In case of non-refcounted boxed types, you should use
G_TYPE_POINTER
instead of the actual boxed GType
to ensure that the instance owned by Class
is used.
If you really want to return a new copy of the boxed type, use JSC_TYPE_VALUE
and return a Value
created
with valueNewObject
that receives the copy as the instance parameter.
addProperty
:: (HasCallStack, MonadIO m, IsClass a) | |
=> a |
|
-> Text |
|
-> GType |
|
-> Maybe Callback |
|
-> Maybe Callback |
|
-> m () |
Add a property with name
to jscClass
. When the property value needs to be getted, getter
is called
receiving the the class instance as first parameter and userData
as last parameter. When the property
value needs to be set, setter
is called receiving the the class instance as first parameter, followed
by the value to be set and then userData
as the last parameter. When the property is cleared in the
Class
context, destroyNotify
is called with userData
as parameter.
Note that the value returned by getter
must be transfer full. In case of non-refcounted boxed types, you should use
G_TYPE_POINTER
instead of the actual boxed GType
to ensure that the instance owned by Class
is used.
If you really want to return a new copy of the boxed type, use JSC_TYPE_VALUE
and return a Value
created
with valueNewObject
that receives the copy as the instance parameter.
getName
:: (HasCallStack, MonadIO m, IsClass a) | |
=> a |
|
-> m Text | Returns: the name of |
Get the class name of jscClass
getParent
:: (HasCallStack, MonadIO m, IsClass a) | |
=> a |
|
-> m Class | Returns: the parent class of |
Get the parent class of jscClass
Properties
context
The Context
in which the class was registered.
constructClassContext :: (IsClass o, MonadIO m, IsContext a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “context
” property. This is rarely needed directly, but it is used by new
.
name
The name of the class.
constructClassName :: (IsClass o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “name
” property. This is rarely needed directly, but it is used by new
.
getClassName :: (MonadIO m, IsClass o) => o -> m Text Source #
Get the value of the “name
” property.
When overloading is enabled, this is equivalent to
get
class #name
parent
The parent class or Nothing
in case of final classes.
constructClassParent :: (IsClass o, MonadIO m, IsClass a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “parent
” property. This is rarely needed directly, but it is used by new
.
getClassParent :: (MonadIO m, IsClass o) => o -> m Class Source #
Get the value of the “parent
” property.
When overloading is enabled, this is equivalent to
get
class #parent