Basic Views

The basic framework object is a view. Views (windows, menus, controls) are represented by CLOS objects, and are created using make-instance.

view ()[class]

An abstract superclass of all views (windows, menus, controls). All views support the following initargs:

:view-nick-name -- initializes the view nick-name, see set-view-nick-name

:view-subviews -- initializes the view subviews, see add-container

:view-size -- initializes the view size, see set-view-size

:view-width -- initializes the view width (overrides :view-size)

:view-height -- initializes the view height (overrides :view-size)

:view-tooltip -- initializes the view tooltip, see set-view-tooltip

:view-font -- initializes the view font, see set-view-font.

:view-enabled-p -- (default true), initializes the enabled/disabled state, see enable-view/disable-view

:view-ref --specifies an existing native window system object to base the view on.

:view-command-id -- initializes the view command id, see set-view-command-id.

(view-p object) [function]

True if object is a view.

(set-view-nick-name view name) [method]

Give the view a nick-name name, which can be any object.

(view-nick-name view) [method]

Returns the view's nick-name.

(view-named name view) [method]

Finds a subview of view whose nick-name is eql to name.

(view-subviews view &key type) [method]

Returns all subviews of view, i.e. all views whose view-container is view, optionally restricted to those of type type.

(add-subviews view &rest subviews) [method]

Make view be the container for each of the subviews.

(remove-subviews view &rest subviews) [method]

Remove each of the subviews from view.

(set-view-width view new-width) [method]

Sets the width of view to new-width, which must be a non-negative real.

(view-width view) [method]

Returns the width of view.

(set-view-height view new-height) [method]

Sets the size of view to new-height, which must be a non-negative real.

(view-height view) [method]

Returns the height of view.

(set-view-size view new-size) [method]

Sets the size of view to new-size, which is the height and width encoded as a point.

(view-size view) [method]

Returns the size (height and width) of view as a point.

(set-view-tooltip view tooltip) [method]

Sets the tooltip of view to tooltip, which must be a string or nil to remove the view's tooltip. The tooltip is shown when the mouse hovers over the view.

(view-tooltip view) [method]

Returns the tooltip of view.

(set-view-font view font-spec) [method]

Sets the font of view to font-%%spec%%, overriding the view's default font. Once you have set a view's font with this function, you can cause the view to revert to its default font by passing nil as the font-%%spec%%.

(view-font view) [method]

Returns the font of view.

(enable-view view) [method]

Makes view enabled, so it will respond to user input when active.

(disable-view view) [method]

Makes view disabled, so it will be drawn grayed out and will not respond to user input.

(view-enabled-p view) [method]

returns true if view is enabled.

(view-active-p view) [method]

True if view is active (able to accept user input).

(invalidate-view view &optional rect) [method]

Indicates that the contents of the view has become invalid (typically as a result of changes in the data displayed in the view). The system will arrange for the view to be redrawn. Optionally a rectangle may be specified to indicate that only the portion of the view bound by the rectangle needs to be redrawn.

(view-ref view) [method]

Returns the native window system object represented by view, to allow you to use the native window system directly.

TODO: need non-carbon version of next two:

(set-view-command-id view command-id) [method]

Sets the command id for the view. command-id may be an ostype or it may be a keyword defined by define-carbon-command-event, q.v.

(view-command-id view) [method]

Returns the command id of the view, if any, as an ostype, or nil if the view doesn't have a command id associated with it.

TODO: something for switching cursor based on what view it's in.

TODO: resizing protocol (window-size-parts in MCL).

Last modified 12 years ago Last modified on Aug 30, 2008, 6:20:41 AM