1<sect1 id="Box_Widget"> 2<title>Box Widget</title> 3<para> 4<!-- .LP --> 5<!-- .XS --> 6<!-- Box Widget --> 7<!-- .XE --> 8<indexterm significance="preferred"><primary>Box widget</primary></indexterm> 9<literallayout class="monospaced"> 10<!-- .TA 2.0i --> 11<!-- .ta 2.0i --> 12<!-- .sp --> 13Application Header file <X11/Xaw/Box.h> 14<indexterm><primary>Box.h</primary></indexterm> 15Class Header file <X11/Xaw/BoxP.h> 16<indexterm><primary>BoxP.h</primary></indexterm> 17Class boxWidgetClass 18<indexterm><primary>boxWidgetClass</primary></indexterm> 19Class Name Box 20<indexterm><primary>Box widget</primary><secondary>class name</secondary></indexterm> 21Superclass Composite 22<!-- .sp --> 23</literallayout> 24</para> 25<para> 26<!-- .LP --> 27The Box widget provides geometry management of arbitrary widgets in a 28box of a specified dimension. The children are rearranged when 29resizing events occur either on the Box or its children, or when 30children are managed or unmanaged. The Box widget always attempts to 31pack its children as tightly as possible within the geometry allowed by 32its parent. 33</para> 34<para> 35<!-- .LP --> 36Box widgets are commonly used to manage a related set of buttons and 37are often called ButtonBox widgets, but the children are not 38limited to buttons. The Box's children are arranged on a background that 39has its own specified dimensions and color. 40</para> 41<sect2 id='Box::Resources'> 42<title>Resources</title> 43<para> 44<!-- .LP --> 45When creating a Box widget instance, the following resources are 46retrieved from the argument list or from the resource database: 47</para> 48<para> 49<!-- .LP --> 50<indexterm><primary>Box widget</primary><secondary>resources</secondary></indexterm> 51<informaltable> 52 <tgroup cols='5' align='center'> 53 <colspec colname='c1'/> 54 <colspec colname='c2'/> 55 <colspec colname='c3'/> 56 <colspec colname='c4'/> 57 <colspec colname='c5'/> 58 <thead> 59 <row> 60 <entry>Name</entry> 61 <entry>Class</entry> 62 <entry>Type</entry> 63 <entry>Notes</entry> 64 <entry>Default Value</entry> 65 </row> 66 </thead> 67 <tbody> 68 <row> 69 <entry>accelerators</entry> 70 <entry>Accelerators</entry> 71 <entry>AcceleratorTable</entry> 72 <entry></entry> 73 <entry>NULL</entry> 74 </row> 75 <row> 76 <entry>ancestorSensitive</entry> 77 <entry>AncestorSensitive</entry> 78 <entry>Boolean</entry> 79 <entry>D</entry> 80 <entry>True</entry> 81 </row> 82 <row> 83 <entry>background</entry> 84 <entry>Background</entry> 85 <entry>Pixel</entry> 86 <entry></entry> 87 <entry>XtDefaultBackground</entry> 88 </row> 89 <row> 90 <entry>backgroundPixmap</entry> 91 <entry>Pixmap</entry> 92 <entry>Pixmap</entry> 93 <entry></entry> 94 <entry>XtUnspecifiedPixmap</entry> 95 </row> 96 <row> 97 <entry>borderColor</entry> 98 <entry>BorderColor</entry> 99 <entry>Pixel</entry> 100 <entry></entry> 101 <entry>XtDefaultForeground</entry> 102 </row> 103 <row> 104 <entry>borderPixmap</entry> 105 <entry>Pixmap</entry> 106 <entry>Pixmap</entry> 107 <entry></entry> 108 <entry>XtUnspecifiedPixmap</entry> 109 </row> 110 <row> 111 <entry>borderWidth</entry> 112 <entry>BorderWidth</entry> 113 <entry>Dimension</entry> 114 <entry></entry> 115 <entry>1</entry> 116 </row> 117 <row> 118 <entry>children</entry> 119 <entry>ReadOnly</entry> 120 <entry>WidgetList</entry> 121 <entry>R</entry> 122 <entry>NULL</entry> 123 </row> 124 <row> 125 <entry>colormap</entry> 126 <entry>Colormap</entry> 127 <entry>Colormap</entry> 128 <entry></entry> 129 <entry>Parent's Colormap</entry> 130 </row> 131 <row> 132 <entry>depth</entry> 133 <entry>Depth</entry> 134 <entry>int</entry> 135 <entry>C</entry> 136 <entry>Parent's Depth</entry> 137 </row> 138 <row> 139 <entry>destroyCallback</entry> 140 <entry>Callback</entry> 141 <entry>XtCallbackList</entry> 142 <entry></entry> 143 <entry>NULL</entry> 144 </row> 145 <row> 146 <entry>height</entry> 147 <entry>Height</entry> 148 <entry>Dimension</entry> 149 <entry>A</entry> 150 <entry>see <function>Layout Semantics</function></entry> 151 </row> 152 <row> 153 <entry>hSpace</entry> 154 <entry>HSpace</entry> 155 <entry>Dimension</entry> 156 <entry></entry> 157 <entry>4</entry> 158 </row> 159 <row> 160 <entry>mappedWhenManaged</entry> 161 <entry>MappedWhenManaged</entry> 162 <entry>Boolean</entry> 163 <entry></entry> 164 <entry>True</entry> 165 </row> 166 <row> 167 <entry>numChildren</entry> 168 <entry>ReadOnly</entry> 169 <entry>Cardinal</entry> 170 <entry>R</entry> 171 <entry>0</entry> 172 </row> 173 <row> 174 <entry>orientation</entry> 175 <entry>Orientation</entry> 176 <entry>Orientation</entry> 177 <entry></entry> 178 <entry>XtorientVertical</entry> 179 </row> 180 <row> 181 <entry>screen</entry> 182 <entry>Screen</entry> 183 <entry>Screen</entry> 184 <entry>R</entry> 185 <entry>Parent's Screen</entry> 186 </row> 187 <row> 188 <entry>sensitive</entry> 189 <entry>Sensitive</entry> 190 <entry>Boolean</entry> 191 <entry></entry> 192 <entry>True</entry> 193 </row> 194 <row> 195 <entry>vSpace</entry> 196 <entry>VSpace</entry> 197 <entry>Dimension</entry> 198 <entry></entry> 199 <entry>4</entry> 200 </row> 201 <row> 202 <entry>translations</entry> 203 <entry>Translations</entry> 204 <entry>TranslationTable</entry> 205 <entry></entry> 206 <entry>NULL</entry> 207 </row> 208 <row> 209 <entry>width</entry> 210 <entry>Width</entry> 211 <entry>Dimension</entry> 212 <entry>A</entry> 213 <entry>see <function>Layout Semantics</function></entry> 214 </row> 215 <row> 216 <entry>x</entry> 217 <entry>Position</entry> 218 <entry>Position</entry> 219 <entry></entry> 220 <entry>0</entry> 221 </row> 222 <row> 223 <entry>y</entry> 224 <entry>Position</entry> 225 <entry>Position</entry> 226 <entry></entry> 227 <entry>0</entry> 228 </row> 229 <row> 230 <entry>_</entry> 231 </row> 232 </tbody> 233 </tgroup> 234</informaltable> 235<!-- .Ac --> 236<!-- .As --> 237<!-- .Bg --> 238<!-- .Gp --> 239<!-- .Bc --> 240<!-- .Bp --> 241<!-- .Bw --> 242<!-- .Ch --> 243<!-- .Cm --> 244<!-- .Dp --> 245<!-- .Dc --> 246<!-- .Hw --> 247<variablelist> 248 <varlistentry> 249 <term> 250 <function>hSpace</function> 251 </term> 252 <listitem> 253 <para> 254<!-- .br --> 255<!-- .ns --> 256 </para> 257 </listitem> 258 </varlistentry> 259 <varlistentry> 260 <term> 261 <function>vSpace</function> 262 </term> 263 <listitem> 264 <para> 265The amount of space, in pixels, to leave between the children. This 266resource specifies the amount of space left between the outermost 267children and the edge of the box. 268<!-- .Mm --> 269<!-- .Nc --> 270 </para> 271 </listitem> 272 </varlistentry> 273 <varlistentry> 274 <term> 275 <function>orientation</function> 276 </term> 277 <listitem> 278 <para> 279Specifies whether the preferred shape of the box (i.e. the result 280returned by the query_geometry class method) is tall and narrow 281<function>XtorientVertical</function> or short and wide <function>XtorientHorizontal</function>. 282<indexterm><primary>XtorientVertical</primary></indexterm> 283<indexterm><primary>XtorientHorizontal</primary></indexterm> 284<indexterm><primary>conversions</primary><secondary>Orientation</secondary></indexterm> 285When the Box is a child of a parent which enforces width constraints, it 286is usually better to specify <function>XtorientVertical</function> (the default). 287When the parent enforces height constraints, it is usually better to 288specify <function>XtorientHorizontal</function>. 289<!-- .Rs "horizontal \fPand\fB vertical" --> 290<!-- .Sc --> 291<!-- .Se --> 292<!-- .Tr --> 293<!-- .Xy --> 294 </para> 295 </listitem> 296 </varlistentry> 297</variablelist> 298</para> 299</sect2> 300<sect2 id="Layout_Semantics"> 301<title>Layout Semantics</title> 302<indexterm><primary>Box widget</primary><secondary>layout semantics</secondary></indexterm> 303<para> 304<!-- .LP --> 305Each time a child is managed or unmanaged, the Box widget will attempt 306to reposition the remaining children to compact the box. Children are 307positioned in order left to right, top to bottom. The packing 308algorithm used depends on the <function>orientation</function> of the Box. 309<variablelist> 310 <varlistentry> 311 <term> 312 <function>XtorientVertical</function> 313 </term> 314 <listitem> 315 <para> 316<indexterm significance="preferred"><primary>XtorientVertical</primary></indexterm> 317When the next child does not fit on the current row, a new row is 318started. If a child is wider than the width of the box, the box will 319request a larger width from its parent and will begin the layout 320process from the beginning if a new width is granted. 321 </para> 322 </listitem> 323 </varlistentry> 324 <varlistentry> 325 <term> 326 <function>XtorientHorizontal</function> 327 </term> 328 <listitem> 329 <para> 330<indexterm significance="preferred"><primary>XtorientHorizontal</primary></indexterm> 331When the next child does not fit on the current row, the Box widens if 332possible (so as to keep children on a single row); otherwise a new row is 333started. 334 </para> 335 </listitem> 336 </varlistentry> 337</variablelist> 338</para> 339<para> 340<!-- .LP --> 341After positioning all children, the Box widget attempts to shrink its 342own size to the minimum dimensions required for the layout. 343 344</para> 345</sect2> 346</sect1> 347