3b3703639988ba0e2f371c92c099f0a39712a9a7
[framework/uifw/xorg/lib/libxaw.git] / specs / Viewport.xml
1 <sect1 id="Viewport_Widget">
2 <title>Viewport Widget</title>
3 <para>
4 <!-- .LP -->
5 <!-- .XS -->
6 <!--    Viewport Widget -->
7 <!-- .XE -->
8 <!-- .IN "Viewport widget" "" "@DEF@" -->
9 <literallayout class="monospaced">
10 <!-- .TA 2.0i -->
11 <!-- .ta 2.0i -->
12 <!-- .sp -->
13 Application Header file &lt;X11/Xaw/Viewport.h&gt;
14 <!-- .IN "Viewport.h" "" -->
15 Class Header file       &lt;X11/Xaw/ViewportP.h&gt;
16 <!-- .IN "ViewportP.h" "" -->
17 Class           viewportWidgetClass
18 <!-- .IN "viewportWidgetClass" "" -->
19 Class Name      Viewport
20 <!-- .IN "Viewport widget" "class name" -->
21 Superclass      Form
22 <!-- .sp -->
23 </literallayout>
24 </para>
25 <para>
26 <!-- .LP -->
27 The Viewport widget consists of a frame window, one or two Scrollbars,
28 and an inner window.  The size of the frame window is determined by the
29 viewing size of the data that is to be displayed and the dimensions to
30 which the Viewport is created.  The inner window is the full size of the
31 data that is to be displayed and is clipped by the frame window.  The
32 Viewport widget controls the scrolling of the data directly.  No
33 application callbacks are required for scrolling.
34 </para>
35 <para>
36 <!-- .LP -->
37 When the geometry of the frame window is equal in size to the inner
38 window, or when the data does not require scrolling, the Viewport widget
39 automatically removes any scrollbars.  The <function>forceBars</function> option causes
40 the Viewport widget to display all scrollbars permanently.
41 </para>
42 <sect2 id="viewport_resources">
43 <title>Resources</title>
44 <para>
45 <!-- .LP -->
46 When creating a Viewport widget instance, the following resources are
47 retrieved from the argument list or the resource database:
48 </para>
49 <para>
50 <!-- .LP -->
51 <!-- .IN "Viewport widget" "resources" -->
52 <informaltable>
53   <tgroup cols='5' align='center'>
54   <colspec colname='c1'/>
55   <colspec colname='c2'/>
56   <colspec colname='c3'/>
57   <colspec colname='c4'/>
58   <colspec colname='c5'/>
59   <thead>
60     <row>
61       <entry>Name</entry>
62       <entry>Class</entry>
63       <entry>Type</entry>
64       <entry>Notes</entry>
65       <entry>Default Value</entry>
66     </row>
67   </thead>
68   <tbody>
69     <row>
70       <entry>accelerators</entry>
71       <entry>Accelerators</entry>
72       <entry>AcceleratorTable</entry>
73       <entry></entry>
74       <entry>NULL</entry>
75     </row>
76     <row>
77       <entry>allowHoriz</entry>
78       <entry>Boolean</entry>
79       <entry>Boolean</entry>
80       <entry></entry>
81       <entry>False</entry>
82     </row>
83     <row>
84       <entry>allowVert</entry>
85       <entry>Boolean</entry>
86       <entry>Boolean</entry>
87       <entry></entry>
88       <entry>False</entry>
89     </row>
90     <row>
91       <entry>ancestorSensitive</entry>
92       <entry>AncestorSensitive</entry>
93       <entry>Boolean</entry>
94       <entry>D</entry>
95       <entry>True</entry>
96     </row>
97     <row>
98       <entry>background</entry>
99       <entry>Background</entry>
100       <entry>Pixel</entry>
101       <entry></entry>
102       <entry>XtDefaultBackground</entry>
103     </row>
104     <row>
105       <entry>backgroundPixmap</entry>
106       <entry>Pixmap</entry>
107       <entry>Pixmap</entry>
108       <entry></entry>
109       <entry>XtUnspecifiedPixmap</entry>
110     </row>
111     <row>
112       <entry>borderColor</entry>
113       <entry>BorderColor</entry>
114       <entry>Pixel</entry>
115       <entry></entry>
116       <entry>XtDefaultForeground</entry>
117     </row>
118     <row>
119       <entry>borderPixmap</entry>
120       <entry>Pixmap</entry>
121       <entry>Pixmap</entry>
122       <entry></entry>
123       <entry>XtUnspecifiedPixmap</entry>
124     </row>
125     <row>
126       <entry>borderWidth</entry>
127       <entry>BorderWidth</entry>
128       <entry>Dimension</entry>
129       <entry></entry>
130       <entry>1</entry>
131     </row>
132     <row>
133       <entry>children</entry>
134       <entry>ReadOnly</entry>
135       <entry>WidgetList</entry>
136       <entry>R</entry>
137       <entry>NULL</entry>
138     </row>
139     <row>
140       <entry>colormap</entry>
141       <entry>Colormap</entry>
142       <entry>Colormap</entry>
143       <entry></entry>
144       <entry>Parent's Colormap</entry>
145     </row>
146     <row>
147       <entry>depth</entry>
148       <entry>Depth</entry>
149       <entry>int</entry>
150       <entry>C</entry>
151       <entry>Parent's Depth</entry>
152     </row>
153     <row>
154       <entry>destroyCallback</entry>
155       <entry>Callback</entry>
156       <entry>XtCallbackList</entry>
157       <entry></entry>
158       <entry>NULL</entry>
159     </row>
160     <row>
161       <entry>forceBars</entry>
162       <entry>Boolean</entry>
163       <entry>Boolean</entry>
164       <entry></entry>
165       <entry>False</entry>
166     </row>
167     <row>
168       <entry>height</entry>
169       <entry>Height</entry>
170       <entry>Dimension</entry>
171       <entry></entry>
172       <entry>height of the child</entry>
173     </row>
174     <row>
175       <entry>mappedWhenManaged</entry>
176       <entry>MappedWhenManaged</entry>
177       <entry>Boolean</entry>
178       <entry></entry>
179       <entry>True</entry>
180     </row>
181     <row>
182       <entry>numChildren</entry>
183       <entry>ReadOnly</entry>
184       <entry>Cardinal</entry>
185       <entry>R</entry>
186       <entry>0</entry>
187     </row>
188     <row>
189       <entry>reportCallback</entry>
190       <entry>ReportCallback</entry>
191       <entry>XtCallbackList</entry>
192       <entry></entry>
193       <entry>NULL</entry>
194     </row>
195     <row>
196       <entry>screen</entry>
197       <entry>Screen</entry>
198       <entry>Screen</entry>
199       <entry>R</entry>
200       <entry>Parent's Screen</entry>
201     </row>
202     <row>
203       <entry>sensitive</entry>
204       <entry>Sensitive</entry>
205       <entry>Boolean</entry>
206       <entry></entry>
207       <entry>True</entry>
208     </row>
209     <row>
210       <entry>translations</entry>
211       <entry>Translations</entry>
212       <entry>TranslationTable</entry>
213       <entry></entry>
214       <entry>NULL</entry>
215     </row>
216     <row>
217       <entry>useBottom</entry>
218       <entry>Boolean</entry>
219       <entry>Boolean</entry>
220       <entry></entry>
221       <entry>False</entry>
222     </row>
223     <row>
224       <entry>useRight</entry>
225       <entry>Boolean</entry>
226       <entry>Boolean</entry>
227       <entry></entry>
228       <entry>False</entry>
229     </row>
230     <row>
231       <entry>width</entry>
232       <entry>Width</entry>
233       <entry>Dimension</entry>
234       <entry></entry>
235       <entry>width of the child</entry>
236     </row>
237     <row>
238       <entry>x</entry>
239       <entry>Position</entry>
240       <entry>Position</entry>
241       <entry></entry>
242       <entry>0</entry>
243     </row>
244     <row>
245       <entry>y</entry>
246       <entry>Position</entry>
247       <entry>Position</entry>
248       <entry></entry>
249       <entry>0</entry>
250     </row>
251     <row>
252       <entry>_</entry>
253     </row>
254   </tbody>
255   </tgroup>
256 </informaltable>
257 <!-- .Ac -->
258 <variablelist>
259   <varlistentry>
260     <term>
261       <function>allowHoriz</function>
262     </term>
263     <listitem>
264       <para>
265 <!-- .br -->
266 <!-- .ns -->
267       </para>
268     </listitem>
269   </varlistentry>
270   <varlistentry>
271     <term>
272       <function>allowVert</function>
273     </term>
274     <listitem>
275       <para>
276 If these resources are <function>False</function> then the Viewport will never create
277 a scrollbar in this direction.  If it is <function>True</function> then the scrollbar will
278 only appear when it is needed, unless <function>forceBars</function> is <function>True</function>.
279 <!-- .As -->
280 <!-- .Bg -->
281 <!-- .Gp -->
282 <!-- .Bc -->
283 <!-- .Bp -->
284 <!-- .Bw -->
285 <!-- .Ch -->
286 <!-- .Cm -->
287 <!-- .Dp -->
288 <!-- .Dc -->
289       </para>
290     </listitem>
291   </varlistentry>
292   <varlistentry>
293     <term>
294       <function>forceBars</function>
295     </term>
296     <listitem>
297       <para>
298 When <function>True</function> the scrollbars that have been <emphasis remap='I'>allowed</emphasis> will always be
299 visible on the screen.  If <function>False</function> the scrollbars will be visible only
300 when the inner window is larger than the frame.
301 <!-- .Hw -->
302 <!-- .Mm -->
303 <!-- .Nc -->
304       </para>
305     </listitem>
306   </varlistentry>
307   <varlistentry>
308     <term>
309       <function>reportCallback</function>
310     </term>
311     <listitem>
312       <para>
313 These callbacks will be executed whenever the Viewport adjusts the viewed
314 area of the child.  The call_data parameter is a pointer to an XawPannerReport
315 structure.
316 <!-- .Sc -->
317 <!-- .Se -->
318 <!-- .Tr -->
319       </para>
320     </listitem>
321   </varlistentry>
322   <varlistentry>
323     <term>
324       <function>useBottom</function>
325     </term>
326     <listitem>
327       <para>
328 <!-- .br -->
329 <!-- .ns -->
330       </para>
331     </listitem>
332   </varlistentry>
333   <varlistentry>
334     <term>
335       <function>useRight</function>
336     </term>
337     <listitem>
338       <para>
339 By default the scrollbars appear on the left and top of the screen.
340 These resources allow the vertical scrollbar to be placed on the right
341 edge of the Viewport, and the horizontal scrollbar on the bottom edge of
342 the Viewport.
343 <!-- .Xy -->
344     </para>
345   </listitem>
346   </varlistentry>
347 </variablelist>
348 </para>
349 </sect2>
350 <sect2 id="viewport_layout_semantics">
351 <title>Layout Semantics</title>
352 <para>
353 <!-- .LP -->
354 <!-- .IN "Viewport widget" "layout semantics" -->
355 The Viewport widget manages a single child widget.  When the size of the
356 child is larger than the size of the Viewport, the user can interactively
357 move the child within the Viewport by repositioning the scrollbars.
358 </para>
359 <para>
360 <!-- .LP -->
361 The default size of the Viewport before it is realized is the width and/or
362 height of the child.  After it is realized, the Viewport will allow its
363 child to grow vertically or horizontally if <function>allowVert</function> or
364 <function>allowHoriz</function> are set, respectively.  If the corresponding vertical
365 or horizontal scrollbar is not enabled, the Viewport will propagate the
366 geometry request to its own parent and the child will be allowed to change
367 size only if the Viewport's parent allows it.  Regardless of whether or not
368 scrollbars are enabled in the corresponding direction, if the child requests
369 a new size smaller than the Viewport size, the change will be allowed only
370 if the parent of the Viewport allows the Viewport to shrink to the
371 appropriate dimension.
372 </para>
373 <para>
374 <!-- .LP -->
375 The scrollbar children of the Viewport are named <function>horizontal</function> and
376 <function>vertical</function>.  By using these names the programmer can specify resources
377 for the individual scrollbars.  <function>XtSetValues</function> can be used to modify
378 the resources dynamically once the widget ID has been obtained with
379 <function>XtNameToWidget</function>.
380 <!-- .IN "XtNameToWidget" "" -->
381 <!-- .NT -->
382 </para>
383 <note><para>
384 Although the Viewport is a Subclass of the Form, no resources for the Form
385 may be supplied for any of the children of the Viewport.  These constraints
386 are managed internally and are not meant for public consumption.
387 </para></note>
388 <!-- .NE -->
389
390 </sect2>
391 </sect1>