Next: define-g-enum, Previous: define-g-object-class, Up: Generating type definitions by introspection
(define-g-interface g-type-name name (&key (export t) type-initializer) &body property*) property ::= (name accessor gname type readable writable) property ::= (:cffi name acessor type reader writer)
Parameters of define-g-interface
interface_get_type
.
Parameters of property
:
gobject-class
metaclass for information.
gobject-class
metaclass for information.
Macro that expands to defclass
for specified interface. Additionally, if export
is true, it exports accessor names and name of a interface.
Example:
(define-g-interface "GtkFileChooser" file-chooser
(:export t :type-initializer "gtk_file_chooser_get_type")
(do-overwrite-confirmation file-chooser-do-overwrite-confirmation "do-overwrite-confirmation" "gboolean" t t)
(select-multiple file-chooser-select-multiple "select-multiple" "gboolean" t t)
(filter file-chooser-filter "filter" "GtkFileFilter" t t)
(local-only file-chooser-local-only "local-only" "gboolean" t t)
(preview-widget file-chooser-preview-widget "preview-widget" "GtkWidget" t t)
(use-preview-label file-chooser-use-preview-label "use-preview-label" "gboolean" t t)
(preview-widget-active file-chooser-preview-widget-active "preview-widget-active" "gboolean" t t)
(file-system-backend file-chooser-file-system-backend "file-system-backend" "gchararray" nil nil)
(extra-widget file-chooser-extra-widget "extra-widget" "GtkWidget" t t)
(show-hidden file-chooser-show-hidden "show-hidden" "gboolean" t t)
(action file-chooser-action "action" "GtkFileChooserAction" t t)
(:cffi current-name file-chooser-current-name
(:string :free-to-foreign t :encoding :utf-8) nil "gtk_file_chooser_set_current_name")
(:cffi filename file-chooser-filename
(g-string :free-from-foreign t :free-to-foreign t)
"gtk_file_chooser_get_filename" "gtk_file_chooser_set_filename")
(:cffi current-folder file-chooser-current-folder
(g-string :free-from-foreign t :free-to-foreign t)
"gtk_file_chooser_get_current_folder"
"gtk_file_chooser_set_current_folder")
(:cffi uri file-chooser-uri
(g-string :free-from-foreign t :free-to-foreign t)
"gtk_file_chooser_get_uri" "gtk_file_chooser_set_uri")
(:cffi current-folder-uri file-chooser-current-folder-uri
(g-string :free-from-foreign t :free-to-foreign t)
"gtk_file_chooser_get_current_folder_uri"
"gtk_file_chooser_set_current_folder_uri")
(:cffi preview-filename file-chooser-preview-filename
(g-string :free-from-foreign t :free-to-foreign t)
"gtk_file_chooser_get_preview_filename" nil)
(:cffi preview-uri file-chooser-preview-uri
(g-string :free-from-foreign t :free-to-foreign t)
"gtk_file_chooser_get_preview_uri" nil))