| | 1 | = View mixins = |
| | 2 | |
| | 3 | The view mixins define certain common view protocols. |
| | 4 | |
| | 5 | == View Text mixin == |
| | 6 | |
| | 7 | {{{view-text-mixin () [class]}}} |
| | 8 | |
| | 9 | A mixin for views that display text. Initargs: |
| | 10 | |
| | 11 | '':view-text'' -- initializes the view text, see set-view-text |
| | 12 | |
| | 13 | {{{(set-view-text view-text-mixin text) [method]}}} |
| | 14 | |
| | 15 | Sets the text to display in view-text-mixin to text, which must be a string or ''nil'' to remove the view's text. |
| | 16 | |
| | 17 | {{{(view-text view-text-mixin) [method]}}} |
| | 18 | |
| | 19 | Returns the text of view. |
| | 20 | |
| | 21 | == View Orientation mixin == |
| | 22 | |
| | 23 | {{{view-orientation-mixin () [class]}}} |
| | 24 | |
| | 25 | A mixin for one-dimensional views that can be oriented horizontally or vertically. Initargs: |
| | 26 | |
| | 27 | '':view-orientation'' -- sets the view orientation to one of :horizontal or :vertical. |
| | 28 | |
| | 29 | {{{(view-orientation view-orientation-mixin) [method]}}} |
| | 30 | |
| | 31 | Returns the orientation of ''view-orientation-mixin''. |
| | 32 | |
| | 33 | ''TODO: Might want to add :view-length to refer to the right one of view-width/view-height.'' |
| | 34 | |
| | 35 | == View Range mixin == |
| | 36 | |
| | 37 | {{{view-range-mixin () [class]}}} |
| | 38 | |
| | 39 | A mixin for views that contain a numerical value in a range, such as a scroll bar or a progress bar. Initargs: |
| | 40 | |
| | 41 | '':view-value'' -- initializes the view value, see set-view-value |
| | 42 | |
| | 43 | '':view-minimum-value'' -- initializes the view minimum value, see set-view-minimum-value |
| | 44 | |
| | 45 | '':view-maximum-value'' -- initializes the view maximum value, see set-view-maximum-value |
| | 46 | |
| | 47 | {{{(set-view-value view-range-mixin value) [method]}}} |
| | 48 | |
| | 49 | Sets current value to value, which must be a real. |
| | 50 | |
| | 51 | {{{(view-value view-range-mixin) [method]}}} |
| | 52 | |
| | 53 | Returns the current value. |
| | 54 | |
| | 55 | {{{(set-view-minimum-value view-range-mixin minimum) [method]}}} |
| | 56 | |
| | 57 | Sets the minimum value to ''minimum'', which must be a real. |
| | 58 | |
| | 59 | {{{(view-minimum-value view-range-mixin) [method]}}} |
| | 60 | |
| | 61 | Returns the minimum value. |
| | 62 | |
| | 63 | {{{(set-view-maximum-value view-range-mixin maximum) [method]}}} |
| | 64 | |
| | 65 | Sets the maximum value to ''maximum'', which must be a real. |
| | 66 | |
| | 67 | {{{(view-maximum-value view-range-mixin) [method]}}} |
| | 68 | |
| | 69 | Returns the maximum value. |
| | 70 | |
| | 71 | == View State mixin == |
| | 72 | |
| | 73 | {{{view-state-mixin () [class]}}} |
| | 74 | |
| | 75 | A mixin for views that have one of finite number of states, such as a checkbox. Initargs: |
| | 76 | |
| | 77 | '':view-state'' -- initializes the view state, see set-view-state |
| | 78 | |
| | 79 | {{{(view-valid-states view-state-mixin) [method]}}} |
| | 80 | |
| | 81 | Returns the sequence of valid states for the view. Concrete |
| | 82 | subclasses must provide a method for this function. The default method |
| | 83 | returns ''nil''. |
| | 84 | |
| | 85 | {{{(set-view-state view-state-mixin state) [method]}}} |
| | 86 | |
| | 87 | Sets current state to state, which must be ''eql'' to an element of view-valid-states. |
| | 88 | |
| | 89 | {{{(view-state view-state-mixin) [method]}}} |
| | 90 | |
| | 91 | Returns the current state. |
| | 92 | |
| | 93 | == View Action mixin == |
| | 94 | |
| | 95 | {{{view-action-mixin () [class]}}} |
| | 96 | |
| | 97 | A mixin for views that invoke a single action when activated, such as a push button. Initargs: |
| | 98 | |
| | 99 | '':view-action'' -- initializes the view action, see set-view-action |
| | 100 | |
| | 101 | {{{(set-view-action view-action-mixin action) [method]}}} |
| | 102 | |
| | 103 | Sets the action of view-action-mixin to ''action'', which must be |
| | 104 | either ''nil'' or a funcallable object (function or symbol). If not |
| | 105 | ''nil'', the action will be called with one argument, the view itself. |
| | 106 | |
| | 107 | {{{(view-action view-action-mixin) [method]}}} |
| | 108 | |
| | 109 | Returns the action of view-action-mixin. |
| | 110 | |
| | 111 | == View Mouse Tracker mixin == |
| | 112 | |
| | 113 | {{{view-mouse-tracker-mixin () [class]}}} |
| | 114 | |
| | 115 | A mixin for views that support mouse tracking, used to implement live update. Initargs: |
| | 116 | |
| | 117 | :view-mouse-tracker -- initializes the view mouse tracker, see set-view-mouse-tracker |
| | 118 | |
| | 119 | {{{(set-view-mouse-tracker view-mouse-tracker-mixin tracker) [method]}}} |
| | 120 | |
| | 121 | Sets the mouse tracking handler for the view view-mouse-tracker-mixin |
| | 122 | to ''tracker'', which should be either ''nil'' or a funcallable object |
| | 123 | (function or symbol). If not ''nil'', ''tracker'' will be called when the user |
| | 124 | first clicks in the view and then repeatedly for as long as the user |
| | 125 | holds down the mouse button. The function will receive two arguments, |
| | 126 | the view and the part code for the part of the view where the click |
| | 127 | first occurred, unless the mouse has moved out of the initial part, in |
| | 128 | which case the second argument will be ''nil''. |
| | 129 | |
| | 130 | {{{(view-mouse-tracker view-mouse-tracker-mixin tracker) [method]}}} |
| | 131 | |
| | 132 | Returns the mouse tracker of view-mouse-tracker-mixin. |
| | 133 | |
| | 134 | == View Nib mixin == |
| | 135 | |
| | 136 | {{{view-nib-mixin () [class]}}} |
| | 137 | |
| | 138 | A mixin for views that can be loaded from nib files, currently windows and menus. Initargs: |
| | 139 | |
| | 140 | '':view-nib-name'' -- specifies the name of the view description in a nib file. |
| | 141 | |
| | 142 | '':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. |
| | 143 | |
| | 144 | See Interface Builder Support section below for more information. |