From 6f4928847628b65ed8efa8129bd42ab7bed88bee Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Wed, 11 Nov 2009 23:39:09 +0200 Subject: [PATCH] Squashed andy128k patch --- gdk/cl-gtk2-gdk.asd | 2 +- gdk/gdk.drag-and-drop.lisp | 2 +- gtk/cl-gtk2-gtk.asd | 3 + gtk/gtk.cell-renderer.lisp | 23 ++++++- gtk/gtk.dnd.lisp | 20 ++++++ gtk/gtk.icon-factory.lisp | 149 ++++++++++++++++++++++++++++++++++++++++++++ gtk/gtk.selections.lisp | 9 +++ gtk/gtk.tree-view.lisp | 40 +++++++++++- gtk/gtk.widget.lisp | 13 +++- 9 files changed, 254 insertions(+), 7 deletions(-) create mode 100644 gtk/gtk.dnd.lisp create mode 100644 gtk/gtk.icon-factory.lisp create mode 100644 gtk/gtk.selections.lisp diff --git a/gdk/cl-gtk2-gdk.asd b/gdk/cl-gtk2-gdk.asd index 204344b..2869ef4 100644 --- a/gdk/cl-gtk2-gdk.asd +++ b/gdk/cl-gtk2-gdk.asd @@ -28,4 +28,4 @@ (:file "gdk.drag-and-drop") (:file "gdk.input-devices") (:file "gdk.pango")) - :depends-on (:cl-gtk2-glib :cffi :cl-gtk2-pango)) \ No newline at end of file + :depends-on (:cl-gtk2-glib :cffi :cl-gtk2-pango)) diff --git a/gdk/gdk.drag-and-drop.lisp b/gdk/gdk.drag-and-drop.lisp index 905f239..8ddef98 100644 --- a/gdk/gdk.drag-and-drop.lisp +++ b/gdk/gdk.drag-and-drop.lisp @@ -48,7 +48,7 @@ (context (g-object drag-context)) (time :uint32)) -(export 'gdk-drag-abord) +(export 'gdk-drag-abort) (defcfun gdk-drop-reply :void (context (g-object drag-context)) diff --git a/gtk/cl-gtk2-gtk.asd b/gtk/cl-gtk2-gtk.asd index a602476..0672a17 100644 --- a/gtk/cl-gtk2-gtk.asd +++ b/gtk/cl-gtk2-gtk.asd @@ -15,6 +15,7 @@ (:file "gtk.dialog") (:file "gtk.window") (:file "gtk.window-group") + (:file "gtk.icon-factory") (:file "gtk.image") (:file "gtk.label") (:file "gtk.progress-bar") @@ -23,6 +24,8 @@ (:file "gtk.scale-button") (:file "gtk.entry") (:file "gtk.spin-button") + (:file "gtk.selections") + (:file "gtk.dnd") (:file "gtk.text") (:file "gtk.tree-model") (:file "gtk.tree-view-column") diff --git a/gtk/gtk.cell-renderer.lisp b/gtk/gtk.cell-renderer.lisp index 4f8d4a6..4de7f00 100644 --- a/gtk/gtk.cell-renderer.lisp +++ b/gtk/gtk.cell-renderer.lisp @@ -14,7 +14,28 @@ ; TODO: gtk_cell_renderer_stop_editing -; TODO: gtk_cell_renderer_get_fixed_size +(defcfun gtk-cell-renderer-get-fixed-size :void + (cell g-object) + (width :pointer) + (height :pointer)) + +(defun cell-renderer-get-fixed-size (cell) + (with-foreign-objects ((width :int) (height :int)) + (gtk-cell-renderer-get-fixed-size cell width height) + (values (mem-ref width :int) + (mem-ref height :int)))) + +(export 'cell-renderer-get-fixed-size) + +(defcfun gtk-cell-renderer-set-fixed-size :void + (cell g-object) + (width :int) + (height :int)) + +(defun cell-renderer-set-fixed-size (cell width height) + (gtk-cell-renderer-set-fixed-size cell width height)) + +(export 'cell-renderer-set-fixed-size) ; TODO: GtkCellRendererAccel diff --git a/gtk/gtk.dnd.lisp b/gtk/gtk.dnd.lisp new file mode 100644 index 0000000..cfb504b --- /dev/null +++ b/gtk/gtk.dnd.lisp @@ -0,0 +1,20 @@ +(in-package :gtk) + +(define-g-flags "GtkTargetFlags" target-flags + (:export t :type-initializer "gtk_target_flags_get_type") + (:same-app 1) + (:same-widget 2) + (:other-app 4) + (:other-widget 8)) + +(defcfun gtk-drag-finish :void + (context g-object) + (success :boolean) + (del :boolean) + (time :uint32)) + +(defun drag-finish (context success del time) + (gtk-drag-finish context success del time)) + +(export 'drag-finish) + diff --git a/gtk/gtk.icon-factory.lisp b/gtk/gtk.icon-factory.lisp new file mode 100644 index 0000000..3c9086b --- /dev/null +++ b/gtk/gtk.icon-factory.lisp @@ -0,0 +1,149 @@ +(in-package :gtk) + +;; icon-source + +(at-init () (foreign-funcall "gtk_icon_source_get_type" :int)) + +(defcfun gtk-icon-source-new :pointer) + +(define-g-boxed-opaque icon-source "GtkIconSource" + :alloc (gtk-icon-source-new)) + +(export 'icon-source) + +(define-boxed-opaque-accessor icon-source icon-source-filename + :reader "gtk_icon_source_get_filename" + :writer "gtk_icon_source_set_filename" + :type (:string :free-from-foreign nil)) + +(export 'icon-source-filename) + +(define-boxed-opaque-accessor icon-source icon-source-icon-name + :reader "gtk_icon_source_get_icon_name" + :writer "gtk_icon_source_set_icon_name" + :type (:string :free-from-foreign nil)) + +(export 'icon-source-icon-name) + +#| +GtkTextDirection gtk_icon_source_get_direction (const GtkIconSource *source); +gboolean gtk_icon_source_get_direction_wildcarded + (const GtkIconSource *source); +GdkPixbuf* gtk_icon_source_get_pixbuf (const GtkIconSource *source); +GtkIconSize gtk_icon_source_get_size (const GtkIconSource *source); +gboolean gtk_icon_source_get_size_wildcarded (const GtkIconSource *source); +GtkStateType gtk_icon_source_get_state (const GtkIconSource *source); +gboolean gtk_icon_source_get_state_wildcarded + (const GtkIconSource *source); + +void gtk_icon_source_set_direction (GtkIconSource *source, + GtkTextDirection direction); +void gtk_icon_source_set_direction_wildcarded + (GtkIconSource *source, + gboolean setting); +void gtk_icon_source_set_pixbuf (GtkIconSource *source, + GdkPixbuf *pixbuf); +void gtk_icon_source_set_size (GtkIconSource *source, + GtkIconSize size); +void gtk_icon_source_set_size_wildcarded (GtkIconSource *source, + gboolean setting); +void gtk_icon_source_set_state (GtkIconSource *source, + GtkStateType state); +void gtk_icon_source_set_state_wildcarded + (GtkIconSource *source, + gboolean setting); +|# + + +;; icon-set + +(at-init () (foreign-funcall "gtk_icon_set_get_type" :int)) + +(defcfun gtk-icon-set-new :pointer) + +(define-g-boxed-opaque icon-set "GtkIconSet" + :alloc (gtk-icon-set-new)) + +(export 'icon-set) + +(defcfun gtk-icon-set-add-source :void + (icon-set (g-boxed-foreign icon-set)) + (source (g-boxed-foreign icon-source))) + +(defun icon-set-add-source (icon-set icon-source) + (gtk-icon-set-add-source icon-set icon-source)) + +(export 'icon-set-add-source) + +#| +GtkIconSet* gtk_icon_set_new_from_pixbuf (GdkPixbuf *pixbuf); +GdkPixbuf* gtk_icon_set_render_icon (GtkIconSet *icon_set, + GtkStyle *style, + GtkTextDirection direction, + GtkStateType state, + GtkIconSize size, + GtkWidget *widget, + const char *detail); +void gtk_icon_set_get_sizes (GtkIconSet *icon_set, + GtkIconSize **sizes, + gint *n_sizes); + +gboolean gtk_icon_size_lookup (GtkIconSize size, + gint *width, + gint *height); +gboolean gtk_icon_size_lookup_for_settings (GtkSettings *settings, + GtkIconSize size, + gint *width, + gint *height); +GtkIconSize gtk_icon_size_register (const gchar *name, + gint width, + gint height); +void gtk_icon_size_register_alias (const gchar *alias, + GtkIconSize target); +GtkIconSize gtk_icon_size_from_name (const gchar *name); +const gchar* gtk_icon_size_get_name (GtkIconSize size); +|# + +;; icon-factory + +(defcfun gtk-icon-factory-add :void + (factory (g-object icon-factory)) + (stock-id :string) + (icon-set (g-boxed-foreign icon-set))) + +(defun icon-factory-add (factory stock-id icon-set) + (gtk-icon-factory-add factory stock-id icon-set)) + +(export 'icon-factory-add) + +(defcfun gtk-icon-factory-add-default :void + (factory (g-object icon-factory))) + +(defun icon-factory-add-default (factory) + (gtk-icon-factory-add-default factory)) + +(export 'icon-factory-add-default) + +(defcfun gtk-icon-factory-lookup (g-boxed-foreign icon-set :return) + (factory (g-object icon-factory)) + (stock-id :string)) + +(defun icon-factory-lookup (factory stock-id) + (gtk-icon-factory-lookup factory stock-id)) + +(export 'icon-factory-lookup) + +(defcfun gtk-icon-factory-lookup-default (g-boxed-foreign icon-set :return) + (stock-id :string)) + +(defun icon-factory-lookup-default (stock-id) + (gtk-icon-factory-lookup-default stock-id)) + +(export 'icon-factory-lookup-default) + +(defcfun gtk-icon-factory-remove-default :void + (factory (g-object icon-factory))) + +(defun icon-factory-remove-default (factory) + (gtk-icon-factory-remove-default factory)) + diff --git a/gtk/gtk.selections.lisp b/gtk/gtk.selections.lisp new file mode 100644 index 0000000..d97d014 --- /dev/null +++ b/gtk/gtk.selections.lisp @@ -0,0 +1,9 @@ +(in-package :gtk) + +(define-g-boxed-cstruct target-entry "GtkTargetEntry" + (target :string :initform 0) + (flags target-flags :initform 0) + (info :uint :initform 0)) + +(export (boxed-related-symbols 'target-entry)) + diff --git a/gtk/gtk.tree-view.lisp b/gtk/gtk.tree-view.lisp index 34cf773..50efebc 100644 --- a/gtk/gtk.tree-view.lisp +++ b/gtk/gtk.tree-view.lisp @@ -324,9 +324,30 @@ (export 'tree-view-convert-widget-to-tree-coords) -; TODO: gtk_tree_view_enable_model_drag_dest +(defcfun gtk-tree-view-enable-model-drag-dest :void + (tree-view g-object) + (targets :pointer) + (n-targets :int) + (actions gdk:drag-action)) + +(defun tree-view-enable-model-drag-dest (tree-view targets actions) + (with-foreign-boxed-array (n-targets targets-ptr target-entry targets) + (gtk-tree-view-enable-model-drag-dest tree-view targets-ptr n-targets actions))) + +(export 'tree-view-enable-model-drag-dest) + +(defcfun gtk-tree-view-enable-model-drag-source :void + (tree-view g-object) + (start-button-mask gdk:modifier-type) + (targets :pointer) + (n-targets :int) + (actions gdk:drag-action)) -; TODO: gtk_tree_view_enable_model_drag_source +(defun tree-view-enable-model-drag-source (tree-view start-button-mask targets actions) + (with-foreign-boxed-array (n-targets targets-ptr target-entry targets) + (gtk-tree-view-enable-model-drag-source tree-view start-button-mask targets-ptr n-targets actions))) + +(export 'tree-view-enable-model-drag-source) ; TODO: gtk_tree_view_unset_rows_drag_source @@ -336,7 +357,20 @@ ; TOOD: gtk_tree_view_get_drag_dest_row -; TOOD: gtk_tree_view_get_dest_row_at_pos +(defcfun gtk-tree-view-get-dest-row-at-pos :boolean + (tree_view g-object) + (drag-x :int) + (drag-y :int) + (path :pointer) + (pos :pointer)) + +(defun tree-view-get-dest-row-at-pos (tree-view x y) + (with-foreign-objects ((path :pointer) (pos :int)) + (when (gtk-tree-view-get-dest-row-at-pos tree-view x y path pos) + (values (mem-ref path '(g-boxed-foreign tree-path :return)) + (mem-ref pos 'tree-view-drop-position))))) + +(export 'tree-view-get-dest-row-at-pos) ; TOOD: gtk_tree_view_create_drag_icon diff --git a/gtk/gtk.widget.lisp b/gtk/gtk.widget.lisp index 7e98dae..6532f11 100644 --- a/gtk/gtk.widget.lisp +++ b/gtk/gtk.widget.lisp @@ -2,6 +2,17 @@ ; TODO: GtkWidget +(define-g-boxed-cstruct selection-data "GtkSelectionData" + (selection :pointer) ; GdkAtom + (target :pointer) ; GdkAtom + (type :pointer) ; GdkAtom + (format :int) + (data :pointer :initform 0) + (length :int) + (display g-object)) + +(export (boxed-related-symbols 'selection-data)) + (defun widget-flags (widget) (convert-from-foreign (gtk-object-flags-as-integer widget) 'widget-flags)) @@ -626,4 +637,4 @@ (defun widget-snapshot (widget &optional clip-rectangle) (gtk-widget-get-snapshot widget clip-rectangle)) -(export 'widget-snapshot) \ No newline at end of file +(export 'widget-snapshot) -- 1.7.10.4