/racket-5-0-2-bin-i386-osx-mac-dmg/collects/scribblings/gui/labelled-menu-item-intf.scrbl

http://github.com/smorin/f4f.arc · Racket · 123 lines · 83 code · 40 blank · 0 comment · 3 complexity · 8440bd5da7de8bea9bcc2ba1403e5ef5 MD5 · raw file

  1. #lang scribble/doc
  2. @(require "common.ss")
  3. @definterface/title[labelled-menu-item<%> (menu-item<%>)]{
  4. A @scheme[labelled-menu-item<%>] object is a @scheme[menu-item<%>] with
  5. a string label (i.e., any menu item other than a separator). More
  6. specifically, it is an instance of either @scheme[menu-item%] (a
  7. plain menu item), @scheme[checkable-menu-item%] (a checkable menu
  8. item), or @scheme[menu%] (a submenu).
  9. @defmethod[(enable [enabled? any/c])
  10. void?]{
  11. Enables or disables the menu item. If the item is a submenu (or menu
  12. in a menu bar), the entire menu is disabled, but each submenu item's
  13. @method[labelled-menu-item<%> is-enabled?] method returns @scheme[#f]
  14. only if the item is specifically disabled (in addition to the
  15. submenu).
  16. }
  17. @defmethod[(get-help-string)
  18. (or/c label-string? false/c)]{
  19. Returns the help string for the menu item, or @scheme[#f] if the item
  20. has no help string.
  21. When an item has a @scheme[help], the string may be used to
  22. display help information to the user.
  23. }
  24. @defmethod[(get-label)
  25. label-string?]{
  26. Returns the item's label.
  27. See also @method[labelled-menu-item<%> set-label] and
  28. @method[labelled-menu-item<%> get-plain-label].
  29. }
  30. @defmethod[(get-plain-label)
  31. label-string?]{
  32. Like @method[labelled-menu-item<%> get-label], except that
  33. @litchar{&}s in the label are removed as described in
  34. @method[labelled-menu-item<%> set-label].
  35. }
  36. @defmethod[(is-enabled?)
  37. boolean?]{
  38. Returns @scheme[#t] if the menu item is enabled, @scheme[#f]
  39. otherwise.
  40. See also
  41. @method[labelled-menu-item<%> enable].
  42. }
  43. @defmethod[(on-demand)
  44. void?]{
  45. @methspec{
  46. Normally called when the user clicks on the menu bar containing the
  47. item (before the user sees any menu items), just before the popup
  48. menu containing the item is popped up, or just before inspecting the
  49. menu bar containing the item for a shortcut key binding.
  50. A @xmethod[menu-item-container<%> on-demand] method can be overridden
  51. in such a way that the container does not call the
  52. @method[labelled-menu-item<%> on-demand] method of its items.
  53. }
  54. @methimpl{
  55. Calls the @scheme[demand-callback] procedure that was provided when the
  56. object was created.
  57. }}
  58. @defmethod[(set-help-string [help (or/c label-string? false/c)])
  59. void?]{
  60. Sets the help string for the menu item. Use @scheme[#f] to remove the
  61. help string for an item.
  62. }
  63. @defmethod[(set-label [label label-string?])
  64. void?]{
  65. Sets the menu item's label. If the item has a shortcut, the shortcut
  66. is not affected.
  67. If the label contains @litchar{&} and the window is a control, the
  68. label is parsed specially; under Windows and X, the character
  69. following a @litchar{&} is underlined in the displayed menu to
  70. indicate a keyboard mnemonic. Pressing the Alt key with an underlined
  71. character from a menu's name in the menu bar causes the menu to be
  72. selected (via @method[frame% on-menu-char]). When a menu has the
  73. focus, the mnemonic characters are used for navigation without Alt. A
  74. @litchar{&&} in the label is replaced by a literal (non-navigation)
  75. @litchar{&}. Under Mac OS X, @litchar{&}s in the label are parsed in
  76. the same way as for X and Windows, but no mnemonic underline is
  77. displayed.
  78. A @litchar{&} is always preserved in the label returned by
  79. @method[labelled-menu-item<%> get-label], but never preserved in the
  80. label returned by @method[labelled-menu-item<%> get-plain-label].
  81. For historical reasons, if a label contains a tab character, then the
  82. tab and all remaining characters are hidden in the displayed menu.
  83. }}