Package: gobject

VTable gobject:object-vtable

Declaration

(gobject:define-vtable ("GObject" object)
  ;; Class type
  (type-class (:pointer (:struct type-class)))
  ;; Private
  (construct-properties :pointer)
  ;; Virtual functions
  (constructor  (g:object
                 (type g:type-t)
                 (n-construct-properties :uint)
                 (construct-properties :pointer)))
  (set-property (:void
                 (object g:object)
                 (property-id :uint)
                 (value (:pointer (:struct g:value)))
                 (pspec g:param-spec)))
  (get-property (:void
                 (object g:object)
                 (property-id :uint)
                 (value (:pointer (:struct g:value)))
                 (pspec g:param-spec)))
  (dispose      (:void (object g:object)))
  (finalize     (:void (object g:object)))
  (dispatch-properties-changed
                (:void
                 (object g:object)
                 (n-pspecs :uint)
                 (pspecs (:pointer g:param-spec))))
  (notify       (:void (object g:object) (pspec g:param-spec)))
  (constructed  (:void (object g:object))))  

Details

This is a prototype of a virtual function table for an object that is subclassed from the g:object class.

Examples

This is the installation of a virtual function table for an object class. The dispose and finalize virtual functions are overridden with the my-object-dispose-impl and my-object-finalize-impl methods, respectively. The :after keyword means that the new methods are chained up and called after the default implementation.
(gobject:define-gobject-subclass "MyObject" my-object
  (:superclass g:object
   :export nil
   :interfaces ())
  nil)

(gobject:define-vtable ("MyObject" my-object) ;; Class type (:skip type-class (:pointer (:struct g:type-class))) ;; Private (:skip construct-properties :pointer) ;; Virtual functions (:skip constructor :pointer) (:skip set-property :pointer) (:skip get-property :pointer) (dispose (:void (object (g:object my-object))) :chained :after) (finalize (:void (object (g:object my-object))) :chained :after) (:skip dispatch-properties-changed :pointer) (:skip notify :pointer) (:skip constructed :pointer))

(defmethod my-object-dispose-impl ((object my-object)) ... )

(defmethod my-object-finalize-impl ((object my-object)) ... )
 

See also

2025-12-21