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

9.8 Application Frame Operators and Accessors

The following operators are used to define and instantiate application frames. They are discussed in detail in 9.2 Defining CLIM Application Frames.

define-application-frame Macro

define-application-frame name superclasses slots &rest options

Summary: Defines an application frame. You can specify a name for the application class, the superclasses (if any), the slots of the application class, and options.

make-application-frame Function

make-application-frame frame-name &rest options &key pretty-name frame-manager enable state left top right bottom width height save-under frame-class &allow-other-keys

Summary: Makes an instance of the application frame of type frame-class. If frame-class is not supplied, it defaults to frame-name.

9.8.1 CLIM Application Frame Accessors

The following functions may be used to access and modify the state of the application frame itself, such as what the currently exposed panes are, what the current layout is, what command table is being used, and so forth.

*application-frame* Variable

Summary: The current application frame. The value is CLIM's default application. This variable is typically used in the bodies of commands and translators to gain access to the state variables of the application, usually in conjunction with clos:with-slots or clos:slot-value.

frame-name Generic Function

frame-name frame

Summary: Returns the name of the frame frame, which is a symbol.

frame-pretty-name Generic Function

frame-pretty-name frame

Summary: Returns the "pretty name" of the frame frame, which is a string.

(setf frame-pretty-name) Generic Function

(setf frame-pretty-name) name frame

Summary: Sets the pretty name of the frame frame to name, which must be a string.

frame-command-table Generic Function

frame-command-table frame

Summary: Returns the command table for the frame frame.

(setf frame-command-table) Generic Function

(setf frame-command-table) command-table frame

Summary: Sets the command table for the frame frame to command-table. Changing the frame's command table will redisplay the command menus (or menu bar) as needed. command-table is a command table designator.

frame-standard-input Generic Function

frame-standard-input frame

Summary: Returns the stream that will be used for *standard-input* for the frame frame. The default method (on standard-application-frame) returns the first named pane of type interactor-pane that is exposed in the current layout; if there is no such pane, the value returned by frame-standard-output is used.

frame-standard-output Generic Function

frame-standard-output frame

Summary: Returns the stream that will be used for *standard-output* for the frame frame. The default method (on standard-application-frame) returns the first named pane of type application-pane that is exposed in the current layout; if there is no such pane, it returns the first pane of type interactor-pane that is exposed in the current layout.

To redirect standard input or output, simply redefine the corresponding frame generic function. For example, the following form specifies the pane in my-frame named output-pane as the destination for standard output.

