home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / tcl / tk3.3b1 / doc / pack.n < prev    next >
Encoding:
Text File  |  1993-07-01  |  10.7 KB  |  269 lines

  1. '\"
  2. '\" Copyright (c) 1990-1992 The Regents of the University of California.
  3. '\" All rights reserved.
  4. '\"
  5. '\" Permission is hereby granted, without written agreement and without
  6. '\" license or royalty fees, to use, copy, modify, and distribute this
  7. '\" documentation for any purpose, provided that the above copyright
  8. '\" notice and the following two paragraphs appear in all copies.
  9. '\"
  10. '\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
  11. '\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  12. '\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  13. '\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. '\"
  15. '\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  16. '\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  17. '\" AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  18. '\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  19. '\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20. '\" 
  21. '\" $Header: /user6/ouster/wish/man/RCS/pack.n,v 1.9 93/07/01 13:35:22 ouster Exp $ SPRITE (Berkeley)
  22. '/" 
  23. .so man.macros
  24. .HS pack tk
  25. .BS
  26. '\" Note:  do not modify the .SH NAME line immediately below!
  27. .SH NAME
  28. pack \- Geometry manager that packs around edges of cavity
  29. .SH SYNOPSIS
  30. \fBpack \fIoption arg \fR?\fIarg ...\fR?
  31. .BE
  32.  
  33. .SH DESCRIPTION
  34. .PP
  35. The \fBpack\fR command is used to communicate with the packer,
  36. a geometry manager that arranges the children of a parent by
  37. packing them in order around the edges of the parent.
  38. The \fBpack\fR command can have any of several forms, depending
  39. on the \fIoption\fR argument:
  40. .TP
  41. \fBpack \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
  42. If the first argument to \fBpack\fR is a window name (any value
  43. starting with ``.''), then the command is processed in the same
  44. way as \fBpack configure\fR.
  45. .TP
  46. \fBpack configure \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
  47. The arguments consist of the names of one or more slave windows
  48. followed by pairs of arguments that specify how
  49. to manage the slaves.
  50. See ``THE PACKER ALGORITHM'' below for details on how the options
  51. are used by the packer.
  52. The following options are supported:
  53. .RS
  54. .TP
  55. \fB\-after \fIother\fR
  56. \fIOther\fR must the name of another window.
  57. Use its master as the master for the slaves, and insert
  58. the slaves just after \fIother\fR in the packing order.
  59. .TP
  60. \fB\-anchor \fIanchor\fR
  61. \fIAnchor\fR must be a valid anchor position such as \fBn\fR
  62. or \fBsw\fR; it specifies where to position each slave in its
  63. frame.
  64. Defaults to \fBcenter\fR.
  65. .TP
  66. \fB\-before \fIother\fR
  67. \fIOther\fR must the name of another window.
  68. Use its master as the master for the slaves, and insert
  69. the slaves just before \fIother\fR in the packing order.
  70. .TP
  71. \fB\-expand \fIboolean\fR
  72. Specifies whether the slaves should be expanded to consume
  73. extra space in their master.
  74. \fIBoolean\fR may have any proper boolean value, such as \fB1\fR
  75. or \fBno\fR.
  76. Defaults to 0.
  77. .TP
  78. \fB\-fill \fIstyle\fR
  79. If a slave's frame is larger than its requested dimensions, this
  80. option may be used to stretch the slave.
  81. \fIStyle\fR must have one of the following values:
  82. .RS
  83. .TP
  84. \fBnone\fR
  85. Give the slave its requested dimensions plus any internal padding
  86. requested with \fB\-ipadx\fR or \fB\-ipady\fR.  This is the default.
  87. .TP
  88. \fBx\fR
  89. Stretch the slave horizontally to fill the entire width of its
  90. frame (except leave external padding as specified by \fB\-padx\fR).
  91. .TP
  92. \fBy\fR
  93. Stretch the slave vertically to fill the entire height of its
  94. frame (except leave external padding as specified by \fB\-pady\fR).
  95. .TP
  96. \fBboth\fR
  97. Stretch the slave both horizontally and vertically.
  98. .RE
  99. .TP
  100. \fB\-in \fIother\fR
  101. Insert the slave(s) at the end of the packing order for the master
  102. window given by \fIother\fR.
  103. .TP
  104. \fB\-ipadx \fIamount\fR
  105. \fIAmount\fR specifies how much horizontal internal padding to
  106. leave on each side of the slave(s).
  107. \fIAmount\fR must be a valid screen distance, such as \fB2\fR or \fB.5c\fR.
  108. It defaults to 0.
  109. .TP
  110. \fB\-ipady \fIamount\fR
  111. \fIAmount\fR specifies how much vertical internal padding to
  112. leave on each side of the slave(s).
  113. \fIAmount\fR  defaults to 0.
  114. .TP
  115. \fB\-padx \fIamount\fR
  116. \fIAmount\fR specifies how much horizontal external padding to
  117. leave on each side of the slave(s).
  118. \fIAmount\fR defaults to 0.
  119. .TP
  120. \fB\-pady \fIamount\fR
  121. \fIAmount\fR specifies how much vertical external padding to
  122. leave on each side of the slave(s).
  123. \fIAmount\fR defaults to 0.
  124. .TP
  125. \fB\-side \fIside\fR
  126. Specifies which side of the master the slave(s) will be packed against.
  127. Must be \fBleft\fR, \fBright\fR, \fBtop\fR, or \fBbottom\fR.
  128. Defaults to \fBtop\fR.
  129. .LP
  130. If no \fB\-in\fR, \fB\-after\fR or \fB\-before\fR option is specified
  131. then each of the slaves will be inserted at the end of the packing list
  132. for its parent unless it is already managed by the packer (in which
  133. case it will be left where it is).
  134. If one of these options is specified then all the slaves will be
  135. inserted at the specified point.
  136. If any of the slaves are already managed by the geometry manager
  137. then any unspecified options for them retain their previous values rather
  138. than receiving default values.
  139. .RE
  140. .TP
  141. \fBpack forget \fIslave \fR?\fIslave ...\fR?
  142. Removes each of the \fIslave\fRs from the packing order for its
  143. master and unmaps their windows.
  144. The slaves will no longer be managed by the packer.
  145. .TP
  146. \fBpack newinfo \fIslave\fR
  147. Returns a list whose elements are the current configuration state of
  148. the slave given by \fIslave\fR in the same option-value form that
  149. might be specified to \fBpack configure\fR.
  150. The first two elements of the list are ``\fB\-in \fImaster\fR'' where
  151. \fImaster\fR is the slave's master.
  152. Starting with Tk 4.0 this option will be renamed "pack info".
  153. .TP
  154. \fBpack propagate \fImaster\fR ?\fIboolean\fR?
  155. If \fIboolean\fR has a true boolean value such as \fB1\fR or \fBon\fR
  156. then propagation is enabled for \fImaster\fR, which must be a window
  157. name (see ``GEOMETRY PROPAGATION'' below).
  158. If \fIboolean\fR has a false boolean value then propagation is
  159. disabled for \fImaster\fR.
  160. In either of these cases an empty string is returned.
  161. If \fIboolean\fR is omitted then the command returns \fB0\fR or
  162. \fB1\fR to indicate whether propagation is currently enabled
  163. for \fImaster\fR.
  164. Propagation is enabled by default.
  165. .TP
  166. \fBpack slaves \fImaster\fR
  167. Returns a list of all of the slaves in the packing order for \fImaster\fR.
  168. The order of the slaves in the list is the same as their order in
  169. the packing order.
  170. If \fImaster\fR has no slaves then an empty string is returned.
  171.  
  172. .SH "THE PACKER ALGORITHM"
  173. .PP
  174. For each master the packer maintains an ordered list of slaves
  175. called the \fIpacking list\fR.
  176. The \fB\-in\fR, \fB\-after\fR, and \fB\-before\fR configuration
  177. options are used to specify the master for each slave and the slave's
  178. position in the packing list.
  179. If none of these options is given for a slave then the slave
  180. is added to the end of the packing list for its parent.
  181. .PP
  182. The packer arranges the slaves for a master by scanning the
  183. packing list in order.
  184. At the time it processes each slave, a rectangular area within
  185. the master is still unallocated.
  186. This area is called the \fIcavity\fR;  for the first slave it
  187. is the entire area of the master.
  188. .PP
  189. For each slave the packer carries out the following steps:
  190. .IP [1]
  191. The packer allocates a rectangular \fIframe\fR for the slave
  192. along the side of the cavity given by the slave's \fB\-side\fR option.
  193. If the side is top or bottom then the width of the frame is
  194. the width of the cavity and its height is the requested height
  195. of the slave plus the \fB\-ipady\fR and \fB\-pady\fR options.
  196. For the left or right side the height of the frame is
  197. the height of the cavity and the width is the requested width
  198. of the slave plus the \fB\-ipadx\fR and \fB\-padx\fR options.
  199. The frame may be enlarged further because of the \fB\-expand\fR
  200. option (see ``EXPANSION'' below)
  201. .IP [2]
  202. The packer chooses the dimensions of the slave.
  203. The width will normally be the slave's requested width plus
  204. twice its \fB\-ipadx\fR option and the height will normally be
  205. the slave's requested height plus twice its \fB\-ipady\fR
  206. option.
  207. However, if the \fB\-fill\fR option is \fBx\fR or \fBboth\fR
  208. then the width of the slave is expanded to fill the width of the frame,
  209. minus twice the \fB\-padx\fR option.
  210. If the \fB\-fill\fR option is \fBy\fR or \fBboth\fR
  211. then the height of the slave is expanded to fill the width of the frame,
  212. minus twice the \fB\-pady\fR option.
  213. .IP [3]
  214. The packer positions the slave over its frame.
  215. If the slave is smaller than the frame then the \fB\-anchor\fR
  216. option determines where in the frame the slave will be placed.
  217. If \fB\-padx\fR or \fB\-pady\fR is non-zero, then the given
  218. amount of external padding will always be left between the
  219. slave and the edges of the frame.
  220. .PP
  221. Once a given slave has been packed, the area of its frame
  222. is subtracted from the cavity, leaving a smaller rectangular
  223. cavity for the next slave.
  224. If a slave doesn't use all of its frame, the unused space
  225. in the frame will not be used by subsequent slaves.
  226. If the cavity should become too small to meet the needs of
  227. a slave then the slave will be given whatever space is
  228. left in the cavity.
  229. If the cavity shrinks to zero size, then all remaining slaves
  230. on the packing list will be unmapped from the screen until
  231. the master window becomes large enough to hold them again.
  232.  
  233. .SH "EXPANSION"
  234. .PP
  235. If a master window is so large that there will be extra space
  236. left over after all of its slaves have been packed, then the
  237. extra space is distributed uniformly among all of the slaves
  238. for which the \fB\-expand\fR option is set.
  239. Extra horizontal space is distributed among the expandable
  240. slaves whose \fB\-side\fR is \fBleft\fR or \fBright\fR,
  241. and extra vertical space is distributed among the expandable
  242. slaves whose \fB\-side\fR is \fBtop\fR or \fBbottom\fR.
  243.  
  244. .SH "GEOMETRY PROPAGATION"
  245. .PP
  246. The packer normally computes how large a master must be to
  247. just exactly meet the needs of its slaves, and it sets the
  248. requested width and height of the master to these dimensions.
  249. This causes geometry information to propagate up through a
  250. window hierarchy to a top-level window so that the entire
  251. sub-tree sizes itself to fit the needs of the leaf windows.
  252. However, the \fBpack propagate\fR command may be used to
  253. turn off propagation for one or more masters.
  254. If propagation is disabled then the packer will not set
  255. the requested width and height of the packer.
  256. This may be useful if, for example, you wish for a master
  257. window to have a fixed size that you specify.
  258.  
  259. .SH "RESTRICTIONS ON MASTER WINDOWS"
  260. .PP
  261. The master for each slave must either be the slave's parent
  262. (the default) or a descendant of the slave's parent.
  263. This restriction is necessary to guarantee that the
  264. slave can be placed over any part of its master that is
  265. visible without danger of the slave being clipped by its parent.
  266.  
  267. .SH KEYWORDS
  268. frame, geometry manager, location, packer, propagation, size
  269.