/[gtk-cffi]/gtk-cffi/gtk/image.lisp
ViewVC logotype

Contents of /gtk-cffi/gtk/image.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations)
Tue Jul 31 17:57:12 2012 UTC (20 months, 2 weeks ago) by rklochkov
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +4 -4 lines
Added pack of Gtk*Buttons
1 ;;;
2 ;;; image.lisp -- GtkImage
3 ;;;
4 ;;; Copyright (C) 2012, Roman Klochkov <kalimehtar@mail.ru>
5 ;;;
6
7 (in-package :gtk-cffi)
8
9 (defclass image (misc)
10 ())
11
12 (defcfun gtk-image-new-from-file :pointer (filename cffi-pathname))
13 (defcfun gtk-image-new-from-icon-set :pointer
14 (icon-set pobject) (icon-size icon-size))
15 (defcfun gtk-image-new-from-pixbuf :pointer (pixbuf pobject))
16 (defcfun gtk-image-new-from-icon-name :pointer
17 (icon-name :string) (icon-size icon-size))
18 (defcfun gtk-image-new-from-animation :pointer (animation pobject))
19 (defcfun gtk-image-new-from-stock :pointer
20 (stock-id cffi-keyword) (size icon-size))
21 (defcfun gtk-image-new-from-gicon :pointer
22 (gicon pobject) (icon-size icon-size))
23 (defcfun gtk-image-new :pointer)
24
25 (defmethod gconstructor ((image image)
26 &key file pixbuf stock-id gicon
27 icon-size icon-name icon-set animation)
28 (cond
29 (file (gtk-image-new-from-file file))
30 (pixbuf (gtk-image-new-from-pixbuf pixbuf))
31 (stock-id (gtk-image-new-from-stock stock-id icon-size))
32 (icon-set (gtk-image-new-from-icon-set icon-set icon-size))
33 (icon-name (gtk-image-new-from-icon-name icon-name icon-size))
34 (animation (gtk-image-new-from-animation animation))
35 (gicon (gtk-image-new-from-gicon gicon icon-size))
36 (t (gtk-image-new))))
37
38 (defslots image
39 pixel-size :int)
40
41
42 (defcfun gtk-image-set-from-file :pointer (image pobject) (filename :string))
43 (defcfun gtk-image-set-from-icon-set :pointer
44 (image pobject) (icon-set pobject) (icon-size icon-size))
45 (defcfun gtk-image-set-from-pixbuf :pointer (image pobject) (pixbuf pobject))
46 (defcfun gtk-image-set-from-icon-name :pointer (image pobject)
47 (icon-name :string) (icon-size icon-size))
48 (defcfun gtk-image-set-from-animation :pointer (image pobject)
49 (animation pobject))
50 (defcfun gtk-image-set-from-stock :pointer
51 (image pobject) (stock-id :string) (size icon-size))
52 (defcfun gtk-image-set-from-gicon :pointer
53 (image pobject) (gicon pobject) (icon-size icon-size))
54
55
56 (defmethod reinitialize-instance ((image image) &key file pixbuf stock-id gicon
57 icon-size icon-name icon-set animation)
58 (cond
59 (file (gtk-image-set-from-file image file))
60 (pixbuf (gtk-image-set-from-pixbuf image pixbuf))
61 (stock-id (gtk-image-set-from-stock image stock-id icon-size))
62 (icon-set (gtk-image-set-from-icon-set image icon-set icon-size))
63 (icon-name (gtk-image-set-from-icon-name image icon-name icon-size))
64 (animation (gtk-image-set-from-animation image animation))
65 (gicon (gtk-image-set-from-gicon image gicon icon-size))
66 (t (clear image))))
67
68 (defcenum image-type
69 :empty :pixbuf :stock :icon-set :animation :icon-name :gicon)
70
71 (deffuns image
72 (:get pixbuf pobject)
73 (:get animation pobject)
74 (:get storage-type image-type)
75 (clear :void))
76
77 (defcfun gtk-image-get-icon-set :void (image pobject) (icon-set :pointer)
78 (icon-size :pointer))
79 (defgeneric icon-set (image)
80 (:method ((image image))
81 (with-foreign-outs ((icon-set 'pobject) (icon-size 'icon-size)) :ignore
82 (gtk-image-get-icon-set image icon-set icon-size))))
83
84 (defcfun gtk-image-get-gicon :void (image pobject) (gicon :pointer)
85 (icon-size :pointer))
86 (defgeneric gicon (image)
87 (:method ((image image))
88 (with-foreign-outs ((gicon 'pobject) (icon-size 'icon-size)) :ignore
89 (gtk-image-get-gicon image gicon icon-size))))
90
91 (defcfun gtk-image-get-icon-name :void (image pobject)
92 (icon-name :pointer) (icon-size :pointer))
93 (defmethod icon-name ((image image))
94 (with-foreign-outs ((icon-name :string) (icon-size 'icon-size)) :ignore
95 (gtk-image-get-icon-set image icon-name icon-size)))
96
97 (defcfun gtk-image-get-stock :void (image pobject)
98 (stock :pointer) (icon-size :pointer))
99 (defgeneric stock (image)
100 (:method ((image image))
101 (with-foreign-outs ((stock :string) (icon-size 'icon-size)) :ignore
102 (gtk-image-get-stock image stock icon-size))))
103
104
105

  ViewVC Help
Powered by ViewVC 1.1.5