wiki:EasyGuiViewMixins

Version 1 (modified by zzkt, 6 years ago) (diff)

--

View mixins

The view mixins define certain common view protocols.

View Text mixin

view-text-mixin () [class]

A mixin for views that display text. Initargs:

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

(set-view-text view-text-mixin text) [method]

Sets the text to display in view-text-mixin to text, which must be a string or nil to remove the view's text.

(view-text view-text-mixin) [method]

Returns the text of view.

View Orientation mixin

view-orientation-mixin () [class]

A mixin for one-dimensional views that can be oriented horizontally or vertically. Initargs:

:view-orientation -- sets the view orientation to one of :horizontal or :vertical.

(view-orientation view-orientation-mixin) [method]

Returns the orientation of view-orientation-mixin.

TODO: Might want to add :view-length to refer to the right one of view-width/view-height.

View Range mixin

view-range-mixin () [class]

A mixin for views that contain a numerical value in a range, such as a scroll bar or a progress bar. Initargs:

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

:view-minimum-value -- initializes the view minimum value, see set-view-minimum-value

:view-maximum-value -- initializes the view maximum value, see set-view-maximum-value

(set-view-value view-range-mixin value) [method]

Sets current value to value, which must be a real.

(view-value view-range-mixin) [method]

Returns the current value.

(set-view-minimum-value view-range-mixin minimum) [method]

Sets the minimum value to minimum, which must be a real.

(view-minimum-value view-range-mixin) [method]

Returns the minimum value.

(set-view-maximum-value view-range-mixin maximum) [method]

Sets the maximum value to maximum, which must be a real.

(view-maximum-value view-range-mixin) [method]

Returns the maximum value.

View State mixin

view-state-mixin () [class]

A mixin for views that have one of finite number of states, such as a checkbox. Initargs:

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

(view-valid-states view-state-mixin) [method]

Returns the sequence of valid states for the view. Concrete subclasses must provide a method for this function. The default method returns nil.

(set-view-state view-state-mixin state) [method]

Sets current state to state, which must be eql to an element of view-valid-states.

(view-state view-state-mixin) [method]

Returns the current state.

View Action mixin

view-action-mixin () [class]

A mixin for views that invoke a single action when activated, such as a push button. Initargs:

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

(set-view-action view-action-mixin action) [method]

Sets the action of view-action-mixin to action, which must be either nil or a funcallable object (function or symbol). If not nil, the action will be called with one argument, the view itself.

(view-action view-action-mixin) [method]

Returns the action of view-action-mixin.

View Mouse Tracker mixin

view-mouse-tracker-mixin () [class]

A mixin for views that support mouse tracking, used to implement live update. Initargs:

:view-mouse-tracker -- initializes the view mouse tracker, see set-view-mouse-tracker

(set-view-mouse-tracker view-mouse-tracker-mixin tracker) [method]

Sets the mouse tracking handler for the view view-mouse-tracker-mixin to tracker, which should be either nil or a funcallable object (function or symbol). If not nil, tracker will be called when the user first clicks in the view and then repeatedly for as long as the user holds down the mouse button. The function will receive two arguments, the view and the part code for the part of the view where the click first occurred, unless the mouse has moved out of the initial part, in which case the second argument will be nil.

(view-mouse-tracker view-mouse-tracker-mixin tracker) [method]

Returns the mouse tracker of view-mouse-tracker-mixin.

View Nib mixin

view-nib-mixin () [class]

A mixin for views that can be loaded from nib files, currently windows and menus. Initargs:

:view-nib-name -- specifies the name of the view description in a nib file.

:view-nib-path -- pathname of the nib file containing view-nib-name. Default is "main". The pathname type defaults to "nib" and in fact cannot be anything else.

See Interface Builder Support section below for more information.