(defmethod frame-standard-output ((frame my-frame))
   (get-frame-pane frame 'output-pane))

frame-query-io Generic Function

frame-query-io frame

Summary: Returns the stream that will be used for *query-io* for the frame frame. The default method (on standard-application-frame) returns the value returned by frame-standard-input; if that is nil, it returns the value returned by frame-standard-output.

frame-error-output Generic Function

frame-error-output frame

Summary: Returns the stream that will be used for *error-output* for the frame frame. The default method (on standard-application-frame) returns the same value as frame-standard-output.

*pointer-documentation-output* Variable

Summary: This will be bound either to nil or to a stream on which pointer documentation will be displayed.

frame-pointer-documentation-output Generic Function

frame-pointer-documentation-output frame

Summary: Returns the stream that will be used for *pointer-documentation-output* for the frame frame. The default method (on standard-application-frame) returns the first pane of type pointer-documentation-pane. If this returns nil, no pointer documentation will be generated for this frame.

frame-calling-frame Generic Function

frame-calling-frame frame

Summary: Returns the application frame that invoked the frame frame.

frame-parent Generic Function

frame-parent frame

Summary: Returns the object that acts as the parent for the frame frame. This often, but not always, returns the same value as frame-manager.

frame-panes Generic Function

frame-panes frame

Summary: Returns the pane that is the top-level pane in the current layout of the frame frame's named panes. This function returns objects that reveal CLIM's internal state; do not modify those objects.

frame-current-panes Generic Function

frame-current-panes frame

Summary: Returns a list of those named panes in the frame frame's current layout. If there are no named panes (that is, the :pane option was used), only the single, top-level pane is returned. This function returns objects that reveal CLIM's internal state; do not modify those objects.

get-frame-pane Generic Function

get-frame-pane frame pane-name

Summary: Returns the CLIM stream pane in the frame frame whose name is pane-name.

find-pane-named Generic Function

find-pane-named frame pane-name

Summary: Returns the pane in the frame frame whose name is pane-name. This can return any type of pane, not just CLIM stream panes.

frame-top-level-sheet Generic Function

frame-top-level-sheet frame

Summary: Returns the sheet that is the top-level sheet for the frame frame. This is the sheet that has as its descendants all of the panes of frame.

frame-current-layout Generic Function

frame-current-layout frame

Summary: Returns the current layout for the frame frame. The layout is named by a symbol.

(setf frame-current-layout) Generic Function

(setf frame-current-layout) layout frame

Summary: Sets the layout of the frame frame to be the new layout specified by new-layout. layout must be a symbol that names one of the possible layouts.

Changing the layout of the frame causes a recomputation of what panes are used for the bindings of the standard stream variables (such as *standard-input*). After the new layout has been computed, the contents of each pane are displayed to the degree necessary to ensure that all output is visible.

layout-frame Generic Function

layout-frame frame &optional width height

Summary: Resizes the frame and lays out the current pane hierarchy using the layout specified by frame-current-layout, according to the layout protocol described in 10.2.4 The Layout Protocol. This function is automatically invoked on a frame when it is adopted, after its pane hierarchy has been generated.

If width and height are provided, then this function resizes the frame to the specified size. It is an error to provide just width. If no optional arguments are provided, this function resizes the frame to the preferred size of the top-level pane as determined by the space composition pass of the layout protocol.

In either case, after the frame is resized, the space allocation pass of the layout protocol is invoked on the top-level pane.

9.8.2 Operators for Running CLIM Applications

The following functions are used to start up an application frame, exit from it, and control the "read-eval-print" loop of the frame (for example, redisplay the panes of the frame, and read, execute, enable, and disable commands).

run-frame-top-level Generic Function

run-frame-top-level frame

Summary: Runs the top-level function for the frame frame. The default method on application-frame simply invokes the top-level function for the frame (which defaults to default-frame-top-level).

run-frame-top-level Around Method

run-frame-top-level (frame application-frame)

Summary: The :around method of run-frame-top-level on the application-frame class establishes the initial dynamic bindings for the application, including (but not limited to) binding *application-frame* to frame, binding *input-context* to nil, resetting the delimiter and activation gestures, and binding *input-wait-test*, *input-wait-handler*, and *pointer-button-press-handler* to nil.

default-frame-top-level Generic Function

default-frame-top-level frame &key command-parser command-unparser partial-command-parser prompt

Summary: The default top-level function for application frames, this runs a "read-eval-print" loop that displays a prompt, calls read-frame-command and then execute-frame-command, and finally redisplays all the panes that need it. See 11.9 The CLIM Command Processor for further details.

default-frame-top-level also establishes a simple restart for abort and binds the standard stream variables as follows. *standard-input* will be bound to the value returned by frame-standard-input. *standard-output* will be bound to the value returned by frame-standard-output. *query-io* will be bound to the value returned by frame-query-io. *error-output* will be bound to the value returned by frame-error-output. It is unspecified what *terminal-io*, *debug-io*, and *trace-output* will be bound to.

prompt is either a string to use as the prompt (defaulting to Command:) or a function of two arguments, a stream and the frame.

command-parser, command-unparser, and partial-command-parser are the same as for read-command. command-parser defaults to command-line-command-parser if there is an interactor; otherwise, it defaults to menu-only-command-parser. command-unparser defaults to command-line-command-unparser. partial-command-parser defaults to command-line-read-remaining-arguments-for-partial-command if there is an interactor; otherwise, it defaults to menu-only-read-remaining-arguments-for-partial-command. default-frame-top-level binds *command-parser*, *command-unparser*, and *partial-command-parser* to the values of command-parser, command-unparser, and partial-command-parser.

read-frame-command Generic Function

read-frame-command frame stream

Summary: Reads a command from the stream stream on behalf of the frame frame. The returned value is a command object.

The default method (on standard-application-frame) for read-frame-command simply calls read-command, supplying frame's current command table as the command table.

execute-frame-command Generic Function

execute-frame-command frame command

Summary: Executes the command command on behalf of the frame frame. command is a command object, that is, a cons of a command name and a list of the command's arguments.

The default method (on standard-application-frame) for execute-frame-command simply applies the command-name of command to command-arguments of command.

command-enabled Generic Function

command-enabled command-name frame

Summary: Returns t if the command named by command-name is presently enabled in the frame frame; otherwise, it returns nil. If command-name is not accessible to the command table being used by frame, command-enabled returns nil.

Whether or not a particular command is currently enabled is stored independently for each instance of an application frame; this status can vary between frames that share a single command table.

(setf command-enabled) Generic Function

(setf command-enabled) enabled command-name frame

Summary: If enabled is nil, this disables the use of the command named by command-name while in the frame frame. If enabled is t, the use of the command is enabled. After the command has been enabled (or disabled), note-command-enabled (or note-command-disabled) is invoked on the frame manager in order to update the appearance of the interface.

If command-name is not accessible to the command table being used by frame, using setf on command-enabled does nothing.

display-command-menu Generic Function

display-command-menu frame stream &key command-table initial-spacing max-width max-height n-rows n-columns (cell-align-x :left) (cell-align-y :top)

Summary: Displays the menu associated with the specified command table on stream by calling display-command-table-menu. If command-table is not supplied, it defaults to (frame-command-table stream). This function is generally used as the display function for panes that contain command menus.

initial-spacing, max-width, max-height, n-rows, n-columns, cell-align-x, and cell-align-y are as for formatting-item-list.

frame-exit Restart

Summary: The restart that is invoked when frame-exit is called.

frame-exit Generic Function

frame-exit frame

Summary: Exits from the frame frame. The default method (on standard-application-frame) invokes the frame-exit restart.

panes-need-redisplay Generic Function

panes-need-redisplay frame

pane-needs-redisplay Generic Function

pane-needs-redisplay frame pane

Summary: panes-need-redisplay indicates that all the panes in the frame frame should be redisplayed the next time around the command loop. pane-needs-redisplay causes only the pane pane within frame to be redisplayed; in this case, pane is either a pane or the name of a named pane.

redisplay-frame-pane Generic Function

redisplay-frame-pane frame pane &key force-p

Summary: Causes the pane pane within the frame frame to be redisplayed immediately. pane is either a pane or the name of a named pane. When the boolean force-p is t, the maximum level of redisplay is forced and the pane is displayed "from scratch".

redisplay-frame-panes Generic Function

redisplay-frame-panes frame &key force-p

Summary: redisplay-frame-panes causes all of the panes in the frame frame to be redisplayed immediately by calling redisplay-frame-pane on each of the panes in frame that are visible in the current layout. When the boolean force-p is t, the maximum level of redisplay is forced and the pane is displayed "from scratch".

frame-replay Generic Function

frame-replay frame stream &optional region

Summary: Replays the contents of stream in the frame frame within the region specified by the region region, which defaults to the viewport of stream.

notify-user Generic Function

notify-user frame message &key associated-window title documentation exit-boxes style text-style

Summary: Notifies the user of some event on behalf of the frame frame.

This function provides a look-and-feel independent way for applications to communicate messages to the user. For example, a frame manager might provide a top-level message window for each frame, or it might pop up an alert box.

frame is a CLIM application frame, message is a message string, associated-window is the window with which the notification will be associated, title is a title string to include in the notification, documentation is not implemented in the current version of CLIM, exit-boxes indicates what sort of exit boxes should appear in the notification, style is the style in which to display the notification, and text-style is the text style in which to display the notification.

frame-manager-notify-user Generic Function

frame-manager-notify-user frame message &key associated-window title documentation exit-boxes style text-style

Summary: The generic function used by notify-user. The default method on standard-frame-manager will display a dialog or an alert box that contains the message and has exit boxes that will allow the user to dismiss the notification.

frame is a CLIM application frame, message is a message string, associated-window is the window with which the notification will be associated, title is a title string to include in the notification, documentation is not implemented in the current version of CLIM, exit-boxes indicates what sort of exit boxes should appear in the notification, style is the style in which to display the notification, and text-style is the text style in which to display the notification.

frame-properties Generic Function

frame-properties frame property

(setf frame-properties) Generic Function

(setf frame-properties) value frame property

Summary: Frame properties can be used to associate frame specific data with frames without adding additional slots to the frame's class. CLIM may use frame properties internally to store information for its own purposes.


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