Ignore:
Timestamp:
Oct 4, 2007, 3:02:08 PM (12 years ago)
Author:
af
Message:

Initial work on an interface to selections in text fields.

NB: Not entirely working yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/easygui/ccl/examples/cocoa/easygui/views.lisp

    r7346 r7347  
    4444  (check-type editable-p boolean)
    4545  (dcc (#/setEditable: (cocoa-ref view) editable-p)))
     46
     47(defclass one-selection-mixin () ())
     48
     49(defmethod (setf selection) (selection (view one-selection-mixin))
     50  (dcc (#/setSelectedRange: (cocoa-ref view) (range-nsrange selection))))
     51
     52(defmethod selection ((view one-selection-mixin))
     53  (let ((range (dcc (#/selectedRange (cocoa-ref view)))))
     54    (if (= (ns:ns-range-location range) #$NSNotFound)
     55        nil
     56        (range (ns:ns-range-location range)
     57               (ns:ns-range-length range)))))
    4658
    4759;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     
    6678(defclass static-text-view (view view-text-via-stringvalue-mixin) ())
    6779
    68 (defclass text-input-view (view editable-mixin view-text-via-stringvalue-mixin)
     80(defclass text-input-view (view editable-mixin view-text-via-stringvalue-mixin
     81                                ;; XXX: requires NSTextView, but this is an
     82                                ;; NSTextField:
     83                                #+not-yet one-selection-mixin)
    6984     ((input-locked-p :initform nil :initarg :input-locked-p
    7085                      :reader text-input-locked-p)))
Note: See TracChangeset for help on using the changeset viewer.