5 (defun widget-flags (widget)
6 (convert-from-foreign (gtk-object-flags-as-integer widget
) 'widget-flags
))
8 (defun (setf widget-flags
) (new-value widget
)
9 (setf (gtk-object-flags-as-integer widget
)
10 (convert-to-foreign new-value
'widget-flags
))
13 (export 'widget-flags
)
15 (defcstruct %gtk-widget
17 (:private-flags
:uint16
)
19 (:saved-state state-type
)
20 (:name
(:pointer
:char
))
22 (:requisition requisition-cstruct
)
23 (:allocation allocation-cstruct
)
27 (defun widget-state (widget)
28 (foreign-slot-value (pointer widget
) '%gtk-widget
:state
))
30 (export 'widget-state
)
32 (defun widget-saved-state (widget)
33 (foreign-slot-value (pointer widget
) '%gtk-widget
:saved-state
))
35 (export 'widget-saved-state
)
37 (defmacro widget-p-fn
(type)
38 (let ((name (intern (format nil
"WIDGET-~A-P" (symbol-name type
)) (find-package :gtk
))))
39 `(progn (defun ,name
(widget)
40 (member ,type
(widget-flags widget
)))
43 (widget-p-fn :toplevel
)
44 (widget-p-fn :no-window
)
45 (widget-p-fn :realized
)
47 (widget-p-fn :visible
)
48 (widget-p-fn :sensitive
)
49 (widget-p-fn :parent-sensitive
)
50 (widget-p-fn :can-focus
)
51 (widget-p-fn :has-focus
)
52 (widget-p-fn :can-default
)
53 (widget-p-fn :has-default
)
54 (widget-p-fn :has-grab
)
55 (widget-p-fn :rc-style
)
56 (widget-p-fn :composite-child
)
57 (widget-p-fn :no-reparent
)
58 (widget-p-fn :app-paintable
)
59 (widget-p-fn :receives-default
)
60 (widget-p-fn :double-buffered
)
61 (widget-p-fn :no-show-all
)
63 (defcfun (widget-unparent "gtk_widget_unparent") :void
66 (export 'widget-unparent
)
68 (defcfun gtk-widget-show
:void
71 (defcfun gtk-widget-show-all
:void
74 (defun widget-show (widget &key
(all t
))
76 (gtk-widget-show-all widget
)
77 (gtk-widget-show widget
)))
81 (defcfun (widget-show-now "gtk_widget_show_now") :void
84 (export 'widget-show-now
)
86 (defcfun gtk-widget-hide
:void
89 (defcfun gtk-widget-hide-all
:void
92 (defun widget-hide (widget &key
(all t
))
94 (gtk-widget-hide-all widget
)
95 (gtk-widget-hide widget
)))
99 (defcfun (widget-map "gtk_widget_map") :void
104 (defcfun (widget-unmap "gtk_widget_unmap") :void
107 (export 'widget-unmap
)
109 (defcfun (widget-realize "gtk_widget_realize") :void
112 (export 'widget-realize
)
114 (defcfun (widget-unrealize "gtk_widget_unrealize") :void
117 (export 'widget-unrealize
)
119 (defcfun (widget-queue-draw "gtk_widget_queue_draw") :void
120 (widget (g-object widget
)))
122 (export 'widget-queue-draw
)
124 (defcfun (widget-queue-resize "gtk_widget_queue_resize") :void
125 (widget (g-object widget
)))
127 (export 'widget-queue-resize
)
129 (defcfun (widget-queue-resize-no-redraw "gtk_widget_queue_resize_no_redraw") :void
130 (widget (g-object widget
)))
132 (export 'widget-queue-resize-no-redraw
)
134 ; TODO: gtk_widget_get_child_requisition
136 ; TODO: gtk_widget_size_allocate
138 (defcfun (widget-add-accelerator "gtk_widget_add_accelerator") :void
140 (accel-signal :string
)
141 (accel-group g-object
)
143 (accel-mods modifier-type
)
144 (accel-flags accel-flags
))
146 (export 'widget-add-accelerator
)
148 (defcfun (widget-remove-accelerator "gtk_widget_remove_accelerator") :void
150 (accel-group g-object
)
152 (accel-mods modifier-type
))
154 (export 'widget-remove-accelerator
)
156 (defcfun (widget-set-accel-path "gtk_widget_set_accel_path") :void
159 (accel-group g-object
))
161 (export 'widget-set-accel-path
)
163 ; TODO: gtk_widget_list_accel_closures
165 (defcfun gtk-widget-can-activate-accel
:boolean
169 (defun widget-can-activate-accel (widget signal
)
170 (when (stringp signal
) (setf signal
(g-signal-lookup signal
(g-type-from-object widget
))))
171 (gtk-widget-can-activate-accel widget signal
))
173 (export 'widget-can-activate-accel
)
175 (defcfun (widget-event "gtk_widget_event") :boolean
176 (widget (g-object widget
))
177 (event (g-boxed-foreign event
)))
179 (export 'widget-event
)
181 (defcfun (widget-activate "gtk_widget_activate") :boolean
184 (export 'widget-activate
)
186 (defcfun (widget-reparent "gtk_widget_reparent") :void
188 (new-parent g-object
))
190 (export 'widget-reparent
)
192 (defcfun gtk-widget-intersect
:boolean
194 (area (g-boxed-foreign rectangle
))
195 (intersection (g-boxed-foreign rectangle
)))
197 (defun widget-intersect (widget rectangle
)
198 (let ((result (make-rectangle)))
199 (when (gtk-widget-intersect widget rectangle result
)
202 (export 'widget-intersect
)
204 (defcfun (widget-focus-p "gtk_widget_is_focus") :boolean
207 (export 'widget-focus-p
)
209 (defcfun (widget-grab-focus "gtk_widget_grab_focus") :void
212 (export 'widget-grab-focus
)
214 (defcfun (widget-grab-default "gtk_widget_grab_default") :void
217 (export 'widget-grab-default
)
219 (defcfun (widget-set-state "gtk_widget_set_state") :void
220 (widget (g-object widget
))
223 (export 'widget-set-state
)
225 (defcfun (widget-ancestor "gtk_widget_get_ancestor") (g-object widget
)
226 (widget (g-object widget
))
227 (type g-type-designator
))
229 (export 'widget-ancestor
)
231 (defcfun gtk-widget-get-pointer
:void
236 (defun widget-pointer (widget)
237 (with-foreign-objects ((x :int
) (y :int
))
238 (gtk-widget-get-pointer widget x y
)
239 (values (mem-ref x
:int
) (mem-ref y
:int
))))
241 (export 'widget-pointer
)
243 (defcfun (widget-is-ancestor "gtk_widget_is_ancestor") :boolean
245 (container g-object
))
247 (export 'widget-is-ancestor
)
249 (defcfun gtk-widget-translate-coordinates
:boolean
250 (src-widget g-object
)
251 (dst-widget g-object
)
254 (dst-x (:pointer
:int
))
255 (dst-y (:pointer
:int
)))
257 (defun widget-translate-coordinates (src-widget dst-widget src-x src-y
)
258 (with-foreign-objects ((dst-x :int
) (dst-y :int
))
259 (gtk-widget-translate-coordinates src-widget dst-widget src-x src-y dst-x dst-y
)
260 (values (mem-ref dst-x
:int
)
261 (mem-ref dst-y
:int
))))
263 (export 'widget-translate-coordinates
)
265 (defcfun (widget-ensure-style "gtk_widget_ensure_style") :void
268 (export 'widget-ensure-style
)
270 (defcfun (widget-reset-rc-styles "gtk_widget_reset_rc_styles") :void
273 (export 'widget-reset-rc-styles
)
275 (defcfun (widget-push-colormap "gtk_widget_push_colormap") :void
276 (colormap (g-object gdk-colormap
)))
278 (export 'widget-push-colormap
)
280 (defcfun (widget-pop-colormap "gtk_widget_pop_colormap") :void
)
282 (export 'widget-pop-colormap
)
284 (defcfun (widget-default-colormap "gtk_widget_get_default_colormap") (g-object gdk-colormap
))
286 (defcfun gtk-widget-set-default-colormap
:void
287 (colormap (g-object gdk-colormap
)))
289 (defun (setf widget-default-colormap
) (colormap)
290 (gtk-widget-set-default-colormap colormap
))
292 (export 'widget-default-colormap
)
294 (defcfun (widget-default-style "gtk_widget_get_default_style") (g-object style
))
296 (export 'widget-default-style
)
298 (defcfun (widget-default-visual "gtk_widget_get_default_visual") (g-object visual
))
300 (export 'widget-default-visual
)
302 (defcfun (widget-default-direction "gtk_widget_get_default_direction") text-direction
)
304 (defcfun gtk-widget-set-default-direction
:void
305 (direction text-direction
))
307 (defun (setf widget-default-direction
) (new-value)
308 (gtk-widget-set-default-direction new-value
))
310 (export 'widget-default-direction
)
312 (defcfun (widget-shape-combine-mask "gtk_widget_shape_combine_mask") :void
313 (widget (g-object widget
))
314 (shape-mask g-object
)
318 (export 'widget-shape-combine-mask
)
320 (defcfun (widget-input-shape-combine-mask "gtk_widget_input_shape_combine_mask") :void
321 (widget (g-object widget
))
322 (shape-mask g-object
)
326 (export 'widget-input-shape-combine-mask
)
328 (defcfun gtk-widget-path
:void
330 (path-length (:pointer
:uint
))
331 (path (:pointer
(:pointer
:char
)))
332 (path-reversed (:pointer
(:pointer
:char
))))
334 (defcfun gtk-widget-class-path
:void
336 (path-length (:pointer
:uint
))
337 (path (:pointer
(:pointer
:char
)))
338 (path-reversed (:pointer
(:pointer
:char
))))
340 (defun widget-path (widget &key
(path-type :name
))
341 (assert (typep path-type
'(member :name
:class
)))
342 (with-foreign-object (path :pointer
)
344 (:name
(gtk-widget-path widget
(null-pointer) path
(null-pointer)))
345 (:class
(gtk-widget-class-path widget
(null-pointer) path
(null-pointer))))
346 (mem-ref path
'(g-string :free-from-foreign t
))))
348 (export 'widget-path
)
350 (defcfun (widget-modify-fg "gtk_widget_modify_fg") :void
351 (widget (g-object widget
))
353 (color (g-boxed-foreign color
)))
355 (export 'widget-modify-fg
)
357 (defcfun (widget-modify-bg "gtk_widget_modify_bg") :void
358 (widget (g-object widget
))
360 (color (g-boxed-foreign color
)))
362 (export 'widget-modify-bg
)
364 (defcfun (widget-modify-text "gtk_widget_modify_text") :void
365 (widget (g-object widget
))
367 (color (g-boxed-foreign color
)))
369 (export 'widget-modify-text
)
371 (defcfun (widget-modify-base "gtk_widget_modify_base") :void
372 (widget (g-object widget
))
374 (color (g-boxed-foreign color
)))
376 (export 'widget-modify-base
)
378 ;void gtk_widget_modify_font (GtkWidget *widget,
379 ; PangoFontDescription *font_desc);
381 (defcfun (widget-modify-cursor "gtk_widget_modify_cursor") :void
382 (widget (g-object widget
))
383 (primary (g-boxed-foreign color
))
384 (secondary (g-boxed-foreign color
)))
386 (export 'widget-modify-cursor
)
388 (defcfun (widget-create-pango-context "gtk_widget_create_pango_context") (g-object :already-referenced
)
391 (export 'widget-create-pango-context
)
393 (defcfun (widget-create-pango-layout "gtk_widget_create_pango_layout") (g-object pango-layout
:already-referenced
)
394 (widget (g-object widget
))
397 (export 'widget-create-pango-layout
)
399 (defcfun (widget-render-icon "gtk_widget_render_icon") g-object
405 (export 'widget-render-icon
)
407 (defcfun (widget-push-composite-child "gtk_widget_push_composite_child") :void
410 (export 'widget-push-composite-child
)
412 (defcfun (widget-pop-composite-child "gtk_widget_pop_composite_child") :void
415 (export 'widget-pop-composite-child
)
417 (defcfun (widget-queue-clear "gtk_widget_queue_clear") :void
418 (widget (g-object widget
)))
420 (export 'widget-queue-clear
)
422 (defcfun (widget-queue-clear-area "gtk_widget_queue_clear_area") :void
423 (widget (g-object widget
))
429 (export 'widget-queue-clear-area
)
431 (defcfun (widget-queue-draw-area "gtk_widget_queue_draw_area") :void
438 (export 'widget-queue-draw-area
)
440 (defcfun (widget-reset-shapes "gtk_widget_reset_shapes") :void
443 (export 'widget-reset-shapes
)
445 (defcfun (widget-set-double-buffered "gtk_widget_set_double_buffered") :void
446 (widget (g-object widget
))
447 (double-buffered :boolean
))
449 (export 'widget-set-double-buffered
)
451 (defcfun (widget-set-scroll-adjustments "gtk_widget_set_scroll_adjustments") :boolean
453 (hadjustment g-object
)
454 (vadjustment g-object
))
456 (export 'widget-set-scroll-adjustments
)
458 (defcfun (widget-mnemonic-activate "gtk_widget_mnemonic_activate") :boolean
459 (widget (g-object widget
))
460 (group-cycling :boolean
))
462 (export 'widget-mnemonic-activate
)
464 ; TODO: gtk_widget_class_install_style_property
466 ; TOOD: gtk_widget_class_install_style_property_parser
468 ; TODO: gtk_widget_class_list_style_properties
470 (defcfun (widget-region-intersect "gtk_widget_region_intersect") (g-boxed-foreign region
:return
)
471 (widget (g-object widget
))
472 (region (g-boxed-foreign region
)))
474 (export 'widget-region-intersect
)
476 ; ignored: gtk_widget_send_expose
478 (defcfun gtk-widget-style-get-property
:void
480 (property-name :string
)
481 (value (:pointer g-value
)))
483 (defcfun gtk-widget-class-find-style-property
(:pointer g-param-spec
)
485 (property-name :string
))
487 (defcfun gtk-widget-class-list-style-properties
(:pointer
(:pointer g-param-spec
))
489 (n-properties (:pointer
:int
)))
491 (defun widget-get-style-properties (type)
492 (setf type
(ensure-g-type type
))
493 (let ((class (g-type-class-ref type
)))
495 (with-foreign-object (np :int
)
496 (let ((specs (gtk-widget-class-list-style-properties class np
)))
499 repeat
(mem-ref np
:int
)
501 for spec
= (mem-aref specs
:pointer i
)
502 collect
(parse-g-param-spec spec
))
504 (g-type-class-unref class
))))
506 (export 'widget-get-style-properties
)
508 (defun widget-style-property-info (type property-name
)
509 (let ((class (g-type-class-ref type
)))
511 (let ((g-param-spec (gtk-widget-class-find-style-property class property-name
)))
512 (parse-g-param-spec g-param-spec
))
513 (g-type-class-unref class
))))
515 (export 'widget-style-property-info
)
517 (defun widget-style-property-type (widget property-name
)
518 (let ((property-info (widget-style-property-info (g-type-from-object widget
) property-name
)))
519 (g-class-property-definition-type property-info
)))
521 (defun widget-style-property-value (widget property-name
&optional property-type
)
522 (unless property-type
(setf property-type
(widget-style-property-type widget property-name
)))
523 (setf property-type
(ensure-g-type property-type
))
524 (with-foreign-object (gvalue 'g-value
)
525 (g-value-zero gvalue
)
526 (g-value-init gvalue property-type
)
527 (prog1 (gtk-widget-style-get-property widget property-name gvalue
)
528 (g-value-unset gvalue
))))
530 (export 'widget-style-property-value
)
532 (defcfun (widget-child-focus "gtk_widget_child_focus") :boolean
534 (direction direction-type
))
536 (export 'widget-child-focus
)
538 (defcfun (widget-child-notify "gtk_widget_child_notify") :void
539 (widget (g-object widget
))
540 (property-name :string
))
542 (export 'widget-child-notify
)
544 (defcfun (widget-freeze-child-notify "gtk_widget_freeze_child_notify") :void
547 (export 'widget-freeze-child-notify
)
549 (defcfun (widget-settings "gtk_widget_get_settings") g-object
552 (export 'widget-settings
)
554 (defcfun (widget-clipboard "gtk_widget_get_clipboard") (g-object clipboard
)
555 (widget (g-object widget
))
556 (selection gdk-atom-as-string
))
558 (export 'widget-clipboard
)
560 (defcfun (widget-display "gtk_widget_get_display") g-object
563 (export 'widget-display
)
565 (defcfun (widget-root-window "gtk_widget_get_root_window") g-object
568 (export 'widget-root-window
)
570 (defcfun (widget-screen "gtk_widget_get_screen") g-object
573 (export 'widget-screen
)
575 (defcfun (widget-has-screen "gtk_widget_has_screen") :boolean
578 (export 'widget-has-screen
)
580 (defcfun (widget-thaw-child-notify "gtk_widget_thaw_child_notify") :void
583 (export 'widget-thaw-child-notify
)
585 (defcfun (widget-mnemonic-labels "gtk_widget_list_mnemonic_labels") (glist (g-object widget
) :free-from-foreign t
)
586 (widget (g-object widget
)))
588 (export 'widget-mnemonic-labels
)
590 (defcfun (widget-add-mnemonic-label "gtk_widget_add_mnemonic_label") :void
594 (export 'widget-add-mnemonic-label
)
596 (defcfun (widget-remove-mnemonic-label "gtk_widget_remove_mnemonic_label") :void
600 (export 'widget-remove-mnemonic-label
)
602 (defcfun (widget-action "gtk_widget_get_action") g-object
605 (export 'widget-action
)
607 (defcfun (widget-composited-p "gtk_widget_is_composited") :boolean
610 (export 'widget-composited-p
)
612 (defcfun (widget-error-bell "gtk_widget_error_bell") :void
615 (export 'widget-error-bell
)
617 (defcfun (widget-trigger-tooltip-query "gtk_tooltip_trigger_tooltip_query") :void
620 (export 'widget-trigger-tooltip-query
)
622 (defcfun gtk-widget-get-snapshot g-object
624 (clip-rectangle (g-boxed-foreign rectangle
)))
626 (defun widget-snapshot (widget &optional clip-rectangle
)
627 (gtk-widget-get-snapshot widget clip-rectangle
))
629 (export 'widget-snapshot
)