You can add a toolbar for an interface using the interface initarg :toolbar-items
. This creates a toolbar which is automatically positioned correctly in the window, which the user can customize, and which has platform-standard behavior such as folding on Cocoa. Such a toolbar is referred to as an
interface toolbar
.
You can also create toolbars using the toolbar class explicitly, and arrange them using layouts in the same way as other elements. This approach is used to implement buttons on a text-input-pane as seen in various tools in the LispWorks IDE such as the Class Browser, but you should note that it has some disadvantages. For more information see Non-standard toolbars.
Toolbar buttons typically have images. The examples in this chapter use three standard image identifiers. To run the example code that follows, first evaluate this form:
(setq file-images (list :std-file-new
:std-file-open
:std-file-save))
You also should define these callback functions before attempting any of the examples in this chapter:
(defun test-callback (data interface)
(display-message "Data ~S in interface ~S"
data interface))
(defun print-callback (data interface)
(declare (ignore data interface))
(display-message "Print Something"))
(defun hello (data interface)
(declare (ignore data interface))
(display-message "Hello World"))
CAPI User Guide and Reference Manual (Macintosh version) - 25 Feb 2015