[gtk-cffi-cvs] CVS gtk-cffi/gtk

CVS User rklochkov rklochkov at common-lisp.net
Tue Aug 21 19:48:02 UTC 2012


Update of /project/gtk-cffi/cvsroot/gtk-cffi/gtk
In directory tiger.common-lisp.net:/tmp/cvs-serv19056/gtk

Modified Files:
	entry.lisp gtk-cffi.asd package.lisp scale.lisp 
	text-buffer.lisp 
Added Files:
	spin-button.lisp 
Log Message:
Summary: Added GtkSpinButton, GtkEditable


--- /project/gtk-cffi/cvsroot/gtk-cffi/gtk/entry.lisp	2012/08/19 15:45:26	1.7
+++ /project/gtk-cffi/cvsroot/gtk-cffi/gtk/entry.lisp	2012/08/21 19:48:02	1.8
@@ -1,11 +1,43 @@
 ;;;
-;;; entry.lisp -- GtkEntry, GtkEntryBuffer
+;;; entry.lisp -- GtkEditable, GtkEntry, GtkEntryBuffer, GtkEntryCompletion
 ;;;
 ;;; Copyright (C) 2012, Roman Klochkov <kalimehtar at mail.ru>
 ;;;
 
 (in-package :gtk-cffi)
 
+(defclass editable (object)
+  ())
+
+(defslots editable
+  (editable-position . position) :int
+  (is-editable . editable) :boolean)
+
+(deffuns editable
+  (select-region :void (start :int) (end :int))
+  (delete-text :void (start :int) (end :int))
+  (:get chars :string (start :int) (end :int))
+  (cut-clipboard :void &key)
+  (copy-clipboard :void &key)
+  (paste-clipboard :void &key)
+  (delete-selection :void &key))
+
+(init-slots editable)
+
+(defcfun gtk-editable-get-selection-bounds :void (editable pobject) 
+         (start :pointer) (end :pointer))
+
+(defmethod selection-bounds ((editable editable) &key)
+  (with-foreign-outs-list ((start :int) (end :int)) :ignore
+    (gtk-editable-get-selection-bounds editable start end)))
+
+(defcfun gtk-editable-insert-text :uint (editable pobject) 
+         (new-text :string) (new-text-length :int) (position :uint))
+
+(defgeneric insert-text (editable position text)
+  (:method ((editable editable) position text)
+    (gtk-editable-insert-text editable text (length text) position)))
+
 (defclass entry-buffer (g-object)
   ())
 
@@ -23,15 +55,14 @@
   (:set text :string &key)
   (:get bytes :int)
   ((entry-buffer-length . get-length) :uint)
-  (delete-text :uint (poistion :uint) (n-chars :int))
+  (delete-text :uint (position :uint) (n-chars :int))
   (emit-deleted-text :void (poistion :uint) (n-chars :int)))
 
 (defcfun gtk-entry-buffer-insert-text :uint 
   (entry-buffer pobject) (position :uint) (chars :string) (n-chars :int))
 
-(defgeneric insert-text (entry-buffer position text)
-  (:method ((entry-buffer entry-buffer) position text)
-    (gtk-entry-buffer-insert-text entry-buffer position text (length text))))
+(defmethod insert-text ((entry-buffer entry-buffer) position text)
+  (gtk-entry-buffer-insert-text entry-buffer position text (length text)))
 
 (defcfun gtk-entry-buffer-emit-inserted-text :uint 
   (entry-buffer pobject) (position :uint) (chars :string) (n-chars :int))
@@ -93,7 +124,7 @@
 (init-slots entry-completion)
 
 
-(defclass entry (widget)
+(defclass entry (widget editable)
   ())
 
 (defcfun gtk-entry-new :pointer)
--- /project/gtk-cffi/cvsroot/gtk-cffi/gtk/gtk-cffi.asd	2012/08/19 15:45:26	1.25
+++ /project/gtk-cffi/cvsroot/gtk-cffi/gtk/gtk-cffi.asd	2012/08/21 19:48:02	1.26
@@ -525,6 +525,15 @@
   :components
   ((:file scale)))
 
