All Manuals > CAPI User Guide and Reference Manual > 11 Defining Interface Classes - top level windows

11.5 Controlling the appearance of the top level window

This section describes ways to control the appearance and behavior of the top level window displaying our CAPI interface.

11.5.1 Window styles

The interface initarg window-styles allows you to control a wide range of visible properties of the top level window including borders, shadows and so on.

window-styles also allows you to specify that the window can be moved by dragging on its background, or cannot be minimized, or acts as a windoid, or is visible only when the application is the current application, and so on.

Many of these properties are specific to the windowing system and are therefore not supported on all platforms. See interface for the details.

11.5.2 Controlling the interface title

A top level interface has a title, which normally appears at the top. This title is used by the Window Browser tool in the LispWorks IDE and also by system tools that deal with windows. The title is set either by the interface initarg :title or the accessor interface-title.

In addition, you can specify a prefix and/or suffix that is added to the titles of all the interfaces in an application, by using set-default-interface-prefix-suffix.

The title string is constructed by the generic function interface-extend-title. The default method constructs it from the title of the interface and the prefix/suffix, if any. For finer control, you can define interface-extend-title method(s) for specific interface class(es).

When you change something that may cause the title to change, that is some value that interface-extend-title uses, you can use one of update-interface-title, update-screen-interface-titles or update-all-interface-titles to cause the titles to be recomputed.

11.5.3 Indicating a changed document

Some windowing systems support a visible indication that a displayed document has been edited, helping users to see that it needs saving. To implement this in a CAPI interface, set interface-document-modified-p at suitable times.

You can extend the definition of the viewer pane in our example like this:

(viewer capi:editor-pane
       :title "File:"
       :text "No file selected."
       :visible-min-height '(:character 8)
       :reader viewer-pane
       :change-callback 'check-viewer-modified)

and define the change-callback as follows:

(defun check-viewer-modified (viewer point old-length new-length)
  (declare (ignore point old-length new-length))
  (setf (capi:interface-document-modified-p
         (capi:element-interface viewer))
         (capi:editor-pane-buffer viewer))))

Note: Currently interface-document-modified-p has an effect only on Cocoa.

CAPI User Guide and Reference Manual (Macintosh version) - 01 Dec 2021 19:31:21