All Manuals > CLIM 2.0 User Guide > 9 Defining Application Frames

9.9 Frame Managers

Frames may be adopted by a frame manager, which involves invoking a protocol for generating the pane hierarchy of the frame. This protocol provides for selecting pane types for abstract gadget panes based on the style requirements imposed by the frame manager. That is, the frame manager is responsible for the look and feel of a frame. Each frame manager is associated with one specific port. However, a single port may have multiple frame managers managing various frames associated with the port.

After a frame is adopted it can be in any of the three following states: enabled, disabled, or shrunk. An enabled frame is visible unless it is occluded by other frames or the user is browsing outside of the portion of the frame manager's space that the frame occupies. A shrunken frame provides a cue or handle for the frame, but generally will not show the entire contents of the frame. For example, the frame may be iconified, or an item for the frame may be placed in a special suspended frame menu. A disabled frame is not visible, nor is there any user-accessible handle for enabling the frame.

Frames may also be disowned, which involves releasing the frame's panes as well as all associated foreign resources.

frame-manager Protocol Class

Summary: The protocol class that corresponds to a frame manager. If you want to create a new class that behaves like a frame manager, it should be a subclass of frame-manager. Subclasses of frame-manager must obey the frame manager protocol.

There are no advertised standard frame manager classes. Each port implements one or more frame managers that correspond to the look and feel for the port.

frame-manager-p Function

frame-manager-p object

Summary: Returns t if object is a frame manager; otherwise, it returns nil.

9.9.1 Finding Frame Managers

Most frames need to deal directly with frame managers only to the extent that they need to find a frame manager into which they can insert themselves. Since frames will usually be invoked by some user action that is handled by a frame manager, finding an appropriate frame manager is usually straightforward.

Some frames will support the embedding of other frames within themselves. Such frames not only use frames but also act as frame managers. In this case, the embedded frames are mostly unaware that they are nested within other frames, but only know that they are controlled by a particular frame manager.

The find-frame-manager function provides a flexible means for locating a frame manager to adopt an application's frames. There are a variety of ways that the user or the application can influence where an application's frame is adopted:

find-frame-manager Function

find-frame-manager &rest options &key port &allow-other-keys

Summary: Finds an appropriate frame manager that conforms to the options, including the port argument. Furthermore, CLIM applications may set up dynamic contexts that affect what find-frame-manager will return.

port defaults to the value returned by find-port applied to the remaining options.

A frame manager is found using the following rules in the order listed:

  1. If a current frame manager has been established via an invocation of with-frame-manager, as is the case within a frame's top-level, and that frame manager conforms to the options, it is returned. The exact definition of "conforming to the options" varies from one port to another, but it may include such things as matching the console number, color or resolution properties, and so forth. If the options are empty, then any frame manager will conform.
  2. If *default-frame-manager* is bound to a currently active frame manager and it conforms to the options, it is returned.
  3. If port is nil, a port is found and an appropriate frame manager is constructed using *default-server-path*.

*default-frame-manager* Variable

Summary: This variable provides a convenient point for allowing a programmer or user to override the frame manager type that would normally be selected. Most users will not set this variable, since they can set *default-server-path* to indicate which host window system they want to use and are willing to use whatever frame manager is the default for the particular port. However, some users may want to use a frame manager that isn't the typical frame manager. For example, a user may want to use both an OpenLook frame manager and a Motif frame manager on a single port.

with-frame-manager Macro

with-frame-manager (frame-manager) &body body

Summary: Generates a dynamic context that causes all calls to find-frame-manager to return frame-manager if the where argument passed to it conforms to frame-manager. Nested calls to with-frame-manager shadow outer contexts. body may have zero or more declarations as its first forms.

9.9.2 Frame Manager Operators

frame-manager Generic Function

frame-manager frame

Summary: Returns frame's current frame manager if it is adopted; otherwise, it returns nil.

(setf frame-manager) Generic Function

(setf frame-manager) frame-manager frame

Summary: Changes the frame manager of frame to frame-manager. In effect, the frame is disowned from its old frame manager and is adopted into the new frame manager. Transferring a frame preserves its frame-state; for example, if the frame was previously enabled, it will be enabled in the new frame manager.

frame-manager-frames Generic Function

frame-manager-frames frame-manager

Summary: Returns a list of all the frames being managed by frame-manager. This function returns objects that reveal CLIM's internal state; do not modify those objects.

adopt-frame Generic Function

adopt-frame frame-manager frame

disown-frame Generic Function

disown-frame frame-manager frame

Summary: These functions insert or remove a frame from a frame manager's control. These functions allow a frame manager to allocate and deallocate resources associated with a frame. For example, removing a frame from a frame manager that is talking to a remote server allows it to release all remote resources used by the frame.

frame-state Generic Function

frame-state frame

Summary: Returns one of :disowned, :enabled, :disabled, or :shrunk, indicating the current state of frame.

enable-frame Generic Function

enable-frame frame

disable-frame Generic Function

disable-frame frame

shrink-frame Generic Function

shrink-frame frame

Summary: These functions force a frame into the enabled, disabled, or shrunken states. A frame in the enabled state may be visible if it is not occluded or placed out of the user's focus of attention. A disabled frame is never visible. A shrunk frame is accessible to the user for re-enabling, but may be represented in some abbreviated form, such as an icon or a menu item.

These functions call note-frame-state-changed to notify the frame manager that the state of the frame changed.

note-frame-state-changed Generic Function

note-frame-state-changed frame-manager frame new-state

Summary: Notifies the frame manager frame-manager that the frame frame has changed its state to state.

generate-panes Generic Function

generate-panes frame-manager frame

Summary: This function is invoked by a standard method of adopt-frame. It is the responsibility of the frame implementor to provide a method that invokes setf on frame-panes on the frame with a value of type pane. define-application-frame automatically supplies a generate-panes method if either the :pane or :panes option is used in the define-application-frame.

find-pane-for-frame Generic Function

find-pane-for-frame frame-manager frame

Summary: This function is invoked by a standard method of adopt-frame. It must return the root pane of the frame's layout. It is the responsibility of the frame implementor to provide a method that constructs the frame's top-level pane. define-application-frame automatically supplies a a method for this function if either the :pane or :panes option is used.

note-command-enabled Generic Function

note-command-enabled frame-manager frame command-name

note-command-disabled Generic Function

note-command-disabled frame-manager frame command-name

Summary: Notifies the frame manager frame-manager that the command named by command-name has been enabled or disabled (respectively) in the frame frame. The frame manager can update the appearance of the user interface as appropriate, for instance, by "graying out" a newly disabled command from a command menu or menu bar.


CLIM 2.0 User Guide - 01 Dec 2021 19:38:58