+(defsystem gtk-cffi-spin-button
+  :description "Interface to GTK/Glib via CFFI"
+  :author "Roman Klochkov <kalimehtar at mail.ru>"
+  :version "0.99"
+  :license "LLGPL"
+  :depends-on (gtk-cffi-entry)
+  :components
+  ((:file spin-button)))
+
 
 (defsystem gtk-cffi
   :description "Interface to GTK/Glib via CFFI"
@@ -535,7 +544,7 @@
                gtk-cffi-file-chooser-dialog
                gtk-cffi-file-chooser-button
                gtk-cffi-progress-bar
-               gtk-cffi-entry
+               gtk-cffi-spin-button
                gtk-cffi-color-button
                gtk-cffi-label
                gtk-cffi-paned
--- /project/gtk-cffi/cvsroot/gtk-cffi/gtk/package.lisp	2012/08/19 16:19:26	1.27
+++ /project/gtk-cffi/cvsroot/gtk-cffi/gtk/package.lisp	2012/08/21 19:48:02	1.28
@@ -368,6 +368,12 @@
    #:logo
    #:logo-icon-name 
 
+   #:editable
+   ;; slots
+   #:chars
+   #:editable-position
+   #:is-editable
+
    #:entry-completion
    ;; slots
    #:text-column
@@ -1055,6 +1061,17 @@
    #:has-origin
    ;; methods
    #:clear-marks
+
+   #:spin-button
+   ;; slots
+   #:numeric
+   #:update-policy
+   #:wrap
+   #:snap-to-ticks
+   ;; methods
+   #:value-as-int
+   #:update
+   #:spin
    ))
 
 (in-package #:gtk-cffi)
--- /project/gtk-cffi/cvsroot/gtk-cffi/gtk/scale.lisp	2012/08/19 16:19:26	1.2
+++ /project/gtk-cffi/cvsroot/gtk-cffi/gtk/scale.lisp	2012/08/21 19:48:02	1.3
@@ -39,4 +39,3 @@
     (gtk-scale-get-layout-offsets scale x y)))
 
 (init-slots scale)
