From b2130e9cb154952b30935ed7a38872c8d127f396 Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Wed, 11 Nov 2009 23:39:09 +0200 Subject: [PATCH] some functions related to d'n'd are written --- gdk/gdk.objects.lisp | 9 +++++++++ gtk/cl-gtk2-gtk.asd | 2 ++ gtk/gtk.tree-view.lisp | 40 +++++++++++++++++++++++++++++++++++++--- gtk/gtk.widget.lisp | 13 ++++++++++++- 4 files changed, 60 insertions(+), 4 deletions(-) diff --git a/gdk/gdk.objects.lisp b/gdk/gdk.objects.lisp index 78774d5..9326171 100644 --- a/gdk/gdk.objects.lisp +++ b/gdk/gdk.objects.lisp @@ -435,6 +435,15 @@ (:bilevel 0) (:full 1)) +(define-g-flags "GdkDragAction" drag-action + (:export t :type-initializer "gdk_drag_action_get_type") + (:default 1) + (:copy 2) + (:move 4) + (:link 8) + (:private 16) + (:ask 32)) + (define-g-enum "GdkColorspace" colorspace () :rgb) diff --git a/gtk/cl-gtk2-gtk.asd b/gtk/cl-gtk2-gtk.asd index a602476..823139e 100644 --- a/gtk/cl-gtk2-gtk.asd +++ b/gtk/cl-gtk2-gtk.asd @@ -23,6 +23,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.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