X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/clg/blobdiff_plain/56ccd5b731e30f2d195cefc4cbf0b8640fac2c92..18b84c8043e09adb90c047fd5dfe6860e26b27e8:/gtk/gtk.lisp diff --git a/gtk/gtk.lisp b/gtk/gtk.lisp index 5ba1626..f054449 100644 --- a/gtk/gtk.lisp +++ b/gtk/gtk.lisp @@ -20,7 +20,7 @@ ;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -;; $Id: gtk.lisp,v 1.54 2006-02-19 19:31:14 espen Exp $ +;; $Id: gtk.lisp,v 1.61 2006-04-25 13:37:29 espen Exp $ (in-package "GTK") @@ -45,7 +45,7 @@ (defun gtk-version () (format nil "Gtk+ v~A.~A.~A" major minor micro)))) (defun clg-version () - "clg 0.91 version") + "clg 0.92.1") ;;;; Initalization @@ -73,6 +73,29 @@ (defun clg-init (&optional display) (setq *max-event-to-sec* 0) (setq *max-event-to-usec* 1000)))) +#+sbcl +(defun clg-init-with-threading (&optional display) + "Initializes the system and starts the event handling" + (unless (gdk:display-get-default) + (gdk:gdk-init) + (gdk:threads-set-lock-functions) + (unless (gtk-init) + (error "Initialization of GTK+ failed.")) + (sb-thread:make-thread + #'(lambda () + (gdk:display-open display) + (gdk:with-global-lock (main))) + :name "gtk event loop"))) + + +;;; Generic functions + +(defgeneric add-to-radio-group (item1 item2)) +(defgeneric activate-radio-widget (item)) +(defgeneric (setf tool-item-tip-text) (tip-text tool-item)) +(defgeneric (setf tool-item-tip-private) (tip-private tool-item)) + + ;;; Misc @@ -695,8 +718,8 @@ (defbinding alternative-dialog-button-order-p (&optional screen) boolean #+gtk2.6 (defbinding (dialog-set-alternative-button-order - "gtk_dialog_set_alternative_button_order_from_array") - (dialog new-order) + "gtk_dialog_set_alternative_button_order_from_array") + (dialog new-order) nil (dialog dialog) ((length new-order) int) ((map 'vector #'(lambda (response) @@ -1202,6 +1225,16 @@ (defmethod initialize-instance ((window window) &rest initargs (initial-add window #'window-add-accel-group initargs :accel-group :accel-groups))) +#-debug-ref-counting +(defmethod print-object ((window window) stream) + (if (and + (proxy-valid-p window) + (slot-boundp window 'title) + (not (zerop (length (window-title window))))) + (print-unreadable-object (window stream :type t :identity nil) + (format stream "~S at 0x~X" + (window-title window) (sap-int (foreign-location window)))) + (call-next-method))) (defbinding window-set-wmclass () nil (window window) @@ -1825,7 +1858,7 @@ (defun (setf menu-active) (menu child) (define-callback %menu-detach-callback nil ((widget widget) (menu menu)) (funcall (object-data menu 'detach-func) widget menu)) -(defbinding %menu-attach-to-widget () nil +(defbinding %menu-attach-to-widget (menu widget) nil (menu menu) (widget widget) (%menu-detach-callback callback)) @@ -2235,13 +2268,22 @@ (defbinding %stock-lookup () boolean (location pointer)) (defun stock-lookup (stock-id) - (let ((location - (allocate-memory (foreign-size (find-class 'stock-item))))) - (unwind-protect - (when (%stock-lookup stock-id location) - (ensure-proxy-instance 'stock-item (%stock-item-copy location))) - (deallocate-memory location)))) + (with-allocated-memory (stock-item (foreign-size (find-class 'stock-item))) + (when (%stock-lookup stock-id stock-item) + (ensure-proxy-instance 'stock-item (%stock-item-copy stock-item))))) +#+gtk2.8 +(progn + (define-callback-marshal %stock-translate-callback string ((path string))) + + (defbinding (stock-set-translate-function "gtk_stock_set_translate_func") + (domain function) nil + (domain string) + (%stock-translate-callback callback) + ((register-callback-function function) unsigned-int) + (user-data-destroy-callback callback))) + + ;;; Tooltips @@ -2276,16 +2318,64 @@ (defbinding tooltips-get-info-from-tip-window () boolean ;;; Resource Files -(defbinding rc-add-default-file (filename) nil - ((namestring (truename filename)) string)) +(defbinding rc-get-style () style + (widget widget)) -(defbinding rc-parse (filename) nil - ((namestring (truename filename)) string)) +(defbinding rc-get-style-by-paths (&key path class-path class) style + (path (or null string)) + (class-path (or null string)) + (class gtype)) + +(defbinding rc-parse () nil + (filename pathname)) (defbinding rc-parse-string () nil (rc-string string)) -(defbinding rc-reparse-all () nil) +(defbinding %rc-reparse-all () boolean) -(defbinding rc-get-style () style - (widget widget)) +(defbinding %rc-reparse-all-for-settings () boolean + (settings settings) + (force-load-p boolean)) + +(defun rc-reparse-all (&optional setting force-load-p) + (if setting + (%rc-reparse-all-for-settings setting force-load-p) + (%rc-reparse-all))) + +(defbinding rc-reset-styles () nil + (settings settings)) + +(defbinding rc-add-default-file () nil + (filename pathname)) + +(defbinding rc-get-default-files () + (copy-of (null-terminated-vector (copy-of string)))) + +(defbinding rc-get-module-dir () string) + +(defbinding rc-get-im-module-path () string) + +(defbinding rc-get-im-module-file () string) + +(defbinding rc-get-theme-dir () string) + + +;;; Settings + +(defbinding (settings-get "gtk_settings_get_for_screen") + (&optional (screen (gdk:display-get-default-screen))) settings + (screen gdk:screen)) + + +;;; Plug and Socket + +(defbinding socket-add-id () nil + (socket socket) + (id gdk:native-window)) + +(defbinding %plug-new () pointer + (id gdk:native-window)) + +(defmethod allocate-foreign ((plug plug) &key id) + (%plug-new (or id 0)))