Add gdk_pixbuf_new_from_file
[cl-gtk2.git] / doc / hello.lisp
blob3b1e16d582c8f6f52485472a99a3ae2be12d3646
1 (defpackage :gtk-hello
2 (:use :cl :gtk :gobject :glib)
3 (:export :run))
5 (in-package :gtk-hello)
7 (defun run ()
8 (let ((output *standard-output*))
9 (with-main-loop
10 (let ((window (make-instance 'gtk-window
11 :type :toplevel
12 :window-position :center
13 :title "Hello world!"
14 :default-width 300
15 :default-height 100))
16 (button (make-instance 'button :label "Hello, world!"))
17 (counter 0))
18 (g-signal-connect button "clicked"
19 (lambda (b)
20 (declare (ignore b))
21 (format output "Hello, world!~%")
22 (setf (button-label button)
23 (format nil
24 "Hello, world! (clicked ~D times)"
25 (incf counter)))))
26 (container-add window button)
27 (widget-show window :all t)))))