2.5.3 editor-admin%

► |  | GUI: Racket Graphics Toolkit

1 | Overview
2 | Reference
3 | Configuration
4 | Dynamic Loading
| Bibliography
| Index

► | 2 | Reference

2.1 | Windowing Classes
2.2 | Windowing Functions
2.3 | Drawing Classes
2.4 | Drawing Functions
2.5 | Editor Classes
2.6 | Editor Functions
2.7 | WXME Decoding

▼ | 2.5 | Editor Classes

2.5.1 | add-color<%>
2.5.2 | editor<%>
2.5.3 | editor-admin%
2.5.4 | editor-canvas%
2.5.5 | editor-data%
2.5.6 | editor-data-class%
2.5.7 | editor-data-class-list<%>
2.5.8 | editor-snip-editor-admin<%>
2.5.9 | editor-snip%
2.5.10 | editor-stream-in%
2.5.11 | editor-stream-in-base%
2.5.12 | editor-stream-in-bytes-base%
2.5.13 | editor-stream-out%
2.5.14 | editor-stream-out-base%
2.5.15 | editor-stream-out-bytes-base%
2.5.16 | editor-wordbreak-map%
2.5.17 | image-snip%
2.5.18 | keymap%
2.5.19 | mult-color<%>
2.5.20 | pasteboard%
2.5.21 | readable-snip<%>
2.5.22 | snip%
2.5.23 | snip-admin%
2.5.24 | snip-class%
2.5.25 | snip-class-list<%>
2.5.26 | string-snip%
2.5.27 | style<%>
2.5.28 | style-delta%
2.5.29 | style-list%
2.5.30 | tab-snip%
2.5.31 | text%

On this page:

get-dc
get-max-view
get-view
grab-caret
modified
needs-update
popup-menu
refresh-delayed?
resized
scroll-to
update-cursor

top← prev up next →

editor-admin% : class?
superclass: object%

See Administrators for information about the role of administrators. The editor-admin% class is never instantiated directly. It is not even instantiated through derived classes by most programmers; each editor-canvas% and editor-snip% object creates its own administrator. However, it may be useful to derive a new instance of this class to display editors in a new context. Also, it may be useful to call the methods of an existing administrator from an owned editor.

To create a new editor-admin% class, all methods described here must be overridden. They are all invoked by the administrator’s editor.

( new editor-admin%) → ( is-a?/c editor-admin%)

Creates a (useless) editor administrator.

( send an-editor-admin get-dc [x y])
→ ( or/c ( is-a?/c dc<%>) false/c)
x : ( or/c ( box/c real?) false/c) = #f
y : ( or/c ( box/c real?) false/c) = #f

Specification: Returns either the drawing context into which the editor is displayed, or the context into which it is currently being drawn. When the editor is not embedded, the returned context is always the drawing content into which the editor is displayed. If the editor is not displayed, #f is returned.

The origin of the drawing context is also returned, translated into the local coordinates of the editor. For an embedded editor, the returned origin is reliable only while the editor is being drawn, or while it receives a mouse or keyboard event.

The x box is filled with the x-origin of the DC in editor coordinates, unless x is #f. The y box is filled with the y-origin of the DC in editor coordinates, unless y is #f.

See also editor-location-to-dc-location in editor<%> and dc-location-to-editor-location in editor<%>.

Default implementation: Fills all boxes with 0.0 and returns #f.

( send an-editor-admin get-max-view |  | x |  |  |  |
|  | y |  |  |  |
|  | w |  |  |  |
|  | h |  |  |  |
| [ | full?]) |  | → |  | 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)
full? : any/c = #f

Specification: Same as get-view unless the editor is visible in multiple standard displays. If the editor has multiple displays, a region is computed that includes the visible region in all displays.

See get-view.

Default implementation: Fills all boxes with 0.0.

( send an-editor-admin get-view x y w h [full?]) → 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)
full? : any/c = #f

Specification: Gets the visible region of the editor within its display (in editor coordinates), or the overall size of the viewing region in the editor’s top-level display (for an embedded editor).

If the display is an editor canvas, see also reflow-container. The viewing area within an editor canvas is not the full client area of the canvas, because an editor canvas installs a whitespace border around a displayed editor within the client area.

The calculation of the editor’s visible region is based on the current size and scrollbar values of the top-level display. For an editor canvas display, the region reported by get-view does not depend on whether the canvas is hidden, obscured by other windows, or moved off the edge of the screen.

