/[gtk-cffi]/gtk-cffi/gtk/spin-button.lisp
ViewVC logotype

Contents of /gtk-cffi/gtk/spin-button.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Sat Mar 23 13:14:23 2013 UTC (12 months, 4 weeks ago) by rklochkov
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +6 -8 lines
1
1 ;;;
2 ;;; spin-button.lisp -- GtkSpinButton
3 ;;;
4 ;;; Copyright (C) 2012, Roman Klochkov <kalimehtar@mail.ru>
5 ;;;
6 (in-package :gtk-cffi)
7
8 (defclass spin-button (entry)
9 ())
10
11 (defcfun gtk-spin-button-new :pointer (adjustment pobject) (climb-rate :double)
12 (digits :uint))
13 (defcfun gtk-spin-button-new-with-range :pointer (min :double) (max :double)
14 (step :double))
15
16 (defmethod gconstructor ((spin-button spin-button)
17 &key adjustment climb-rate digits
18 (min 0.0d0) (max 0.0d0) (step 0.0d0) &allow-other-keys)
19 (initialize spin-button '(adjustment digits))
20 (if adjustment
21 (gtk-spin-button-new adjustment climb-rate digits)
22 (gtk-spin-button-new-with-range min max step)))
23
24 (defcfun gtk-spin-button-configure :void (spin-button pobject)
25 (adjustment pobject) (climb-rate :double) (digits :uint))
26
27 (defmethod reinitialize-instance ((spin-button spin-button)
28 &key adjustment climb-rate digits)
29 (gtk-spin-button-configure spin-button adjustment climb-rate digits))
30
31 (defcenum spin-button-update-policy :always :if-valid)
32
33 (defcenum spin-type
34 :step-forward :step-backward :page-forward :page-backward
35 :home :end :user-defined)
36
37 (defslots spin-button
38 adjustment pobject
39 digits :int
40 value :double
41 update-policy spin-button-update-policy
42 numeric :boolean
43 wrap :boolean
44 snap-to-ticks :boolean)
45
46 (deffuns spin-button
47 (spin :void (direction spin-type) (increment :double))
48 (update :void)
49 (:get value-as-int :int))
50
51 (defcfun gtk-spin-button-set-increments :void (spin-button pobject)
52 (step :double) (page :double))
53 (defcfun gtk-spin-button-get-increments :void (spin-button pobject)
54 (step :pointer) (page :pointer))
55
56 (defgeneric increments (spin-button)
57 (:method ((spin-button spin-button))
58 (with-foreign-outs-list ((step :double) (page :double)) :ignore
59 (gtk-spin-button-get-increments spin-button step page))))
60
61 (defmethod (setf increments) (value (spin-button spin-button))
62 (destructuring-bind (step page) value
63 (gtk-spin-button-set-increments spin-button step page)))
64 (save-setter spin-button increments)
65
66 (defcfun gtk-spin-button-set-range :void (spin-button pobject)
67 (min :double) (max :double))
68 (defcfun gtk-spin-button-get-range :void (spin-button pobject)
69 (min :pointer) (max :pointer))
70
71 (defgeneric range (spin-button)
72 (:method ((spin-button spin-button))
73 (with-foreign-outs-list ((min :double) (max :double)) :ignore
74 (gtk-spin-button-get-range spin-button min max))))
75
76 (defmethod (setf range) (value (spin-button spin-button))
77 (destructuring-bind (min max) value
78 (gtk-spin-button-set-range spin-button min max)))
79 (save-setter spin-button range)
80
81
82 (init-slots spin-button)
83

  ViewVC Help
Powered by ViewVC 1.1.5