snip-admin% : class? |
superclass: object% |
To create a new snip-admin% class, all methods described here must be overridden. They are all invoked by the administrator’s snip.
Because a snip-admin% object typically owns more than one snip, many methods require a snip% object as an argument.
(new snip-admin%) → (is-a?/c snip-admin%)
(send a-snip-admin get-editor) → (or/c (is-a?/c text%) (is-a?/c pasteboard%))
(send a-snip-admin get-view x y w h [snip]) → void? x : (or/c (box/c real?) false/c) y : (or/c (box/c real?) false/c) w : (or/c (box/c (and/c real? (not/c negative?))) false/c) h : (or/c (box/c (and/c real? (not/c negative?))) false/c) snip : (or/c (is-a?/c snip%) false/c) = #f
If snip is not #f, the current visible region of the snip is installed in the boxes x, y, w, and h. The x and y values are relative to the snip’s top-left corner. The w and h values may be larger than the snip itself.
If snip is #f, the total visible region of the snip’s top-level display is returned in editor coordinates. Using #f for snip is analogous to using #t for full? in get-view in editor-admin%.
If no snip is specified, then the location and size of the snip’s editor are returned, instead, in editor coordinates.
See also get-view in editor-admin%.
Default implementation: Fills all boxes with 0.0.
(send a-snip-admin get-view-size h w) → void? h : (or/c (box/c (and/c real? (not/c negative?))) false/c) w : (or/c (box/c (and/c real? (not/c negative?))) false/c)
If the display is an editor canvas, see also reflow-container.
Default implementation: Fills all boxes with 0.0.
Default implementation: Does nothing.
(send a-snip-admin needs-update snip localx localy w h) → void? snip : (is-a?/c snip%) localx : real? localy : real? w : (and/c real? (not/c negative?)) h : (and/c real? (not/c negative?))
The localx, localy, w, and h arguments specify a region of the snip to be refreshed (in snip coordinates).
No update occurs if the given snip is not managed by this administrator.
Default implementation: Does nothing.
(send a-snip-admin popup-menu menu snip x y) → boolean? menu : (is-a?/c popup-menu%) snip : (is-a?/c snip%) x : real? y : real?
The menu is placed at x and y in snip coordinates.
While the menu is popped up, its target is set to the top-level editor in the display for this snip’s editor. See get-popup-target for more information.
Default implementation: Returns #f.
If refresh? is not #f, then the snip is requesting to be updated immediately. Otherwise, needs-update must eventually be called as well.
The method call is ignored if the given snip is not managed by this administrator.
Default implementation: Does nothing.
(send a-snip-admin release-snip snip) → boolean? snip : (is-a?/c snip%)
See also release-snip in editor<%> .
The result is #f if the given snip is not managed by this administrator.
Default implementation: Returns #f.
If refresh? is not #f, then the snip is requesting to be updated immediately, as if calling needs-update. Otherwise, needs-update must eventually be called as well.
The method call is ignored if the given snip is not managed by this administrator.
Default implementation: Does nothing.
(send a-snip-admin scroll-to snip localx localy w h refresh? [ bias]) → boolean? snip : (is-a?/c snip%) localx : real? localy : real? w : (and/c real? (not/c negative?)) h : (and/c real? (not/c negative?)) refresh? : any/c bias : (one-of/c 'start 'end 'none) = 'none
The localx, localy, w, and h arguments specify a region of the snip to be made visible by the scroll (in snip coordinates).
If refresh? is not #f, then the editor is requesting to be updated immediately.
'start —
if the range doesn’t fit in the visible area, show the top-left region 'none —
no special scrolling instructions 'end —
if the range doesn’t fit in the visible area, show the bottom-right region
The result is #t if the editor is scrolled, #f otherwise.
The method call is ignored (and the result is #f) if the given snip is not managed by this administrator.
Default implementation: Returns #f.
(send a-snip-admin set-caret-owner snip domain) → void? snip : (is-a?/c snip%) domain : (one-of/c 'immediate 'display 'global)
See set-caret-owner for information about the possible values of domain.
The method call is ignored if the given snip is not managed by this administrator.
Default implementation: Does nothing.
(send a-snip-admin update-cursor) → void?
Default implementation: Does nothing.
(send a-snip-admin get-selected-text-color) → void?
(send a-snip-admin call-with-busy-cursor thunk) → any thunk : (-> any)
Default implementation: Does nothing.
(send a-snip-admin get-tabs [ length tab-width in-units]) → (listof real?) length : (or/c (box/c exact-nonnegative-integer?) #f) = #f tab-width : (or/c (box/c real?) #f) = #f in-units : (or/c (box/c any/c) #f) = #f
The length box is filled with the length of the tab array (and therefore the returned list), unless length is #f. The tab-width box is filled with the width used for tabs past the end of the tab array, unless tab-width is #f. The in-units box is filled with #t if the tabs are specified in canvas units or #f if they are specified in space-widths, unless in-units is #f.