Next: , Previous: define-g-interface, Up: Generating type definitions by introspection


4.13.3 define-g-enum

— Macro: define-g-enum
     (define-g-enum g-name name (&key (export t) type-initializer) &body value*)
     
     value ::= :keyword
     value ::= (:keyword integer)
g-name
A string naming the GEnum type
name
A symbol naming the CFFI enumeration type
export
A boolean indicating whether to export name
type-initializer
A string naming the foreign type initializer function. Usually named enum_get_type.

Macro that defines CFFI enumeration, registers it with GValue, and calls the type initializer.

Example:

     (define-g-enum "GtkTextDirection" text-direction
       (:export t :type-initializer "gtk_text_direction_get_type")
       (:none 0) (:ltr 1) (:rtl 2))
     
     (define-g-enum "GtkSizeGroupMode" size-group-mode
      (:export t :type-initializer "gtk_size_group_mode_get_type")
      :none :horizontal :vertical :both)