home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / doc / Xaw / Tree < prev    next >
Encoding:
Text File  |  1991-07-29  |  4.9 KB  |  198 lines

  1. .NH 2
  2. Tree Widget
  3. .LP
  4. .XS
  5.     Tree Widget
  6. .XE
  7. .IN "Tree widget" "" "@DEF@"
  8. .Ds 0
  9. .TA 2.0i
  10. .ta 2.0i
  11. .sp
  12. Application Header file    <X11/Xaw/Tree.h>
  13. .IN "Box.h" ""
  14. Class Header file    <X11/Xaw/TreeP.h>
  15. .IN "TreeP.h" ""
  16. Class        treeWidgetClass
  17. .IN "treeWidgetClass" ""
  18. Class Name    Tree
  19. .IN "Tree widget" "class name"
  20. Superclass    Constraint
  21. .sp
  22. .De
  23. .LP
  24. The Tree widget provides geometry management of arbitrary widgets arranged
  25. in a directed, acyclic graph (i.e., a tree).  The hierarchy is contructed by
  26. attaching a constraint resource called \fBtreeParent\fP to each widget
  27. indicating which other node in the tree should be treated as the widget's
  28. superior.  The structure of the tree is shown by laying out the nodes
  29. in the standard format for tree diagrams with lines drawn connecting each
  30. node with its children.
  31. .LP
  32. The Tree sizes itself according to the needs of its children and is not
  33. intended to be resized by its parent.  Instead, it should be placed inside
  34. another composite widget (such as the \fBPorthole\fP or \fBViewport\fP) 
  35. that can be used to scroll around in the tree.
  36. .NH 3
  37. Resources
  38. .LP
  39. When creating a Tree widget instance, the following resources are
  40. retrieved from the argument list or from the resource database:
  41. .LP
  42. .IN "Box widget" "resources"
  43. .ps 9
  44. .nr PS 9
  45. .vs 11
  46. .nr VS 11
  47. .TS H
  48. expand;
  49. lw(1i) lw(1i) lw(1i) lw(.5i) lw(2i).
  50. _
  51. .sp 3p
  52. .TB
  53. Name    Class    Type    Notes    Default Value
  54. .sp 3p
  55. _
  56. .TH
  57. .R
  58. .sp 3p
  59. accelerators    Accelerators    AcceleratorTable        NULL
  60. ancestorSensitive    AncestorSensitive    Boolean    D    True
  61. autoReconfigure    AutoReconfigure    Boolean        False
  62. background    Background    Pixel        XtDefaultBackground
  63. backgroundPixmap    Pixmap    Pixmap        XtUnspecifiedPixmap
  64. borderColor    BorderColor    Pixel        XtDefaultForeground
  65. borderPixmap    Pixmap    Pixmap        XtUnspecifiedPixmap
  66. borderWidth    BorderWidth    Dimension        1
  67. children    ReadOnly    WidgetList    R    NULL
  68. colormap    Colormap    Colormap        Parent's Colormap
  69. depth    Depth    int    C    Parent's Depth
  70. destroyCallback    Callback    XtCallbackList        NULL
  71. foreground    Foreground    Pixel        XtDefaultForeground
  72. gravity    Gravity    XtGravity        WestGravity
  73. height    Height    Dimension    A    see \fBLayout Semantics\fP
  74. hSpace    HSpace    Dimension        4
  75. lineWidth    LineWidth    Dimension        0
  76. mappedWhenManaged    MappedWhenManaged    Boolean        True
  77. numChildren    ReadOnly    Cardinal    R    0
  78. screen    Screen    Screen    R    Parent's Screen
  79. sensitive    Sensitive    Boolean        True
  80. vSpace    VSpace    Dimension        4
  81. translations    Translations    TranslationTable        NULL
  82. width    Width    Dimension    A    see \fBLayout Semantics\fP
  83. x    Position    Position        0
  84. y    Position    Position        0
  85. .sp 3p
  86. _
  87. .TE
  88. .ps 11
  89. .nr PS 11
  90. .vs 13
  91. .nr VS 13
  92. .IP \fBautoReconfigure\fP 1.5i
  93. Whether or not to layout the tree every time a node is added or removed.
  94. .Bg
  95. .Gp
  96. .Bc
  97. .Bp
  98. .Bw
  99. .Ch
  100. .Cm
  101. .Dp
  102. .Dc
  103. .Lg
  104. .IP \fBgravity\fP 1.5i
  105. .IN "conversions" "Gravity"
  106. Specifies the side of the widget from which the tree should grow.  Valid
  107. values include \fBWestGravity\fP, \fBNorthGravity\fP, \fBEastGravity\fP, and
  108. \fBSouthGravity\fP.
  109. .Rs "\fP the legal values\fB"
  110. .Hw
  111. .IP \fBhSpace\fP 1.5i
  112. .br
  113. .ns
  114. .IP \fBvSpace\fP 1.5i
  115. The amount of space, in pixels, to leave between the children.  This
  116. resource specifies the amount of space left between the outermost
  117. children and the edge of the box. 
  118. .IP \fBlineWidth\fP 1.5i
  119. The width of the lines from nodes that do not have a \fBtreeGC\fP
  120. constraint resource to their children.
  121. .Mm
  122. .Nc
  123. .Sc
  124. .Se
  125. .Tr
  126. .Xy
  127. .NH 3
  128. Constraint Resources
  129. .LP
  130. .IN "Tree widget" "constraint resources"
  131. Each child of the Tree widget must specify its superior node in the tree.  In
  132. addition, it may specify a GC to use when drawing a line between it and its
  133. inferior nodes.
  134. .LP
  135. .ps 9
  136. .nr PS 9
  137. .vs 11
  138. .nr VS 11
  139. .TS H
  140. lw(1i) lw(1i) lw(1i) lw(.5i) lw(2i).
  141. _
  142. .sp 3p
  143. .TB
  144. Name    Class    Type    Notes    Default Value
  145. .sp 3p
  146. _
  147. .TH
  148. .R
  149. .sp 3p
  150. treeGC    TreeGC    GC        NULL
  151. treeParent    TreeParent    Widget        NULL
  152. .sp 3p
  153. _
  154. .TE
  155. .ps 11
  156. .nr PS 11
  157. .vs 13
  158. .nr VS 13
  159. .IP \fBtreeGC\fP 1.5i
  160. This specifies the GC to use when drawing lines between this widget and its
  161. inferiors in the tree.  If this resource is not specified, the Tree's
  162. \fBforeground\fP and \fBlineWidth\fP will be used.
  163. .IP \fBtreeParent\fP 1.5i
  164. This specifies the superior node in the tree for this widget.  The default is
  165. for the node to have no superior (and to therefore be at the top of the tree).
  166. .NH 3
  167. Layout Semantics
  168. .IN "Tree widget" "layout semantics"
  169. .LP
  170. Each time a child is managed or unmanaged, the Tree widget will attempt
  171. to reposition the remaining children to fix the shape of the tree if the
  172. .B autoReconfigure
  173. resource is set.  Children at the top (most superior) of the tree are
  174. drawn at
  175. the side specified by the 
  176. .B gravity
  177. resource.
  178. .LP
  179. After positioning all children, the Tree widget attempts to shrink its
  180. own size to the minimum dimensions required for the layout.
  181. .NH 3
  182. Convenience Routines
  183. .LP
  184. .IN "Tree widget" "convenience routines"
  185. The most efficient way to layout a tree is to set
  186. .B autoReconfigure
  187. to False and then use the 
  188. .B XawTreeForceLayout
  189. routine to arrange the children.
  190. .IN "XawTreeForceLayout" "" "@DEF@"
  191. .FD 0
  192. void XawTreeForceLayout(\fIw\fP)
  193. .br
  194.     Widget \fIw\fP;
  195. .FN
  196. .IP \fIw\fP 1i
  197. Specifies the Tree widget.
  198.