[cells-gtk-cvs] CVS root/cells-gtk

pdenno pdenno at common-lisp.net
Mon Jul 31 17:41:01 UTC 2006


Update of /project/cells-gtk/cvsroot/root/cells-gtk
In directory clnet:/tmp/cvs-serv10118/root/cells-gtk

Modified Files:
	menus.lisp 
Log Message:
Update from Leonid Novikov adds current-pos slot in combo-box model.
This allows to set and get current position in flat model.

--- /project/cells-gtk/cvsroot/root/cells-gtk/menus.lisp	2006/06/07 16:41:38	1.14
+++ /project/cells-gtk/cvsroot/root/cells-gtk/menus.lisp	2006/07/31 17:41:01	1.15
@@ -34,7 +34,8 @@
    (init :accessor init :initarg :init :initform nil)
    (roots :accessor roots :initarg :roots :initform nil)
    (children-fn :accessor children-fn :initarg :children-fn :initform #'(lambda (x) (declare (ignore x)) nil))
-   (tree-model :cell nil :accessor tree-model :initform nil))
+   (tree-model :cell nil :accessor tree-model :initform nil)
+   (current-pos :accessor current-pos :initarg :current-pos :initform (c-in nil)))
   (active)
   (changed)
   :new-tail '-text
@@ -46,7 +47,8 @@
 	(let ((pos (gtk-combo-box-get-active (id self))))
 	  ;;(trc nil "combo-box pos" pos)
 	  (setf (md-value self) (and (not (= pos -1))
-				     (nth pos (items self)))))
+				     (nth pos (items self))))
+	  (setf (current-pos self) pos))
       ;; non-flat tree-model (:roots specified)
       (with-tree-iters (iter)
         (when (gtk-combo-box-get-active-iter (id self) iter)
@@ -57,6 +59,9 @@
 		 (read-from-string
 		  (gtk-tree-model-get-cell (id (tree-model self)) iter 1 :string)))))))))
 
+(def-c-output current-pos ((self combo-box))
+   (when new-value (gtk-combo-box-set-active (id self) new-value)))
+
 ;;; When user specifies :roots, he is using a tree-model.
 ;;; POD There is probably no reason he has to use :strings for the "columns"
 (def-c-output roots ((self combo-box))




More information about the Cells-gtk-cvs mailing list