19 drracket:frame

▼ |  | Dr Racket Plugins

1 | Dr Racket support for #lang-based Languages
2 | Implementing Dr Racket Plugins
3 | Adding Languages to Dr Racket
4 | Creating New Kinds of Dr Racket Frames
5 | Extending the Existing Dr Racket Classes
6 | Expanding the User’s Program Text and Breaking
7 | Editor Modes
8 | Plugin Capabilities
9 | Check Syntax
10 | Cooperating with Background Check Syntax
11 | Teaching Languages
12 | Signatures
13 | drracket: get/ extend
14 | drracket: unit
15 | drracket: language
16 | drracket: language-configuration
17 | drracket: debug
18 | drracket: rep
19 | drracket: frame
20 | drracket: help-desk
21 | drracket: eval
22 | drracket: modes
23 | drracket: module-language-tools
24 | drracket: module-language
25 | drracket: tracing
26 | Backwards Compatibility
| Index

On this page:

drracket: frame: name-message%
make-object
set-message
drracket: frame: mixin
drracket: frame: basics-mixin
edit-menu: between-find-and-preferences
file-menu: between-open-and-revert
file-menu: between-print-and-close
file-menu: new-callback
file-menu: new-string
file-menu: open-callback
file-menu: open-string
get-additional-important-urls
help-menu: about-callback
help-menu: about-string
help-menu: before-about
help-menu: create-about?
drracket: frame: basics<%>
drracket: frame: <%>
add-show-menu-items
set-show-menu-sort-key
get-show-menu
update-shown

top ← prev up next →

### 19`` drracket:frame

class drracket:frame:name-message% : class?
superclass: canvas%

This class implements the little filename button in the top-left hand side of DrRacket’s frame.

> > constructor (make-object drracket:frame:name-message% parent)
> > → (is-a?/c drracket:frame:name-message%)
> > parent : (is-a?/c area-container<%>)

> > > method
> > > (send a-drracket:frame:name-message set-message |  | name |
> > > |  | short-name) |
> > → void?
> > name : (or/c string? false/c)
> > short-name : string?

> Specification: Sets the names that the button shows.

> Default implementation: The string short-name is the name that is shown on the button and name is shown when the button is clicked on, in a separate window. If name is #f, a message indicating that the file hasn’t been saved is shown.

mixin drracket:frame:mixin : (class? . -> . class?)
argument extends/implements: | drracket:frame:basics<%>
| frame:text-info<%>
| frame:editor<%>
result implements: | drracket:frame:<%>

Provides an implementation of drracket:frame:<%>

mixin drracket:frame:basics-mixin : (class? . -> . class?)
argument extends/implements: | frame:standard-menus<%>
result implements: | drracket:frame:basics<%>

Use this mixin to establish some common menu items across various DrRacket windows.

> > method (send a-drracket:frame:basics edit-menu:between-find-and-preferences edit-menu)
> > → void?
> > edit-menu : (is-a?/c menu%)

> Overrides edit-menu:between-find-and-preferences in frame:standard-menus<%>.
> Adds a separator-menu-item%. Next, adds the "Keybindings" menu item to the edit menu. Finally, if the current-eventspace-has-standard-menus? procedure returns #f, creates another separator-menu-item%.

> > method (send a-drracket:frame:basics file-menu:between-open-and-revert file-menu)
> > → void?
> > file-menu : (is-a?/c menu%)

> Overrides file-menu:between-open-and-revert in frame:standard-menus<%>.
> Adds an “Install .plt File...” menu item, which downloads and installs .plt files from the web, or installs them from the local disk. After that, calls the super method.

> > method (send a-drracket:frame:basics file-menu:between-print-and-close file-menu)
> > → void?
> > file-menu : (is-a?/c menu%)

> Overrides file-menu:between-print-and-close in frame:standard-menus<%>.
> Calls the super method. Then, creates a menu item for multi-file searching. Finally, adds a separator-menu-item%.

> > > method
> > > (send a-drracket:frame:basics file-menu:new-callback |  | item |
> > > |  | evt) |
> > → void?
> > item : (is-a?/c menu-item%)
> > evt : (is-a?/c control-event%)

> Overrides file-menu:new-callback in frame:standard-menus<%>.
> Opens a new, empty DrRacket window.