The x box is filled with the left edge of the visible region in editor coordinates, unless x is #f. The y box is filled with the top edge of the visible region in editor coordinates, unless y is #f. The w box is filled with the width of the visible region, which may be larger than the editor itself, unless w is #f. The h box is filled with the height of the visible region, which may be larger than the editor itself, unless h is #f.

If an editor is fully visible and full? is #f, then x and y will both be filled with 0.

If full? is a true value, then the returned area is the view area of the top-level display for the editor. This result is different only when the editor is embedded in another editor; in that case, the x and y values may be meaningless, because they are in the coordinate system of the immediate editor within the top-level display.

Default implementation: Fills all boxes with 0.0.

( send an-editor-admin grab-caret [domain]) → void?
domain : ( one-of/c 'immediate 'display 'global) = 'global

Specification: Called by the editor to request the keyboard focus. If the request is granted, then the administered editor’s own-caret method will be called.

See set-caret-owner for information about the possible values of domain.

Default implementation: Does nothing.

( send an-editor-admin modified modified?) → void?
modified? : any/c

Specification: Called by the editor to report that its modification state has changed to either modified or unmodified.

See also set-modified in editor<%>.

Default implementation: Does nothing.

( send an-editor-admin needs-update |  | localx |  |  |  |
|  | localy |  |  |  |
|  | w |  |  |  |
|  | h) |  | → |  | void?

localx : real?
localy : real?
w : ( and/c real? ( not/c negative?))
h : ( and/c real? ( not/c negative?))

Specification: Called by the editor to request a refresh to its displayed representation. When the administrator decides that the displayed should be refreshed, it calls the editor’s refresh method.

The localx, localy, w, and h arguments specify a region of the editor to be updated (in editor coordinates).

Default implementation: Does nothing.

( send an-editor-admin popup-menu menu x y) → boolean?
menu : ( is-a?/c popup-menu%)
x : real?
y : real?

Specification:
Pops up the given popup-menu% object at the specified coordinates (in this window’s coordinates), and returns after handling an unspecified number of events; the menu may still be popped up when this method returns. If a menu item is selected from the popup-menu, the callback for the menu item is called. (The eventspace for the menu item’s callback is the administrator’s display’s eventspace.)
While the menu is popped up, its target is set to the top-level editor in this administrator’s display. See get-popup-target for more information.
The result is #t if the popup succeeds, #f otherwise (independent of whether the user selects an item in the popup menu).

The menu is displayed at x and y in editor coordinates.

Default implementation: Returns #f.

( send an-editor-admin refresh-delayed?) → boolean?

Specification: Returns #t if updating on this administrator’s display is currently delayed (usually by begin-edit-sequence in editor<%> in an enclosing editor).

Default implementation: Returns #f.

( send an-editor-admin resized refresh?) → void?
refresh? : any/c

Specification: Called by the editor to notify its display that the editor’s size or scroll count has changed, so the scrollbars need to be adjusted to reflect the new size. The editor generally needs to be updated after a resize, but the editor decides whether the update should occur immediately. If refresh? is not #f, then the editor is requesting to be updated immediately.

Default implementation: Does nothing.

( send an-editor-admin scroll-to |  | localx |  |  |  |
|  | localy |  |  |  |
|  | w |  |  |  |
|  | h |  |  |  |
| [ | refresh? |  |  |  |
|  | bias]) |  | → |  | boolean?

localx : real?
localy : real?
w : ( and/c real? ( not/c negative?))
h : ( and/c real? ( not/c negative?))
refresh? : any/c = #t
bias : ( one-of/c 'start 'end 'none) = 'none

Specification: Called by the editor to request scrolling so that the given region is visible. The editor generally needs to be updated after a scroll, but the editor decides whether the update should occur immediately.

The localx, localy, w, and h arguments specify a region of the editor to be made visible by the scroll (in editor coordinates).

If refresh? is not #f, then the editor is requesting to be updated immediately.

The bias argument is one of:

- '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 return value is #t if the display is scrolled, #f if not (either because the requested region is already visible, because the display has zero size, or because the editor is currently printing.)

Default implementation: Return #f

( send an-editor-admin update-cursor) → void?

Specification: Queues an update for the cursor in the display for this editor. The actual cursor used will be determined by calling the editor’s adjust-cursor method.

Default implementation: Does nothing.
top← prev up next →