/[gtk-cffi]/gtk-cffi/examples/ex1.lisp
ViewVC logotype

Contents of /gtk-cffi/examples/ex1.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (vendor branch)
Mon Apr 25 19:16:08 2011 UTC (2 years, 11 months ago) by rklochkov
Branch: slavsoft
CVS Tags: initial
Changes since 1.1: +0 -0 lines

Initial release
1 rklochkov 1.1 (asdf:oos 'asdf:load-op :gtk-cffi)
2    
3     (defpackage #:test-ex1
4     (:use #:common-lisp #:gtk-cffi #:g-object-cffi))
5     (in-package #:test-ex1)
6    
7     (cffi:defcallback hello :void ((widget pobject) (data pdata))
8     (format t "Превед ~a from ~a~%" data widget))
9    
10     (gtk-init)
11    
12     (defvar window)
13     (defvar button)
14    
15     (setf window (make-instance 'window :name "Example 1"))
16    
17     (setf (bg-pixmap window) "/usr/share/pixmaps/gqview.png")
18    
19     (setf (property window :resize-mode) :immediate)
20    
21     (setf (gsignal window "delete-event")
22     (let ((i 0))
23     (lambda (widget event)
24     (format t "delete event ~a~%" (incf i))
25     (format t "~& widget = ~a ~a~%" widget (name widget))
26     (format t "~& event = ~a~%" event)
27     (format t "~& child = ~a~%" (child widget))
28     ;(gobject-cffi::show-properties widget)
29     t)))
30    
31     (setf (gsignal window :destroy) :gtk-main-quit)
32    
33     (setf (border-width window) 25)
34    
35     (setf (default-size window) '(400 100))
36    
37     (setf button (make-instance 'button :label "gtk-index" :type :stock))
38    
39     (setf (font button) "Times New Roman Italic 24")
40    
41     (setf (color button) "#0000ff")
42    
43     (setf (gsignal button :clicked :data "Медвед") (cffi:callback hello)
44     (gsignal button "clicked" :data window
45     :swapped t) "gtk-widget-destroy")
46    
47    
48     (add window button)
49    
50     (show button)
51    
52     (show window)
53    
54     (gtk-main)
55    

  ViewVC Help
Powered by ViewVC 1.1.5