On this page:
drracket: module-language-tools: add-opt-out-toolbar-button

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.