All Manuals > CAPI User Guide and Reference Manual > 21 CAPI Reference Entries

cocoa-view-pane Class

Summary

Allows an arbitrary Cocoa view class to be used on the Macintosh.

Package

capi

Superclasses

simple-pane
titled-object

Initargs
:view-class
A string naming the view class to use.
:init-function
A function that initializes the view class.
Accessors

cocoa-view-pane-view-class
cocoa-view-pane-init-function

Description

The class cocoa-view-pane allows an instance of an arbitrary Cocoa view class to be displayed within a CAPI interface.

When the pane becomes visible, the CAPI allocates and initialize a Cocoa view object using the initargs as follows:

After the Cocoa view has been initialized, the function cocoa-view-pane-view can be used the retrieve it.

You can use the functions (setf cocoa-view-pane-view-class) and (setf cocoa-view-pane-init-function) to modify the view-class and init-function, but the values will be ignored if this is done after the pane becomes visible.

See the LispWorks Objective-C and Cocoa Interface User Guide and Reference Manual for details on using Cocoa.

Notes

cocoa-view-pane is implemented only in LispWorks for Macintosh with the Cocoa IDE.

Examples

The following code uses cocoa-view-pane to display an NSMovieView displaying an existing movie.

(defun show-movie (movie)
  (capi:contain
   (make-instance
    'cocoa-view-pane
    :view-class "NSMovieView"
    :init-function
    #'(lambda (pane view)
        (setq view
              (objc:invoke view "init"))
        (objc:invoke view "setMovie:" movie)
        view))))
See also

cocoa-view-pane-view
3.9 Special kinds of windows


CAPI User Guide and Reference Manual (Windows version) - 01 Dec 2021 19:33:57