▼ |  | Plugins: Extending Dr Racket

1 | Implementing Dr Racket Tools
2 | Adding Languages to Dr Racket
3 | Creating New Kinds of Dr Racket Frames
4 | Extending the Existing Dr Racket Classes
5 | Expanding the User’s Program Text and Breaking
6 | Editor Modes
7 | Language-specific capabilities
8 | Check Syntax
9 | drracket: get/ extend
10 | drracket: unit
11 | drracket: language
12 | drracket: language-configuration
13 | drracket: debug
14 | drracket: rep
15 | drracket: frame
16 | drracket: help-desk
17 | drracket: eval
18 | drracket: modes
19 | drracket: module-language-tools
20 | drracket: module-language
21 | Backwards compatibility
| Index

On this page:

drracket: module-language-tools: add-opt-out-toolbar-button

top ← prev up next →

### 19`` drracket:module-language-tools

If the result of read-language for a language is a function, DrRacket will query it to determine if there are any new toolbar buttons to be used when editing files in this language (when DrRacket’s language is set to the Module language).

Specifically, DrRacket will pass 'drscheme:toolbar-buttons to the function and expect back a value matching this contract:

( listof ( list/c string?
( is-a?/c bitmap% )
( -> ( is-a?/c drracket:unit:frame<%> ) any )))

which is then used to create new toolbar buttons, one for each list in the first. The string is the label on the button; the bitmap is the icon (it should be 16x16), and the function is called when the button is clicked.

( drracket:module-language-tools:add-opt-out-toolbar-button |
|  | make-button |
|  | id) |

→ void?

make-button

:

( -> ( is-a?/c top-level-window<%> )
( is-a?/c area-container<%> )
( is-a?/c switchable-button% ))

id : symbol?

Call this function to add another button to DrRacket’s toolbar. When buttons are added this way, DrRacket monitors the #lang line at the top of the file; when it changes DrRacket queries the language to see if this button should be included. These buttons are “opt out”, meaning that if the language doesn’t explicitly ask to not have this button (or all such buttons), the button will appear.

See read-language for more details on how language’s specify how to opt out. DrRacket will invoke the get-info proc from read-language with 'drscheme:opt-out-toolbar-buttons. If the result is a list of symbols, the listed symbols are opted out. If the result is #f, all buttons are opted out. The default is the empty list, meaning that all opt-out buttons appear.

top ← prev up next →