-  
\ No newline at end of file
--- /project/gtk-cffi/cvsroot/gtk-cffi/gtk/text-buffer.lisp	2012/08/19 16:19:26	1.10
+++ /project/gtk-cffi/cvsroot/gtk-cffi/gtk/text-buffer.lisp	2012/08/21 19:48:02	1.11
@@ -1,3 +1,8 @@
+;;;
+;;; text-buffer.lisp -- GtkTextTagTable, GtkTextBuffer
+;;;
+;;; Copyright (C) 2012, Roman Klochkov <kalimehtar at mail.ru>
+;;;
 (in-package :gtk-cffi)
 
 (defclass text-tag-table (g-object)
@@ -76,7 +81,7 @@
   (is-cursor-position :boolean)
   (:get chars-in-line :int)
   (:get bytes-in-line :int)
-  (get-attributes :boolean (struct text-attributes :out t))
+  (get-attributes :boolean (attrib (struct text-attributes :out t)))
   (:get language pango-cffi:language)
   (is-end :boolean)
   (is-start :boolean)
@@ -195,11 +200,12 @@
   (select-range :void (ins (struct text-iter)) (bound (struct text-iter)))
   (remove-all-tags :void 
                    (start (struct text-iter)) (end (struct text-iter)))
-  (delete-selection :boolean (interactive :boolean) (default-editable :boolean))
-  (paste-clipboard :void (clipboard pobject) (location pobject) 
+  (delete-selection :boolean &key (interactive :boolean) 
+                    (default-editable :boolean))
+  (paste-clipboard :void &key (clipboard pobject) (location pobject) 
                    (default-editable :boolean))
-  (copy-clipboard :void (clipboard pobject))
-  (cut-clipboard :void (clipboard pobject) (default-editable :boolean))
+  (copy-clipboard :void &key (clipboard pobject))
+  (cut-clipboard :void &key (clipboard pobject) (default-editable :boolean))
   (begin-user-action :void)
   (end-user-action :void)
   (add-selection-clipboard :void (clipboard pobject))
@@ -438,7 +444,8 @@
 
 (defcfun gtk-text-buffer-deserialize :boolean 
   (register-buffer pobject) (content-buffer pobject) (format gatom) 
-  (text-iter pobject) (data (garray :uint8)) (length :int) (err g-error))
+  (text-iter pobject) (data (garray :uint8)) (length :int) 
+  (err (:pointer (:struct g-error))))
 
 (define-condition deserialize-warning (warning) 
   ((g-error :initarg g-error))
@@ -496,7 +503,8 @@
     ((register-buffer pobject) (content-buffer pobject)
      (iter (object text-buffer)) ;; object saves pointer, struct -- doesn't
      (array-data :pointer) (length :ulong)
-     (create-tags :boolean) (user-data pdata) (g-error g-error))
+     (create-tags :boolean) (user-data pdata) 
+     (g-error (:pointer (:struct g-error))))
   (destructuring-bind (func data data-destroy) user-data
     (declare (ignore data-destroy))
     (funcall func register-buffer content-buffer iter 

--- /project/gtk-cffi/cvsroot/gtk-cffi/gtk/spin-button.lisp	2012/08/21 19:48:02	NONE
+++ /project/gtk-cffi/cvsroot/gtk-cffi/gtk/spin-button.lisp	2012/08/21 19:48:02	1.1
;;;
;;; spin-button.lisp -- GtkSpinButton
;;;
;;; Copyright (C) 2012, Roman Klochkov <kalimehtar at mail.ru>
;;;
(in-package :gtk-cffi)

(defclass spin-button (entry)
  ())

(defcfun gtk-spin-button-new :pointer (adjustment pobject) (climb-rate :double)
         (digits :uint))
(defcfun gtk-spin-button-new-with-range :pointer (min :double) (max :double)
         (step :double))

(defmethod gconstructor ((spin-button spin-button) 
                         &key adjustment climb-rate digits
                         (min 0.0d0) (max 0.0d0) (step 0.0d0) &allow-other-keys)
  (initialize spin-button '(adjustment digits))
  (if adjustment
      (gtk-spin-button-new adjustment climb-rate digits)
      (gtk-spin-button-new-with-range min max step)))

(defcfun gtk-spin-button-configure :void (spin-button pobject) 
         (adjustment pobject) (climb-rate :double) (digits :uint))

(defmethod reinitialize-instance ((spin-button spin-button) 
                                  &key adjustment climb-rate digits)
  (gtk-spin-button-configure spin-button adjustment climb-rate digits))

(defcenum spin-button-update-policy :always :if-valid)

(defcenum spin-type 
  :step-forward :step-backward :page-forward :page-backward
  :home :end :user-defined)

(defslots spin-button
  adjustment pobject
  digits :int
  value :double
  update-policy spin-button-update-policy
  numeric :boolean
  wrap :boolean
  snap-to-ticks :boolean)

(deffuns spin-button
  (spin :void (direction spin-type) (increment :double))
  (update :void)
  (:get value-as-int :int))

(defcfun gtk-spin-button-set-increments :void (spin-button pobject)
         (step :double) (page :double))
(defcfun gtk-spin-button-get-increments :void (spin-button pobject)
         (step :pointer) (page :pointer))

(defgeneric increments (spin-button)
  (:method ((spin-button spin-button))
    (with-foreign-outs-list ((step :double) (page :double)) :ignore
      (gtk-spin-button-get-increments spin-button step page))))

(defgeneric (setf increments) (value spin-button)
  (:method (value (spin-button spin-button))
    (destructuring-bind (step page) value
      (gtk-spin-button-set-increments spin-button step page))))
(save-setter spin-button increments)

(defcfun gtk-spin-button-set-range :void (spin-button pobject)
         (min :double) (max :double))
(defcfun gtk-spin-button-get-range :void (spin-button pobject)
         (min :pointer) (max :pointer))

(defgeneric range (spin-button)
  (:method ((spin-button spin-button))
    (with-foreign-outs-list ((min :double) (max :double)) :ignore
      (gtk-spin-button-get-range spin-button min max))))

(defgeneric (setf range) (value spin-button)
  (:method (value (spin-button spin-button))
    (destructuring-bind (min max) value
      (gtk-spin-button-set-range spin-button min max))))
(save-setter spin-button range)


(init-slots spin-button)
  




More information about the gtk-cffi-cvs mailing list