X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=gtk%2Fgtk.widget.lisp;h=efffbf6ffaf4066cfb058dd2f11c2e5385cb6bed;hb=89b8d7f826c33afc4f8b14a0c7f284c975551dec;hp=0605f9dbcadfd18ec645474d3bc912fc73630878;hpb=307892d397e11717a9a1b627d9b9914dbc1f1fac;p=cl-gtk2.git diff --git a/gtk/gtk.widget.lisp b/gtk/gtk.widget.lisp index 0605f9d..efffbf6 100644 --- a/gtk/gtk.widget.lisp +++ b/gtk/gtk.widget.lisp @@ -12,16 +12,6 @@ (export 'widget-flags) -(defcstruct %gtk-requisition - (:width :int) - (:height :int)) - -(defcstruct %gtk-allocation - (:x :int) - (:y :int) - (:width :int) - (:height :int)) - (defcstruct %gtk-widget (:object %gtk-object) (:private-flags :uint16) @@ -29,8 +19,8 @@ (:saved-state state-type) (:name (:pointer :char)) (:style :pointer) - (:requisition %gtk-requisition) - (:allocation %gtk-allocation) + (:requisition requisition-cstruct) + (:allocation allocation-cstruct) (:window :pointer) (:parent :pointer)) @@ -38,6 +28,7 @@ (foreign-slot-value (pointer widget) '%gtk-widget :state)) (export 'widget-state) + (defun widget-saved-state (widget) (foreign-slot-value (pointer widget) '%gtk-widget :saved-state)) @@ -179,7 +170,11 @@ (export 'widget-can-activate-accel) -; TODO: gtk_widget_event +(defcfun (widget-event "gtk_widget_event") :boolean + (widget (g-object widget)) + (event (g-boxed-foreign event))) + +(export 'widget-event) (defcfun (widget-activate "gtk_widget_activate") :boolean (widget g-object)) @@ -195,10 +190,10 @@ (defcfun gtk-widget-intersect :boolean (widget g-object) (area (g-boxed-foreign rectangle)) - (intersection (g-boxed-foreign rectangle :in-out))) + (intersection (g-boxed-foreign rectangle))) (defun widget-intersect (widget rectangle) - (let ((result (make-rectangle :x 0 :y 0 :width 0 :height 0))) + (let ((result (make-rectangle))) (when (gtk-widget-intersect widget rectangle result) result))) @@ -219,25 +214,17 @@ (export 'widget-grab-default) -; TODO: gtk_widget_set_state - -; TODO: gtk_widget_set_parent_window - -; TODO: gtk_widget_get_parent_window - -; TODO: gtk_widget_set_extension_events - -; TODO: gtk_widget_get_extension_events - - -; fix ownership issues: -; TODO: gtk_widget_get_toplevel +(defcfun (widget-set-state "gtk_widget_set_state") :void + (widget (g-object widget)) + (state state-type)) -; TODO: gtk_widget_get_ancestor +(export 'widget-set-state) -; TODO: gtk_widget_get_colormap +(defcfun (widget-ancestor "gtk_widget_get_ancestor") (g-object widget) + (widget (g-object widget)) + (type g-type-designator)) -; TODO: gtk_widget_get_visual +(export 'widget-ancestor) (defcfun gtk-widget-get-pointer :void (widget g-object) @@ -251,11 +238,11 @@ (export 'widget-pointer) -(defcfun (widget-contained-p "gtk_widget_is_ancestor") :boolean +(defcfun (widget-is-ancestor "gtk_widget_is_ancestor") :boolean (widget g-object) (container g-object)) -(export 'widget-contained-p) +(export 'widget-is-ancestor) (defcfun gtk-widget-translate-coordinates :boolean (src-widget g-object) @@ -283,17 +270,32 @@ (export 'widget-reset-rc-styles) -; TODO: gtk_widget_push_colormap +(defcfun (widget-push-colormap "gtk_widget_push_colormap") :void + (colormap (g-object gdk-colormap))) + +(export 'widget-push-colormap) + +(defcfun (widget-pop-colormap "gtk_widget_pop_colormap") :void) -; TODO: gtk_widget_pop_colormap +(export 'widget-pop-colormap) -; TODO: gtk_widget_set_default_colormap +(defcfun (widget-default-colormap "gtk_widget_get_default_colormap") (g-object gdk-colormap)) -; TODO: gtk_widget_get_default_colormap +(defcfun gtk-widget-set-default-colormap :void + (colormap (g-object gdk-colormap))) -; TODO: gtk_widget_get_default_style (ownership) +(defun (setf widget-default-colormap) (colormap) + (gtk-widget-set-default-colormap colormap)) -; TODO: gtk_widget_get_default_visual +(export 'widget-default-colormap) + +(defcfun (widget-default-style "gtk_widget_get_default_style") (g-object style)) + +(export 'widget-default-style) + +(defcfun (widget-default-visual "gtk_widget_get_default_visual") (g-object visual)) + +(export 'widget-default-visual) (defcfun (widget-default-direction "gtk_widget_get_default_direction") text-direction) @@ -305,9 +307,21 @@ (export 'widget-default-direction) -; TODO: gtk_widget_shape_combine_mask +(defcfun (widget-shape-combine-mask "gtk_widget_shape_combine_mask") :void + (widget (g-object widget)) + (shape-mask g-object) + (offset-x :int) + (offset-y :int)) + +(export 'widget-shape-combine-mask) + +(defcfun (widget-input-shape-combine-mask "gtk_widget_input_shape_combine_mask") :void + (widget (g-object widget)) + (shape-mask g-object) + (offset-x :int) + (offset-y :int)) -; TODO: gtk_widget_input_shape_combine_mask +(export 'widget-input-shape-combine-mask) (defcfun gtk-widget-path :void (widget g-object) @@ -331,33 +345,50 @@ (export 'widget-path) -; TODO: gtk_widget_modify_style +(defcfun (widget-modify-fg "gtk_widget_modify_fg") :void + (widget (g-object widget)) + (state state-type) + (color (g-boxed-foreign color))) -; TODO: gtk_widget_get_modifier_style +(export 'widget-modify-fg) -; TODO: gtk_widget_modify_fg +(defcfun (widget-modify-bg "gtk_widget_modify_bg") :void + (widget (g-object widget)) + (state state-type) + (color (g-boxed-foreign color))) -; TODO: gtk_widget_modify_bg +(export 'widget-modify-bg) -; TODO: gtk_widget_modify_text +(defcfun (widget-modify-text "gtk_widget_modify_text") :void + (widget (g-object widget)) + (state state-type) + (color (g-boxed-foreign color))) -; TODO: gtk_widget_modify_base +(export 'widget-modify-text) -; TODO: gtk_widget_modify_font +(defcfun (widget-modify-base "gtk_widget_modify_base") :void + (widget (g-object widget)) + (state state-type) + (color (g-boxed-foreign color))) -; TODO: gtk_widget_modify_cursor +(export 'widget-modify-base) -(defcfun (widget-create-pango-context "gtk_widget_create_pango_context") g-object - (widget g-object)) +;void gtk_widget_modify_font (GtkWidget *widget, +; PangoFontDescription *font_desc); -(export 'widget-create-pango-context) +(defcfun (widget-modify-cursor "gtk_widget_modify_cursor") :void + (widget (g-object widget)) + (primary (g-boxed-foreign color)) + (secondary (g-boxed-foreign color))) -(defcfun (widget-get-pango-context "gtk_widget_get_pango_context") g-object +(export 'widget-modify-cursor) + +(defcfun (widget-create-pango-context "gtk_widget_create_pango_context") (g-object :already-referenced) (widget g-object)) -(export 'widget-get-pango-context) +(export 'widget-create-pango-context) -(defcfun (widget-create-pango-layout "gtk_widget_create_pango_layout") (g-object gdk::pango-layout) +(defcfun (widget-create-pango-layout "gtk_widget_create_pango_layout") (g-object pango-layout :already-referenced) (widget (g-object widget)) (text :string)) @@ -381,6 +412,20 @@ (export 'widget-pop-composite-child) +(defcfun (widget-queue-clear "gtk_widget_queue_clear") :void + (widget (g-object widget))) + +(export 'widget-queue-clear) + +(defcfun (widget-queue-clear-area "gtk_widget_queue_clear_area") :void + (widget (g-object widget)) + (x :int) + (y :int) + (width :int) + (height :int)) + +(export 'widget-queue-clear-area) + (defcfun (widget-queue-draw-area "gtk_widget_queue_draw_area") :void (widget g-object) (x :int) @@ -395,6 +440,12 @@ (export 'widget-reset-shapes) +(defcfun (widget-set-double-buffered "gtk_widget_set_double_buffered") :void + (widget (g-object widget)) + (double-buffered :boolean)) + +(export 'widget-set-double-buffered) + (defcfun (widget-set-scroll-adjustments "gtk_widget_set_scroll_adjustments") :boolean (widget g-object) (hadjustment g-object) @@ -402,6 +453,12 @@ (export 'widget-set-scroll-adjustments) +(defcfun (widget-mnemonic-activate "gtk_widget_mnemonic_activate") :boolean + (widget (g-object widget)) + (group-cycling :boolean)) + +(export 'widget-mnemonic-activate) + ; TODO: gtk_widget_class_install_style_property ; TOOD: gtk_widget_class_install_style_property_parser @@ -425,7 +482,7 @@ (class :pointer) (n-properties (:pointer :int))) -(defun widget-class-get-style-properties (type) +(defun widget-get-style-properties (type) (setf type (ensure-g-type type)) (let ((class (g-type-class-ref type))) (unwind-protect @@ -440,19 +497,23 @@ (g-free specs)))) (g-type-class-unref class)))) -(export 'widget-class-get-style-properties) +(export 'widget-get-style-properties) -(defun widget-child-property-type (widget property-name) - (let* ((type (g-type-from-object widget)) - (class (g-type-class-ref type))) +(defun widget-style-property-info (type property-name) + (let ((class (g-type-class-ref type))) (unwind-protect (let ((g-param-spec (gtk-widget-class-find-style-property class property-name))) - (when (null-pointer-p g-param-spec) (error "Widget ~A has no style-property named '~A'" widget property-name)) - (foreign-slot-value g-param-spec 'gobject:g-param-spec :value-type)) + (parse-g-param-spec g-param-spec)) (g-type-class-unref class)))) -(defun widget-child-property-value (widget property-name &optional property-type) - (unless property-type (setf property-type (widget-child-property-type widget property-name))) +(export 'widget-style-property-info) + +(defun widget-style-property-type (widget property-name) + (let ((property-info (widget-style-property-info (g-type-from-object widget) property-name))) + (g-class-property-definition-type property-info))) + +(defun widget-style-property-value (widget property-name &optional property-type) + (unless property-type (setf property-type (widget-style-property-type widget property-name))) (setf property-type (ensure-g-type property-type)) (with-foreign-object (gvalue 'g-value) (g-value-zero gvalue) @@ -460,7 +521,7 @@ (prog1 (gtk-widget-style-get-property widget property-name gvalue) (g-value-unset gvalue)))) -(export 'widget-child-property-value) +(export 'widget-style-property-value) (defcfun (widget-child-focus "gtk_widget_child_focus") :boolean (widget g-object) @@ -468,6 +529,12 @@ (export 'widget-child-focus) +(defcfun (widget-child-notify "gtk_widget_child_notify") :void + (widget (g-object widget)) + (property-name :string)) + +(export 'widget-child-notify) + (defcfun (widget-freeze-child-notify "gtk_widget_freeze_child_notify") :void (widget g-object)) @@ -478,7 +545,11 @@ (export 'widget-settings) -; TODO: gtk_widget_get_clipboard +(defcfun (widget-clipboard "gtk_widget_get_clipboard") (g-object clipboard) + (widget (g-object widget)) + (selection gdk-atom-as-string)) + +(export 'widget-clipboard) (defcfun (widget-display "gtk_widget_get_display") g-object (widget g-object)) @@ -500,14 +571,15 @@ (export 'widget-has-screen) -; TODO: gtk_widget_set_child_visible - (defcfun (widget-thaw-child-notify "gtk_widget_thaw_child_notify") :void (widget g-object)) (export 'widget-thaw-child-notify) -; TODO: gtk_widget_list_mnemonic_labels +(defcfun (widget-mnemonic-labels "gtk_widget_list_mnemonic_labels") (glist (g-object widget) :free-from-foreign t) + (widget (g-object widget))) + +(export 'widget-mnemonic-labels) (defcfun (widget-add-mnemonic-label "gtk_widget_add_mnemonic_label") :void (widget g-object)