/racket-5-0-2-bin-i386-osx-mac-dmg/collects/mrlib/scribblings/hierlist/list.scrbl

http://github.com/smorin/f4f.arc · Racket · 208 lines · 130 code · 78 blank · 0 comment · 7 complexity · 9fc46ab006ce828283a0cff56b61d394 MD5 · raw file

  1. #lang scribble/doc
  2. @(require "../common.ss"
  3. (for-label mrlib/hierlist))
  4. @defclass/title[hierarchical-list% editor-canvas% ()]{
  5. Creates a hierarchical-list control.
  6. @defconstructor[([parent (or/c (is-a?/c frame%) (is-a?/c dialog%)
  7. (is-a?/c panel%) (is-a?/c pane%))]
  8. [style (listof (one-of/c 'no-border 'control-border 'combo
  9. 'no-hscroll 'no-vscroll
  10. 'hide-hscroll 'hide-vscroll
  11. 'auto-vscroll 'auto-hscroll
  12. 'resize-corner 'deleted 'transparent))
  13. '(no-hscroll)])]{
  14. Creates the control.
  15. If the style @scheme['transparent] is passed, then the
  16. @method[editor-snip% use-style-background] method will be
  17. called with @scheme[#t] when editor snips are created as part of
  18. the hierarchical list, ensuring that the entire control is
  19. transparent.
  20. }
  21. @defmethod[(get-selected) (or/c (is-a?/c hierarchical-list-item<%>)
  22. false/c)]{
  23. Returns the currently selected item, if any.}
  24. @defmethod[(new-item [mixin ((implementation?/c hierarchical-list-item<%>)
  25. . -> .
  26. (implementation?/c hierarchical-list-item<%>))
  27. (lambda (%) %)])
  28. (is-a?/c hierarchical-list-item<%>)]{
  29. Creates and returns a new (empty) item in the list. See
  30. @scheme[hierarchical-list-item<%>] for methods to fill in the item's
  31. label.
  32. The @scheme[mixin] argument is applied to a class implementing
  33. @scheme[hierarchical-list-item<%>], and the resulting class is
  34. instantiated as the list item.}
  35. @defmethod[(set-no-sublists [no-sublists? any/c]) void?]{
  36. Enables/disables sublist mode. When sublists are disabled, space to
  37. the left of the list items (that would normally align non-list items
  38. with list items) is omitted. This method can be called only when the
  39. list is empty.}
  40. @defmethod[(new-list [mixin ((implementation?/c hierarchical-list-compound-item<%>)
  41. . -> .
  42. (implementation?/c hierarchical-list-compound-item<%>))
  43. (lambda (%) %)])
  44. (is-a?/c hierarchical-list-compound-item<%>)]{
  45. Creates and returns a new (empty) sub-list in the list. See
  46. @scheme[hierarchical-list-compound-item<%>] for methods to fill in the
  47. item's label and content.
  48. The @scheme[mixin] argument is applied to a class implementing
  49. @scheme[hierarchical-list-compound-item<%>], and the resulting class
  50. is instantiated as the sub-list.}
  51. @defmethod[(delete-item [i (is-a?/c hierarchical-list-item<%>)]) void?]{
  52. Deletes immediate item or sub-list @scheme[i] from the list.}
  53. @defmethod[(get-items) (listof (is-a?/c hierarchical-list-item<%>))]{
  54. Returns a list of all immediate items in the list control.}
  55. @defmethod*[([(selectable) boolean?]
  56. [(selectable [on? any/c]) void?])]{
  57. Reports whether items are selectable, or enables/disables item
  58. selection.}
  59. @defmethod[(on-select [i (or/c (is-a?/c hierarchical-list-item<%>) false/c)]) any]{
  60. Called for new select of @scheme[i], where @scheme[i] is @scheme[#f]
  61. if no item is now selected.}
  62. @defmethod[(on-click [i (is-a?/c hierarchical-list-item<%>)]) any]{
  63. Called when an item is clicked on, but selection for that item is not
  64. allowed. Selection can be disallowed by @method[hierarchical-list%
  65. selectable] or @xmethod[hierarchical-list-item<%>
  66. set-allow-selection].}
  67. @defmethod[(on-double-select [i (is-a?/c hierarchical-list-item<%>)]) any]{
  68. Called for a double-click on @scheme[i].}
  69. @defmethod[(on-item-opened [i (is-a?/c hierarchical-list-compound-item<%>)]) any]{
  70. Called when the arrow for @scheme[i] is turned down.}
  71. @defmethod[(on-item-closed [i (is-a?/c hierarchical-list-compound-item<%>)]) any]{
  72. Called when the arrow for @scheme[i] is turned up.}
  73. @defmethod[(sort [less-than-proc ((is-a?/c hierarchical-list-item<%>)
  74. (is-a?/c hierarchical-list-item<%>)
  75. . -> . any/c)]
  76. [recur? any/c #t])
  77. void?]{
  78. Sorts items in the list by calling @scheme[less-than-proc] on pairs of
  79. items. If @scheme[recur?] is true, items in sub-lists are sorted
  80. recursively.}
  81. @defmethod[(can-do-edit-operation? [op symbol?] [recursive? any/c #t])
  82. boolean?]{
  83. Like @xmethod[editor<%> can-do-edit-operation?]. The default
  84. implementation always returns @scheme[#f].}
  85. @defmethod[(do-edit-operation [op symbol?] [recursive? any/c #t])
  86. void?]{
  87. Like @xmethod[editor<%> do-edit-operation]. The default implementation
  88. does nothing.}
  89. @defmethod*[([(select-prev) void?]
  90. [(select-next) void?]
  91. [(select-first) void?]
  92. [(select-last) void?]
  93. [(select-in) void?]
  94. [(select-out) void?]
  95. [(page-up) void?]
  96. [(page-down) void?])]{
  97. Move the selection, scroll, and call @method[hierarchical-list
  98. on-select].}
  99. @defmethod[(select [i (or/c (is-a?/c hierarchical-list-item<%>) false/c)]) void?]{
  100. Moves the selection, scrolls as necessary to show it, and calls
  101. @method[hierarchical-list% on-select] unless disabled via
  102. @method[hierarchical-list% on-select-always].
  103. The @method[hierarchical-list% allow-deselect] method controls whether
  104. @scheme[i] is allowed to be @scheme[#f] to deselect the currently
  105. selected item.}
  106. @defmethod[(click-select [i (or/c (is-a?/c hierarchical-list-item<%>) false/c)]) void?]{
  107. Like @method[hierarchical-list% select], but always calls
  108. @method[hierarchical-list% on-select].}
  109. @defmethod*[([(on-select-always) boolean?]
  110. [(on-select-always [always? any/c]) void?])]{
  111. Gets/sets whether the @method[hierarchical-list% on-select] method is
  112. called in response to @method[hierarchical-list% select] (as opposed
  113. to @method[hierarchical-list% click-select]).
  114. The initial mode enables @method[hierarchical-list% on-select] calls
  115. always.}
  116. @defmethod*[([(on-click-always) boolean?]
  117. [(on-click-always [always? any/c]) void?])]{
  118. Gets/sets whether the @method[hierarchical-list% on-click] method is
  119. called in response to all mouse clicks (as opposed to only when
  120. selected). @method[hierarchical-list% on-click] is called before
  121. @method[hierarchical-list% on-select], if it is called (if the click
  122. results in selction).
  123. This is initially disabled, by default.}
  124. @defmethod*[([(allow-deselect) boolean?]
  125. [(allow-deselect [allow? any/c]) void?])]{
  126. Gets/sets whether the @method[hierarchical-list% on-select] can be
  127. called with a @scheme[#f] argument to deselect the current item
  128. (leaving none selected).
  129. The initial mode does not allow deselection.}
  130. }