[gtk-cffi-cvs] CVS gtk-cffi/examples
CVS User rklochkov
rklochkov at common-lisp.net
Mon Aug 8 15:02:01 UTC 2011
Update of /project/gtk-cffi/cvsroot/gtk-cffi/examples
In directory tiger.common-lisp.net:/tmp/cvs-serv32663/examples
Modified Files:
ex2.lisp ex5.lisp ex6.lisp ex7.lisp ex8.lisp
Log Message:
Major commit. Now all exerices ex*.lisp work perfectly.
Added lisp-array model for tree-view (see ex9).
--- /project/gtk-cffi/cvsroot/gtk-cffi/examples/ex2.lisp 2011/04/25 19:16:08 1.1.1.1
+++ /project/gtk-cffi/cvsroot/gtk-cffi/examples/ex2.lisp 2011/08/08 15:02:01 1.2
@@ -31,7 +31,7 @@
(cffi:defcallback on-delete :boolean ((widget :pointer)
(event :pointer)
(module gtk-string))
- (declare (ignore widget))
+ (declare (ignore widget event))
(unless (string= module "main")
(hide (gethash module *apps*))
(show (gethash "main" *apps*) :all t)
@@ -115,11 +115,15 @@
(setup-app module))) *mods*)
(let ((main-dialog (gethash "main" *apps*)))
- ;(show main-dialog :all t)
+ (show main-dialog :all t)
(run main-dialog)
(format t "here end~%")
(destroy main-dialog))
+;; Cleanup after dialog
+(g-object-cffi::timeout-add :idle #'gtk-main-quit)
+(gtk-main)
+
;(setf window (make-instance 'window))
;(set-border-width window 6)
--- /project/gtk-cffi/cvsroot/gtk-cffi/examples/ex5.lisp 2011/04/25 19:16:08 1.1.1.1
+++ /project/gtk-cffi/cvsroot/gtk-cffi/examples/ex5.lisp 2011/08/08 15:02:01 1.2
@@ -1,7 +1,7 @@
(asdf:oos 'asdf:load-op :gtk-cffi)
(defpackage #:test
- (:use #:common-lisp #:gtk-cffi #:gobject-cffi))
+ (:use #:common-lisp #:gtk-cffi #:g-object-cffi))
(in-package #:test)
(gtk-init)
@@ -12,7 +12,7 @@
(size-request window) '(400 150))
-(setf (bg-pixmap window :normal) "/usr/share/pixmaps/gqview.png")
+(setf (bg-pixmap window :normal) "/usr/share/pixmaps/gnome-color-browser.png")
(show window)
--- /project/gtk-cffi/cvsroot/gtk-cffi/examples/ex6.lisp 2011/04/25 19:16:08 1.1.1.1
+++ /project/gtk-cffi/cvsroot/gtk-cffi/examples/ex6.lisp 2011/08/08 15:02:01 1.2
@@ -3,7 +3,8 @@
(asdf:oos 'asdf:load-op :gtk-cffi)
(defpackage #:test
- (:use #:common-lisp #:gdk-cffi #:gtk-cffi #:gobject-cffi))
+ (:use #:common-lisp #:gdk-cffi #:gtk-cffi #:g-object-cffi)
+ (:shadowing-import-from #:gtk-cffi #:image #:window))
(in-package #:test)
(gtk-init)
@@ -36,10 +37,10 @@
(format t "~a ~a ~a~%" widget event img)
(let* ((pixbuf (make-instance 'pixbuf :file img))
(w (width pixbuf))
- (h (height pixbuf))
+ ;(h (height pixbuf))
(dest-x (- (allocation-width (allocation widget)) w))
(dest-y 0))
- (draw-pixbuf (gdkwindow widget)
+ (draw-pixbuf (gdk-window widget)
(style-field widget :bg-gc) pixbuf 0 0 dest-x dest-y)
(let ((ch (child widget)))
(when ch
@@ -47,9 +48,10 @@
t))
-(let ((eventbox-left (make-instance 'event-box)))
+(let ((eventbox-left (make-instance 'event-box))
+ (vbox-left (make-instance 'v-box :homogeneous t)))
(pack hbox eventbox-left :expand t :fill t)
- (add eventbox-left (setf vbox-left (make-instance 'v-box :homogeneous t)))
+ (add eventbox-left vbox-left)
(pack* vbox-left
((make-instance 'label :text "This is left eventbox."))
((make-instance 'label :text "The green ball is the bg image."))
--- /project/gtk-cffi/cvsroot/gtk-cffi/examples/ex7.lisp 2011/04/25 19:16:08 1.1.1.1
+++ /project/gtk-cffi/cvsroot/gtk-cffi/examples/ex7.lisp 2011/08/08 15:02:01 1.2
@@ -1,8 +1,11 @@
(asdf:oos 'asdf:load-op :gtk-cffi)
(declaim (optimize speed))
-(defpackage #:test
- (:use #:common-lisp #:gtk-cffi #:gobject-cffi))
-(in-package #:test)
+(defpackage #:ex7
+ (:use #:common-lisp #:gtk-cffi #:g-object-cffi))
+(in-package #:ex7)
+
+(defvar *window*)
+(defvar *cell-pix*)
(defun main ()
(gtk-init)
@@ -14,7 +17,7 @@
(let ((window (make-instance 'window :width 400 :height 280)))
(setf (gsignal window :destroy) :gtk-main-quit)
- (defvar *window* window)
+ (setf *window* window)
(let ((v-box (make-instance 'v-box))
(data '(("01-01-08" "Some event")
@@ -53,7 +56,7 @@
(when (= col 1)
(setf (property cell-renderer :editable) t)
- (defvar *cell-pix* (make-instance 'cell-renderer-pixbuf))
+ (setf *cell-pix* (make-instance 'cell-renderer-pixbuf))
(pack column *cell-pix*)
(setf (property *cell-pix* :pixbuf)
(make-instance 'gdk-cffi:pixbuf
@@ -62,6 +65,7 @@
(setf (gsignal cell-renderer :edited)
(let ((%col col))
(lambda (cell path new-text)
+ (declare (ignore cell))
(path->iter model path)
(setf (model-values model
:col %col)
@@ -73,7 +77,7 @@
(gsignal view :button-press-event)
(lambda (view event)
(when (and (eq (gdk-cffi:get-slot event :type) :button-press)
- (= (gdk-cffi:get-slot event :button) 1))
+ (= (the integer (gdk-cffi:get-slot event :button)) 1))
(with-path-at-pos view
(round (gdk-cffi:get-slot event :x))
(round (gdk-cffi:get-slot event :y))
@@ -94,7 +98,7 @@
(defun set-bold (view column)
(format t "set ~A~%" column)
(loop :for col :in (columns view)
- :for i :from 0
+ :for i :from 0 :to 100
:do (progn
(setf (font (widget col))
(if (equal col column)
@@ -104,6 +108,7 @@
(defun on-click (view path-list)
(destructuring-bind (path column x y) path-list
+ (declare (ignore y))
(let ((cell (get-cell-at column x)))
(format t "cell: ~A~%" cell)
(when (equal cell *cell-pix*)
@@ -118,7 +123,7 @@
(let ((top-area (v-box dialog)))
(pack top-area text-view :pack-fill t :expand t)
(show text-view))
- (set-position dialog :center-on-parent)
+ (setf (win-position dialog) :center-on-parent)
;(pack top-area text-view :fill t :expand t))
(run dialog)
--- /project/gtk-cffi/cvsroot/gtk-cffi/examples/ex8.lisp 2011/04/25 19:16:08 1.1.1.1
+++ /project/gtk-cffi/cvsroot/gtk-cffi/examples/ex8.lisp 2011/08/08 15:02:01 1.2
@@ -4,7 +4,7 @@
(asdf:oos 'asdf:load-op :closer-mop)
(defpackage #:test
- (:use #:common-lisp #:gtk-cffi #:gobject-cffi))
+ (:use #:common-lisp #:gtk-cffi #:g-object-cffi))
(in-package #:test)
(defun main ()
More information about the gtk-cffi-cvs
mailing list