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

CVS User rklochkov rklochkov at common-lisp.net
Tue May 8 09:38:07 UTC 2012


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

Modified Files:
	cell-layout.lisp cell-renderer.lisp combo-box.lisp 
	gtk-cffi.asd package.lisp tree-model.lisp 
Added Files:
	combo-box-text.lisp 
Log Message:
Added GtkComboBoxText
Changed GtkTextIter to struct implementation from cffi-objects


--- /project/gtk-cffi/cvsroot/gtk-cffi/gtk/cell-layout.lisp	2012/03/06 01:25:26	1.3
+++ /project/gtk-cffi/cvsroot/gtk-cffi/gtk/cell-layout.lisp	2012/05/08 09:38:07	1.4
@@ -24,7 +24,12 @@
   (funcall (if end
                #'gtk-cell-layout-pack-end
              #'gtk-cell-layout-pack-start)
-           cell-layout cell-renderer expand))
+           cell-layout cell-renderer expand)
+  (iter
+    (for (attr column) in (attributes cell-renderer))
+    (add-attribute cell-layout cell-renderer
+                   attr column)))
+    
 
 (defcfun "gtk_cell_layout_get_cells" g-list-object (cell-layout pobject))
 
--- /project/gtk-cffi/cvsroot/gtk-cffi/gtk/cell-renderer.lisp	2011/08/26 17:16:14	1.2
+++ /project/gtk-cffi/cvsroot/gtk-cffi/gtk/cell-renderer.lisp	2012/05/08 09:38:07	1.3
@@ -1,10 +1,8 @@
 (in-package :gtk-cffi)
 
 (defclass cell-renderer (g-object)
-  ())
+  ((attributes :initarg :attributes :reader attributes :initform nil)))
 
 (defcenum cell-renderer-mode
   :inert :activatable :editable)
 
-
-
--- /project/gtk-cffi/cvsroot/gtk-cffi/gtk/combo-box.lisp	2012/05/07 09:02:04	1.2
+++ /project/gtk-cffi/cvsroot/gtk-cffi/gtk/combo-box.lisp	2012/05/08 09:38:07	1.3
@@ -1,6 +1,6 @@
 (in-package :gtk-cffi)
 
-(defclass combo-box (bin)
+(defclass combo-box (bin cell-layout)
   ())
 
 (defcfun gtk-combo-box-new :pointer)
@@ -27,6 +27,7 @@
          (gtk-combo-box-new)))))
 
 
+;; separate declaration to avoid auto-adding to initargs
 (defcfun gtk-combo-box-set-model :void (combo-box pobject) (model pobject))
 (defmethod (setf model) (tree-model (combo-box combo-box))
   (gtk-combo-box-set-model combo-box tree-model))
@@ -36,7 +37,6 @@
   row-span-column :int
   column-span-column :int
   active :int
-  active-iter pobject
   id-column :int
   add-tearoffs :boolean
   title :string
@@ -76,6 +76,25 @@
   (values active-id
           (gtk-combo-box-set-active-id combo-box active-id)))
 
+(defcfun gtk-combo-box-set-active-iter 
+    :void (combo-box pobject) (iter (struct tree-iter :free :none)))
+(defcfun gtk-combo-box-get-active-iter 
+    :boolean (combo-box pobject) (iter (struct tree-iter :out t)))
+
+(defgeneric (setf active-iter) (active-iter combo-box)
+  (:method (active-iter (combo-box combo-box))
+    (gtk-combo-box-set-active-iter combo-box active-iter)))
+
+(defgeneric active-iter (combo-box)
+  (:method ((combo-box combo-box))
+    (let ((res (make-instance 'tree-iter)))
+      (values res (gtk-combo-box-get-active-iter combo-box res)))))
+(save-setter combo-box active-iter)
+
+(init-slots combo-box)
+
+
+
 
 
 
--- /project/gtk-cffi/cvsroot/gtk-cffi/gtk/gtk-cffi.asd	2012/05/07 09:02:04	1.18
+++ /project/gtk-cffi/cvsroot/gtk-cffi/gtk/gtk-cffi.asd	2012/05/08 09:38:07	1.19
@@ -336,7 +336,8 @@
   :license "LLGPL"
   :depends-on (gtk-cffi-bin gtk-cffi-range)
   :components
-  ((:file combo-box)))
+  ((:file combo-box)
+   (:file combo-box-text)))
 
 (defsystem gtk-cffi-message-dialog
   :description "Interface to GTK/Glib via CFFI"
--- /project/gtk-cffi/cvsroot/gtk-cffi/gtk/package.lisp	2012/05/07 09:32:47	1.19
+++ /project/gtk-cffi/cvsroot/gtk-cffi/gtk/package.lisp	2012/05/08 09:38:07	1.20
@@ -439,6 +439,7 @@
    #:iter->path
    #:path->iter
    #:get-indices
+   #:tree->indices
    
    #:list-store
    ;; list-store methods
@@ -724,6 +725,18 @@
    #:active-id
    #:row-separator-func
 
+   #:combo-box-text
+   ;; methods
+   #:combo-box-insert
+   #:combo-box-prepend
+   #:combo-box-append
+   #:insert-text
+   #:append-text
+   #:prepend-text
+   #:active-text
+   #:combo-box-remove
+   #:remove-all
+
    #:range
    ;; slots
    #:fill-level
--- /project/gtk-cffi/cvsroot/gtk-cffi/gtk/tree-model.lisp	2012/05/07 09:02:04	1.8
+++ /project/gtk-cffi/cvsroot/gtk-cffi/gtk/tree-model.lisp	2012/05/08 09:38:07	1.9
@@ -40,7 +40,7 @@
           :collect (mem-aref array :int i))))
 
 (defmethod get-index ((tree-path tree-path) &optional (pos 0))
-  (mem-aref (gtk-tree-path-get-indices (pointer tree-path)) :int pos))
+  (mem-aref (gtk-tree-path-get-indices tree-path) :int pos))
 
 (defclass tree-row (object)
   ())
