Class TypeClass
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
ActivateAction.ActivateActionClass
,Adapter.AdapterClass
,AlternativeTrigger.AlternativeTriggerClass
,Animation.AnimationClass
,AnimationTarget.AnimationTargetClass
,AnyFilter.AnyFilterClass
,ATContext.ATContextClass
,BroadwayRenderer.BroadwayRendererClass
,BuilderListItemFactory.BuilderListItemFactoryClass
,CairoRenderer.CairoRendererClass
,CallbackAction.CallbackActionClass
,CallbackAnimationTarget.CallbackAnimationTargetClass
,CenterBox.CenterBoxClass
,CicpParams.CicpParamsClass
,ColumnView.ColumnViewClass
,ColumnViewCell.ColumnViewCellClass
,ColumnViewColumn.ColumnViewColumnClass
,ColumnViewRow.ColumnViewRowClass
,Context.ContextClass
,Credentials.CredentialsClass
,CssProvider.CssProviderClass
,DeviceProviderFactory.DeviceProviderFactoryClass
,DmabufTexture.DmabufTextureClass
,DmabufTextureBuilder.DmabufTextureBuilderClass
,DragSource.DragSourceClass
,DropControllerMotion.DropControllerMotionClass
,DropTarget.DropTargetClass
,DropTargetAsync.DropTargetAsyncClass
,DynamicTypeFactory.DynamicTypeFactoryClass
,ElementFactory.ElementFactoryClass
,Emblem.EmblemClass
,EmojiChooser.EmojiChooserClass
,EventController.EventControllerClass
,EventControllerFocus.EventControllerFocusClass
,EventControllerKey.EventControllerKeyClass
,EventControllerLegacy.EventControllerLegacyClass
,EventControllerMotion.EventControllerMotionClass
,EventControllerScroll.EventControllerScrollClass
,EveryFilter.EveryFilterClass
,FileIcon.FileIconClass
,FileInfo.FileInfoClass
,FontsetSimple.FontsetSimpleClass
,FrameClock.FrameClockClass
,Gesture.GestureClass
,GestureClick.GestureClickClass
,GestureDrag.GestureDragClass
,GestureLongPress.GestureLongPressClass
,GesturePan.GesturePanClass
,GestureRotate.GestureRotateClass
,GestureSingle.GestureSingleClass
,GestureStylus.GestureStylusClass
,GestureSwipe.GestureSwipeClass
,GestureZoom.GestureZoomClass
,GLRenderer.GLRendererClass
,GLTexture.GLTextureClass
,GLTextureBuilder.GLTextureBuilderClass
,GObject.ObjectClass
,GridView.GridViewClass
,GtkBuilder.BuilderClass
,IOModule.IOModuleClass
,KeyvalTrigger.KeyvalTriggerClass
,Layout.LayoutClass
,ListBase.ListBaseClass
,ListHeader.ListHeaderClass
,ListItem.ListItemClass
,ListItemFactory.ListItemFactoryClass
,ListView.ListViewClass
,MemoryTexture.MemoryTextureClass
,MemoryTextureBuilder.MemoryTextureBuilderClass
,MessageDialog.MessageDialogClass
,MnemonicAction.MnemonicActionClass
,MnemonicTrigger.MnemonicTriggerClass
,Monitor.MonitorClass
,MultiFilter.MultiFilterClass
,NamedAction.NamedActionClass
,NeverTrigger.NeverTriggerClass
,NothingAction.NothingActionClass
,PadController.PadControllerClass
,ParamSpec.ParamSpecClass
,PasswordEntry.PasswordEntryClass
,PixbufSimpleAnim.PixbufSimpleAnimClass
,Plugin.PluginClass
,PluginFeature.PluginFeatureClass
,PropertyAnimationTarget.PropertyAnimationTargetClass
,Renderer.RendererClass
,ShortcutAction.ShortcutActionClass
,ShortcutController.ShortcutControllerClass
,ShortcutLabel.ShortcutLabelClass
,ShortcutsGroup.ShortcutsGroupClass
,ShortcutsSection.ShortcutsSectionClass
,ShortcutsShortcut.ShortcutsShortcutClass
,ShortcutTrigger.ShortcutTriggerClass
,SignalAction.SignalActionClass
,SignalListItemFactory.SignalListItemFactoryClass
,SimpleAsyncResult.SimpleAsyncResultClass
,Snapshot.SnapshotClass
,Snapshot.SnapshotClass
,SpringAnimation.SpringAnimationClass
,Surface.SurfaceClass
,Task.TaskClass
,Texture.TextureClass
,ThemedIcon.ThemedIconClass
,TimedAnimation.TimedAnimationClass
,TracerFactory.TracerFactoryClass
,TracerRecord.TracerRecordClass
,TypeFindFactory.TypeFindFactoryClass
,UnixMountMonitor.UnixMountMonitorClass
,VulkanRenderer.VulkanRendererClass
-
Constructor Summary
ConstructorDescriptionAllocate a new TypeClass.Allocate a new TypeClass.TypeClass
(MemorySegment address) Create a TypeClass proxy instance for the provided memory address.Allocate a new TypeClass with the fields set to the provided values.Allocate a new TypeClass with the fields set to the provided values. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPrivate
(long privateSize) Deprecated.static void
adjustPrivateOffset
(@Nullable MemorySegment gClass, MemorySegment privateSizeOrOffset) int
Gets the offset of the private data for instances of this TypeClass.static MemoryLayout
The memory layout of the native struct.getPrivate
(Type privateType) static TypeClass
This function is essentially the same as g_type_class_ref(), except that the classes reference count isn't incremented.This is a convenience function often needed in class initializers.static TypeClass
peekStatic
(Type type) A more efficient version of g_type_class_peek() which works only for static types.Read the value of the fieldg_type
.static TypeClass
Increments the reference count of the class structure belonging totype
.void
unref()
Decrements the reference count of the class structure being passed in.void
A variant of g_type_class_unref() for use inGTypeClassCacheFunc
implementations.void
writeGType
(Type gType) Write a value in the fieldg_type
.Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
TypeClass
Create a TypeClass proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
TypeClass
Allocate a new TypeClass.- Parameters:
arena
- to control the memory allocation scope
-
TypeClass
public TypeClass()Allocate a new TypeClass. The memory is allocated withArena.ofAuto()
. -
TypeClass
-
TypeClass
Allocate a new TypeClass with the fields set to the provided values. The memory is allocated withArena.ofAuto()
.- Parameters:
gType
- value for the fieldgType
-
-
Method Details
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readGType
-
writeGType
Write a value in the fieldg_type
.- Parameters:
gType
- The new value for the fieldg_type
-
adjustPrivateOffset
public static void adjustPrivateOffset(@Nullable @Nullable MemorySegment gClass, MemorySegment privateSizeOrOffset) -
peek
This function is essentially the same as g_type_class_ref(), except that the classes reference count isn't incremented. As a consequence, this function may returnnull
if the class of the type passed in does not currently exist (hasn't been referenced before).- Parameters:
type
- type ID of a classed type- Returns:
- the
GTypeClass
structure for the given type ID ornull
if the class does not currently exist
-
peekStatic
A more efficient version of g_type_class_peek() which works only for static types.- Parameters:
type
- type ID of a classed type- Returns:
- the
GTypeClass
structure for the given type ID ornull
if the class does not currently exist or is dynamically loaded
-
ref
-
addPrivate
Deprecated.Use the G_ADD_PRIVATE() macro with theG_DEFINE_*
family of macros to add instance private data to a typeRegisters a private structure for an instantiatable type.When an object is allocated, the private structures for the type and all of its parent types are allocated sequentially in the same memory block as the public structures, and are zero-filled.
Note that the accumulated size of the private structures of a type and all its parent types cannot exceed 64 KiB.
This function should be called in the type's class_init() function. The private structure can be retrieved using the G_TYPE_INSTANCE_GET_PRIVATE() macro.
The following example shows attaching a private structure MyObjectPrivate to an object MyObject defined in the standard GObject fashion in the type's class_init() function.
Note the use of a structure member "priv" to avoid the overhead of repeatedly calling MY_OBJECT_GET_PRIVATE().
typedef struct _MyObject MyObject; typedef struct _MyObjectPrivate MyObjectPrivate; struct _MyObject { GObject parent; MyObjectPrivate *priv; }; struct _MyObjectPrivate { int some_field; }; static void my_object_class_init (MyObjectClass *klass) { g_type_class_add_private (klass, sizeof (MyObjectPrivate)); } static void my_object_init (MyObject *my_object) { my_object->priv = G_TYPE_INSTANCE_GET_PRIVATE (my_object, MY_TYPE_OBJECT, MyObjectPrivate); // my_object->priv->some_field will be automatically initialised to 0 } static int my_object_get_some_field (MyObject *my_object) { MyObjectPrivate *priv; g_return_val_if_fail (MY_IS_OBJECT (my_object), 0); priv = my_object->priv; return priv->some_field; }
- Parameters:
privateSize
- size of private structure
-
getInstancePrivateOffset
public int getInstancePrivateOffset()Gets the offset of the private data for instances of this TypeClass.This is how many bytes you should add to the instance pointer of a class in order to get the private data for the type represented by this TypeClass.
You can only call this function after you have registered a private data area for this TypeClass using g_type_class_add_private().
- Returns:
- the offset, in bytes
-
getPrivate
-
peekParent
This is a convenience function often needed in class initializers. It returns the class structure of the immediate parent type of the class passed in. Since derived classes hold a reference count on their parent classes as long as they are instantiated, the returned class will always exist.This function is essentially equivalent to: g_type_class_peek (g_type_parent (G_TYPE_FROM_CLASS (g_class)))
- Returns:
- the parent class of this TypeClass
-
unref
public void unref()Decrements the reference count of the class structure being passed in. Once the last reference count of a class has been released, classes may be finalized by the type system, so further dereferencing of a class pointer after g_type_class_unref() are invalid. -
unrefUncached
public void unrefUncached()A variant of g_type_class_unref() for use inGTypeClassCacheFunc
implementations. It unreferences a class without consulting the chain ofGTypeClassCacheFuncs
, avoiding the recursion which would occur otherwise.
-
G_DEFINE_*
family of macros to add instance private data to a type