chiark / gitweb /
New method CREATE-CALLBACK-FUNCTION
authorespen <espen>
Thu, 6 Jan 2005 21:00:51 +0000 (21:00 +0000)
committerespen <espen>
Thu, 6 Jan 2005 21:00:51 +0000 (21:00 +0000)
gtk/gtkcontainer.lisp
gtk/gtkwidget.lisp

index a6981c692257dc313c6d7e44e173f39533e0ee16..6729eb397973606976efb23159a4ac81860a9d33 100644 (file)
@@ -15,7 +15,7 @@
 ;; License along with this library; if not, write to the Free Software
 ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-;; $Id: gtkcontainer.lisp,v 1.15 2004-12-29 21:14:23 espen Exp $
+;; $Id: gtkcontainer.lisp,v 1.16 2005-01-06 21:00:53 espen Exp $
 
 (in-package "GTK")
 
@@ -30,6 +30,15 @@ (defmethod shared-initialize ((container container) names &rest initargs
    initargs :child :children))
 
 
+(defmethod create-callback-function ((container container) function arg1)
+  (if (eq arg1 :children)
+      #'(lambda (&rest args)
+         (mapc #'(lambda (child)
+                   (apply function child (rest args)))
+               (container-children container)))
+    (call-next-method)))
+
+
 (defbinding %container-add () nil
   (container container)
   (widget widget))
index 0320921c87d64d23766ac3db5ff1f59bc70508f1..c680614852edfb2d3a2772a4007c45fc9663b9a5 100644 (file)
@@ -15,7 +15,7 @@
 ;; License along with this library; if not, write to the Free Software
 ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-;; $Id: gtkwidget.lisp,v 1.13 2004-12-20 20:09:53 espen Exp $
+;; $Id: gtkwidget.lisp,v 1.14 2005-01-06 21:00:51 espen Exp $
 
 (in-package "GTK")
 
@@ -49,7 +49,23 @@ (defmethod slot-unbound ((class gobject-class) (object widget) slot)
        :parent parent :child object))))
    (t (call-next-method))))
 
-
+(defmethod create-callback-function ((widget widget) function arg1)
+  (if (eq arg1 :parent)
+      #'(lambda (&rest args)
+         (if (slot-boundp widget 'parent)
+             (apply function (widget-parent widget) (rest args))
+           (signal-connect widget 'parent-set
+            #'(lambda (old-parent)
+                (declare (ignore old-parent))
+                (let ((*signal-stop-emission* 
+                       #'(lambda ()
+                           (warn "Ignoring emission stop in delayed signal handler"))))
+                  (apply function (widget-parent widget) (rest args))))
+            :remove t)
+;          (warn "Widget has no parent -- ignoring signal")
+           ))
+    (call-next-method)))
+      
 (defun child-property-value (widget slot)
   (slot-value (widget-child-properties widget) slot))