Initial bindings for tree and list widgets
[clg] / gtk / gtk.lisp
index 22014c4..a4451cf 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: gtk.lisp,v 1.13 2004-10-31 12:05:52 espen Exp $
+;; $Id: gtk.lisp,v 1.16 2004-11-07 01:23:38 espen Exp $
 
 
 (in-package "GTK")
 (defbinding get-default-language () string)
 
 
+;;;; Initalization
+
+(defbinding (gtk-init "gtk_parse_args") () nil
+  "Initializes the library without opening the display."
+  (nil null)
+  (nil null))
+
+(defun clg-init (&optional display)
+  "Initializes the system and starts the event handling"
+  (unless (gdk:display-get-default)
+    (gdk:gdk-init)
+    (gtk-init)
+    (prog1
+       (gdk:display-open display)
+      (system:add-fd-handler 
+       (gdk:display-connection-number) :input #'main-iterate-all)
+      (setq lisp::*periodic-polling-function* #'main-iterate-all)
+      (setq lisp::*max-event-to-sec* 0)
+      (setq lisp::*max-event-to-usec* 1000))))
+
+
 ;;; Acccel group
 
 
 
 (defmethod shared-initialize ((combo combo) names &rest initargs
                              &key popdown-strings)
+  (declare (ignore initargs))
   (call-next-method)
   (when popdown-strings
     (combo-set-popdown-strings combo popdown-strings)))
 ;;;; Dialog
 
 (defmethod shared-initialize ((dialog dialog) names &rest initargs &key button)
+  (declare (ignore button))
   (call-next-method)
   (dolist (button-definition (get-all initargs :button))
     (apply #'dialog-add-button dialog (mklist button-definition))))
   (edge gdk:window-edge)
   (button int)
   (root-x int) (root-y int)
-  (timestamp (unsigned-int 32)))
+  (timestamp unsigned-int))
 
 (defbinding window-begin-move-drag () nil
   (window window)
   (edge gdk:window-edge)
   (button int)
   (root-x int) (root-y int)
-  (timestamp (unsigned-int 32)))
+  (timestamp unsigned-int))
 
 (defbinding window-set-frame-dimensions () nil
   (window window)
   (menu-item menu-item)
   ((%menu-position menu position) int))
 
-(defvar *menu-position-callback-marshal*
-  (system:foreign-symbol-address "gtk_menu_position_callback_marshal"))
+(def-callback-marshal %menu-popup-callback (nil (x int) (y int) (push-in boolean)))
 
 (defbinding %menu-popup () nil
   (menu menu)
        (unwind-protect
            (%menu-popup
             menu parent-menu-shell parent-menu-item
-            *menu-position-callback-marshal* callback-id button activate-time)
+            (callback %menu-popup-callback)
+            callback-id button activate-time)
          (destroy-user-data callback-id)))
     (%menu-popup
      menu parent-menu-shell parent-menu-item nil 0 button activate-time)))