> > method (send a-drracket:frame:basics file-menu:new-string) → string?

> Overrides file-menu:new-string in frame:standard-menus<%>.
> Returns the empty string.

> > > method
> > > (send a-drracket:frame:basics file-menu:open-callback |  | item |
> > > |  | evt) |
> > → void?
> > item : (is-a?/c menu-item%)
> > evt : (is-a?/c control-event%)

> Overrides file-menu:open-callback in frame:standard-menus<%>.
> Calls handler:edit-file.

> > method (send a-drracket:frame:basics file-menu:open-string) → string?

> Overrides file-menu:open-string in frame:standard-menus<%>.
> Returns the empty string.

> > method (send a-drracket:frame:basics get-additional-important-urls)
> > → (listof (list string string))

> Specification: Each string in the result of this method is added as a menu item to DrRacket’s “Related Web Sites” menu item. The first string is the name of the menu item and the second string is a url that, when the menu item is chosen, is sent to the user’s browser.

> Default implementation: Returns the empty list by default.

> > > method
> > > (send a-drracket:frame:basics help-menu:about-callback |  | item |
> > > |  | evt) |
> > → void?
> > item : (is-a?/c menu-item%)
> > evt : (is-a?/c control-event%)

> Overrides help-menu:about-callback in frame:standard-menus<%>.
> Opens an about box for DrRacket.

> > method (send a-drracket:frame:basics help-menu:about-string)
> > → string?

> Overrides help-menu:about-string in frame:standard-menus<%>.
> Returns the string "DrRacket".

> > method (send a-drracket:frame:basics help-menu:before-about help-menu)
> > → void?
> > help-menu : (is-a?/c menu%)

> Overrides help-menu:before-about in frame:standard-menus<%>.
> Adds the Help Desk menu item and the Welcome to DrRacket menu item.

> > method (send a-drracket:frame:basics help-menu:create-about?)
> > → boolean?

> Overrides help-menu:create-about? in frame:standard-menus<%>.
> Returns #t.

interface drracket:frame:basics<%> : interface?
implements: | frame:standard-menus<%>

This interface is the result of the drracket:frame:basics-mixin

interface drracket:frame:<%> : interface?
implements: | frame:editor<%>
| frame:text-info<%>
| drracket:frame:basics<%>

> > method (send a-drracket:frame: add-show-menu-items show-menu) → void?
> > show-menu : (is-a?/c menu%)

> Specification: This method is called during the construction of the View menu. This method is intended to be overridden with the overriding methods adding other Show/Hide menu items to the View menu.

> See also set-show-menu-sort-key and get-show-menu. Default implementation: Does nothing.

> > > method
> > > (send a-drracket:frame: set-show-menu-sort-key |  | item |  |  |  |
> > > |  | key) |  | → |  | void?
> > item : (is-a?/c menu-item<%>)
> > key : (and/c real? positive?)

> Controls the ordering of items in the View menu.

> The number determines the sorting order and where separators in the menu appear (smaller numbers first).

> These are the numbers for many of the View menu items that come built-in to DrRacket:

> Toolbar | 1
> Split | 2
> Collapse | 3
> Show Definitions | 101
> Show Interactions | 102
> Use Horizontal Layout | 103
> Show Log | 205
> Show Tracing | 206
> Hide Profile | 207
> Show Program Contour | 301
> Show Line Numbers | 302
> Show Module Browser | 401

> In addition, a separator is inserted for each 100. So, for example, a separator is inserted between Collapse and Show Definitions.

> Note that the argument may be a rational number, effectively allowing insertion between any two menu items already in the menu. For this reason, avoid using 0, or any number is that 0 modulo 100.

> > method (send a-drracket:frame: get-show-menu) → (is-a?/c menu%)

> returns the View menu, for use by the update-shown method.

> See also add-show-menu-items.

> The method (and others) uses the word show to preserve backwards compatibility from when the menu itself was named the Show menu.

> > method (send a-drracket:frame: update-shown) → void?

> Specification: This method is intended to be overridden. It’s job is to update the "View" menu to match the state of the visible windows. In the case of the standard DrRacket window, it change the menu items to reflect the visibility of the definitions and interaction editor-canvas%s.

> Call this method whenever the state of the show menu might need to change.

> See also get-show-menu.

> Default implementation: Does nothing.

top ← prev up next →