| | 1 | = Views = |
| | 2 | |
| | 3 | == Basic Views == |
| | 4 | |
| | 5 | The basic framework object is a ''view''. Views (windows, menus, controls) |
| | 6 | are represented by CLOS objects, and are created using ''make-instance''. |
| | 7 | |
| | 8 | {{{view ()[class]}}} |
| | 9 | |
| | 10 | An abstract superclass of all views (windows, menus, controls). All views support the following initargs: |
| | 11 | |
| | 12 | '':view-nick-name'' -- initializes the view nick-name, see set-view-nick-name |
| | 13 | |
| | 14 | '':view-subviews'' -- initializes the view subviews, see add-container |
| | 15 | |
| | 16 | '':view-size'' -- initializes the view size, see set-view-size |
| | 17 | |
| | 18 | '':view-width'' -- initializes the view width (overrides :view-size) |
| | 19 | |
| | 20 | '':view-height'' -- initializes the view height (overrides :view-size) |
| | 21 | |
| | 22 | '':view-tooltip'' -- initializes the view tooltip, see set-view-tooltip |
| | 23 | |
| | 24 | '':view-font'' -- initializes the view font, see set-view-font. |
| | 25 | |
| | 26 | '':view-enabled-p'' -- (default true), initializes the enabled/disabled state, see enable-view/disable-view |
| | 27 | |
| | 28 | '':view-ref'' --specifies an existing native window system object to base the view on. |
| | 29 | |
| | 30 | '':view-command-id'' -- initializes the view command id, see set-view-command-id. |
| | 31 | |
| | 32 | {{{(view-p object) [function]}}} |
| | 33 | |
| | 34 | True if //object// is a view. |
| | 35 | |
| | 36 | {{{(set-view-nick-name view name) [method]}}} |
| | 37 | |
| | 38 | Give the view a nick-name //name//, which can be any object. |
| | 39 | |
| | 40 | {{{(view-nick-name view) [method]}}} |
| | 41 | |
| | 42 | Returns the view's nick-name. |
| | 43 | |
| | 44 | {{{(view-named name view) [method]}}} |
| | 45 | |
| | 46 | Finds a subview of //view// whose nick-name is ''eql'' to //name//. |
| | 47 | |
| | 48 | {{{(view-subviews view &key type) [method]}}} |
| | 49 | |
| | 50 | Returns all subviews of //view//, i.e. all views whose view-container is view, optionally restricted to those of type //type//. |
| | 51 | |
| | 52 | {{{(add-subviews view &rest subviews) [method]}}} |
| | 53 | |
| | 54 | Make //view// be the container for each of the subviews. |
| | 55 | |
| | 56 | {{{(remove-subviews view &rest subviews) [method]}}} |
| | 57 | |
| | 58 | Remove each of the subviews from //view//. |
| | 59 | |
| | 60 | {{{(set-view-width view new-width) [method]}}} |
| | 61 | |
| | 62 | Sets the width of //view// to new-width, which must be a non-negative real. |
| | 63 | |
| | 64 | {{{(view-width view) [method]}}} |
| | 65 | |
| | 66 | Returns the width of //view//. |
| | 67 | |
| | 68 | {{{(set-view-height view new-height) [method]}}} |
| | 69 | |
| | 70 | Sets the size of //view// to //new-height//, which must be a non-negative real. |
| | 71 | |
| | 72 | {{{(view-height view) [method]}}} |
| | 73 | |
| | 74 | Returns the height of //view//. |
| | 75 | |
| | 76 | {{{(set-view-size view new-size) [method]}}} |
| | 77 | |
| | 78 | Sets the size of //view// to //new-size//, which is the height and width encoded as a point. |
| | 79 | |
| | 80 | {{{(view-size view) [method]}}} |
| | 81 | |
| | 82 | Returns the size (height and width) of //view// as a point. |
| | 83 | |
| | 84 | {{{(set-view-tooltip view tooltip) [method]}}} |
| | 85 | |
| | 86 | Sets the tooltip of view to //tooltip//, which must be a string or |
| | 87 | ''nil'' to remove the view's tooltip. The tooltip is shown when the |
| | 88 | mouse hovers over the view. |
| | 89 | |
| | 90 | {{{(view-tooltip view) [method]}}} |
| | 91 | |
| | 92 | Returns the tooltip of //view//. |
| | 93 | |
| | 94 | {{{(set-view-font view font-spec) [method]}}} |
| | 95 | |
| | 96 | Sets the font of //view// to //font-%%spec%%//, overriding the view's |
| | 97 | default font. Once you have set a view's font with this function, you |
| | 98 | can cause the view to revert to its default font by passing ''nil'' as |
| | 99 | the font-%%spec%%. |
| | 100 | |
| | 101 | {{{(view-font view) [method]}}} |
| | 102 | |
| | 103 | Returns the font of //view//. |
| | 104 | |
| | 105 | {{{(enable-view view) [method]}}} |
| | 106 | |
| | 107 | Makes //view// enabled, so it will respond to user input when active. |
| | 108 | |
| | 109 | {{{(disable-view view) [method]}}} |
| | 110 | |
| | 111 | Makes //view// disabled, so it will be drawn grayed out and will not respond to user input. |
| | 112 | |
| | 113 | {{{(view-enabled-p view) [method]}}} |
| | 114 | |
| | 115 | returns true if view is enabled. |
| | 116 | |
| | 117 | {{{(view-active-p view) [method]}}} |
| | 118 | |
| | 119 | True if //view// is active (able to accept user input). |
| | 120 | |
| | 121 | {{{(invalidate-view view &optional rect) [method]}}} |
| | 122 | |
| | 123 | Indicates that the contents of the view has become invalid (typically |
| | 124 | as a result of changes in the data displayed in the view). The system |
| | 125 | will arrange for the view to be redrawn. Optionally a rectangle may be |
| | 126 | specified to indicate that only the portion of the view bound by the |
| | 127 | rectangle needs to be redrawn. |
| | 128 | |
| | 129 | {{{(view-ref view) [method]}}} |
| | 130 | |
| | 131 | Returns the native window system object represented by //view//, to allow you to use the native window system directly. |
| | 132 | |
| | 133 | ---- |
| | 134 | ---- |
| | 135 | |
| | 136 | // TODO: need non-carbon version of next two: // |
| | 137 | |
| | 138 | {{{(set-view-command-id view command-id) [method]}}} |
| | 139 | |
| | 140 | Sets the command id for the view. //command-id// may be an ostype or it may be a keyword defined by |
| | 141 | define-carbon-command-event, q.v. |
| | 142 | |
| | 143 | {{{(view-command-id view) [method]}}} |
| | 144 | |
| | 145 | 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. |
| | 146 | |
| | 147 | //TODO: something for switching cursor based on what view it's in.// |
| | 148 | |
| | 149 | //TODO: resizing protocol (window-size-parts in MCL).// |
| | 150 | |