@@ -63,32 +63,35 @@
 (defmethod copy ((tree-row tree-row))
   (gtk-tree-row-reference-copy tree-row))
 
-(defcstruct tree-iter-struct
+(defcstruct* tree-iter
     "GtkTreeIter"
   (stamp :int)
   (u1 :pointer)
   (u2 :pointer)
   (u3 :pointer))
 
-(defclass tree-iter (object)
-  ())
+;(defclass tree-iter (object)
+;  ())
 
-(defmethod gconstructor ((tree-iter tree-iter)
-                         &key &allow-other-keys)
-  (foreign-alloc 'tree-iter-struct))
-
-(defmethod copy ((tree-iter tree-iter))
-  (let* ((res (make-instance 'tree-iter))
-         (ptr (pointer tree-iter))
-         (new-ptr (pointer res)))
-    (mapc (lambda (x)
-              (setf (foreign-slot-value new-ptr 'tree-iter-struct x)
-                    (foreign-slot-value ptr 'tree-iter-struct x)))
-            (foreign-slot-names 'tree-iter-struct))
-    res))
+;(defmethod gconstructor ((tree-iter tree-iter)
+;                         &key &allow-other-keys)
+;  (foreign-alloc 'tree-iter-struct))
+
+;(defmethod copy ((tree-iter tree-iter))
+;  (let* ((res (make-instance 'tree-iter))
+;         (ptr (pointer tree-iter))
+;         (new-ptr (pointer res)))
+;    (mapc (lambda (x)
+;              (setf (foreign-slot-value new-ptr 'tree-iter-struct x)
+;                    (foreign-slot-value ptr 'tree-iter-struct x)))
+;            (foreign-slot-names 'tree-iter-struct))
+;    res))
 
 (defcfun "gtk_tree_iter_free" :void (iter pobject))
 
+(defmethod free-struct ((class (eql 'tree-iter)) value)
+  (gtk-tree-iter-free value))
+
 (defmethod free :before ((tree-iter tree-iter))
   (gtk-tree-iter-free tree-iter))
 
@@ -125,7 +128,7 @@
 (defmethod initialize-instance
   :after ((tree-model tree-model)
           &key &allow-other-keys)
-  (setf (tree-iter tree-model) (make-instance 'tree-iter)))
+  (setf (tree-iter tree-model) (make-instance 'tree-iter :new-struct t)))
 
 (defmethod free :before ((tree-model tree-model))
   (free (tree-iter tree-model)))
@@ -149,6 +152,14 @@
 (defmethod iter->string ((tree-model tree-model) (tree-iter tree-iter))
   (gtk-tree-model-get-string-from-iter tree-model tree-iter))
 
+(defgeneric tree->indices (tree-model tree-iter)
+  (:method ((tree-model tree-model) (tree-iter tree-iter))
+    (let ((tree-path (iter->path tree-model tree-iter)))
+      (prog1
+          (get-indices tree-path)
+        (free tree-path)))))
+
+
 (defcfun "gtk_tree_model_get_value" :void (model pobject) (iter pobject)
   (column :int) (g-value pobject))
 

--- /project/gtk-cffi/cvsroot/gtk-cffi/gtk/combo-box-text.lisp	2012/05/08 09:38:07	NONE
+++ /project/gtk-cffi/cvsroot/gtk-cffi/gtk/combo-box-text.lisp	2012/05/08 09:38:07	1.1
(in-package :gtk-cffi)

(defclass combo-box-text (combo-box)
  ())

(defcfun gtk-combo-box-text-new-with-entry :pointer)
(defcfun gtk-combo-box-text-new :pointer)

(defmethod gconstructor ((combo-box-text combo-box-text) &key with-entry)
  (if with-entry
      (gtk-combo-box-text-new-with-entry)
      (gtk-combo-box-text-new)))

(deffuns combo-box-text
  ((combo-box-append . append) :void (id :string) (text :string))
  ((combo-box-insert . insert) 
   :void (position :int) (id :string) (text :string))
  ((combo-box-prepend . prepend) :void (id :string) (text :string))
  (append-text :void (text :string))
  (insert-text :void (position :int) (text :string))
  (prepend-text :void (text :string))
  ((combo-box-remove . remove) :void (position :int))
  (remove-all :void)
  (:get active-text :string))




More information about the gtk-cffi-cvs mailing list