X-Git-Url: https://git.distorted.org.uk/~mdw/clg/blobdiff_plain/9ba1aab1e5ad3f9758d8bdbfdaaae3c43152716c..476522a040d78b0b4b92fecf3c8f6395cad82a9f:/examples/testgtk.lisp diff --git a/examples/testgtk.lisp b/examples/testgtk.lisp index 6a5b116..04047c2 100644 --- a/examples/testgtk.lisp +++ b/examples/testgtk.lisp @@ -23,16 +23,17 @@ ;; Parts of this file are direct translations of code from 'testgtk.c' ;; distributed with the Gtk+ library, and thus covered by the GNU ;; Lesser General Public License and copyright Peter Mattis, Spencer -;; Kimball, Josh MacDonald and others. +;; Kimball, Josh MacDonald and others. To be safe the entire file +;; should probably be considered as being GPL'ed. -;; $Id: testgtk.lisp,v 1.37 2006-09-15 07:44:00 espen Exp $ +;; $Id: testgtk.lisp,v 1.44 2008-12-09 19:37:19 espen Exp $ #+sbcl(require :gtk) #+(or cmu clisp)(asdf:oos 'asdf:load-op :gtk) (defpackage "TESTGTK" - (:use "COMMON-LISP" "GTK")) + (:use "COMMON-LISP" "CLG")) (in-package "TESTGTK") @@ -537,14 +538,14 @@ (unless file-pixbuf (handler-case (setf - file-pixbuf (gdk:pixbuf-load #p"/usr/share/icons/gnome/48x48/filesystems/gnome-fs-regular.png") - folder-pixbuf (gdk:pixbuf-load #p"/usr/share/icons/gnome/48x48/filesystems/gnome-fs-directory.png")) + file-pixbuf (gdk:pixbuf-load #p"clg:examples;gnome-fs-regular.png") + folder-pixbuf (gdk:pixbuf-load #p"clg:examples;gnome-fs-directory.png")) (glib:glib-error (condition) (make-instance 'message-dialog :message-type :error :visible t :text "Failed to load an image" :secondary-text (glib:gerror-message condition) - :signal (list :close #'widget-destroy :object t)) + :signal (list :ok #'widget-destroy :object t)) (return-from load-pixbufs nil)))) t) @@ -950,8 +951,8 @@ This one is underlined in quite a funky fashion" (define-simple-dialog create-notebook (dialog "Notebook") (let ((main (make-instance 'v-box :parent dialog))) - (let ((book-open (gdk:pixbuf-new-from-xpm-data book-open-xpm)) - (book-closed (gdk:pixbuf-new-from-xpm-data book-closed-xpm)) + (let ((book-open (make-instance 'gdk:pixbuf :source book-open-xpm)) + (book-closed (make-instance 'gdk:pixbuf :source book-closed-xpm)) (notebook (make-instance 'notebook :border-width 10 :tab-pos :top :parent main))) @@ -1701,7 +1702,7 @@ This one is underlined in quite a funky fashion" :tip-private "Toolbar/Horizontal" :signal (list 'clicked #'(lambda (toolbar) - (setf (toolbar-orientation toolbar) :horizontal)) + (setf (orientable-orientation toolbar) :horizontal)) :object :parent)) :child (make-instance 'tool-button @@ -1710,7 +1711,7 @@ This one is underlined in quite a funky fashion" :tip-private "Toolbar/Vertical" :signal (list 'clicked #'(lambda (toolbar) - (setf (toolbar-orientation toolbar) :vertical)) + (setf (orientable-orientation toolbar) :vertical)) :object :parent)) :child (make-instance 'separator-tool-item) @@ -1795,7 +1796,7 @@ This one is underlined in quite a funky fashion" :child (create-label "Below"))) -;;; Tooltips test +;;; Tooltips test. Note that GtkTooltips has been deprecated in GTK+ 2.12 (define-simple-dialog create-tooltips (dialog "Tooltips" :default-width 200) (let ((tooltips (make-instance 'tooltips))) @@ -1909,7 +1910,7 @@ This one is underlined in quite a funky fashion" ;;; Main window -(defun create-main-window () +(defun create-main-window (&optional display) (let* ((button-specs '(("button box" create-button-box) ("buttons" create-buttons) @@ -1919,7 +1920,7 @@ This one is underlined in quite a funky fashion" ("cursors" create-cursors) ("dialog" create-dialog) ("entry" create-entry) - ("enxpander" create-expander) + ("expander" create-expander) ("file chooser" create-file-chooser) ("font selection" create-font-selection) ("handle box" create-handle-box) @@ -1954,6 +1955,7 @@ This one is underlined in quite a funky fashion" ("UI manager" create-ui-manager))) (main-window (make-instance 'window + :display display :title "testgtk.lisp" :name "main_window" :default-width 200 :default-height 400 :allow-grow t :allow-shrink nil)) @@ -1963,7 +1965,7 @@ This one is underlined in quite a funky fashion" :border-width 10)) (close-button (make-instance 'button :stock "gtk-close" :can-default t - :signal (list 'clicked #'widget-destroy :object main-window)))) + :signal (list 'clicked #'widget-destroy :object main-window)))) (let ((icon (gdk:pixbuf-load #p"clg:examples;gtk.png"))) (setf @@ -2007,5 +2009,4 @@ This one is underlined in quite a funky fashion" main-window)) (clg-init) -(create-main-window) - +(within-main-loop (create-main-window))