Add gsize types for PPC32 and PPC64 archs
[cl-gtk2.git] / glib / gobject.type-info.enum.lisp
blob5060cf3bb9e39f64c413ff727e8880940517d362
1 (in-package :gobject)
3 (defstruct enum-item
4 "A structure describing a single enumeration item.
6 See accessor functions:
7 @itemize{
8 @item{@fun{enum-item-name}}
9 @item{@fun{enum-item-value}}
10 @item{@fun{enum-item-nick}}
12 name value nick)
14 (setf (documentation 'enum-item-name 'function)
15 "The C name of enum item, e.g. \"GTK_WINDOW_TOPLEVEL\".
16 @return{a string}")
18 (setf (documentation 'enum-item-value 'function)
19 "The numeric value of enum item.
20 @return{an integer}")
22 (setf (documentation 'enum-item-nick 'function)
23 "The \"nickname\" of enum item. Nickname is a short name of enum item. E.g., \"toplevel\".
24 @return{a string}")
26 (defun get-enum-items (type)
27 "Gets the list of enum items that belong to GEnum type @code{type}
28 @arg[type]{a string or an integer specifying GEnum type}
29 @return{a list of @class{enum-item} objects}"
30 (assert (g-type-is-a type +g-type-enum+))
31 (let ((g-class (g-type-class-ref type)))
32 (unwind-protect
33 (loop
34 with n = (foreign-slot-value g-class 'g-enum-class :n-values)
35 with values = (foreign-slot-value g-class 'g-enum-class :values)
36 for i from 0 below n
37 for enum-value = (mem-aref values 'g-enum-value i)
38 collect (make-enum-item
39 :name (foreign-slot-value enum-value 'g-enum-value
40 :name)
41 :value (foreign-slot-value enum-value 'g-enum-value
42 :value)
43 :nick (foreign-slot-value enum-value 'g-enum-value
44 :nick)))
45 (g-type-class-unref g-class))))
47 (defstruct flags-item
48 "A structure describing a single flags item.
50 See accessor functions:
51 @itemize{
52 @item{@fun{flags-item-name}}
53 @item{@fun{flags-item-value}}
54 @item{@fun{flags-item-nick}}
56 name value nick)
58 (setf (documentation 'flags-item-name 'function)
59 "The C name of flags item, e.g. \"GDK_PROPERTY_CHANGE_MASK\".
60 @return{a string}")
62 (setf (documentation 'flags-item-value 'function)
63 "The numeric value of flags item.
64 @return{an integer}")
66 (setf (documentation 'flags-item-nick 'function)
67 "The \"nickname\" of flags item. Nickname is a short name of flags item. E.g., \"property-change-mask\".
68 @return{a string}")
70 (defun get-flags-items (type)
71 "Gets the list of flags items that belong to GFlags type @code{type}
72 @arg[type]{a string or an integer specifying GFlags type}
73 @return{a list of @class{flags-item} objects}"
74 (assert (g-type-is-a type +g-type-flags+))
75 (let ((g-class (g-type-class-ref type)))
76 (unwind-protect
77 (loop
78 with n = (foreign-slot-value g-class 'g-flags-class :n-values)
79 with values = (foreign-slot-value g-class 'g-flags-class :values)
80 for i from 0 below n
81 for flags-value = (mem-aref values 'g-flags-value i)
82 collect (make-flags-item
83 :name (foreign-slot-value flags-value 'g-flags-value
84 :name)
85 :value (foreign-slot-value flags-value 'g-flags-value
86 :value)
87 :nick (foreign-slot-value flags-value 'g-flags-value
88 :nick)))
89 (g-type-class-unref g-class))))