NAME
Viewport widget − scrollable viewing area widget.
SYNOPSIS
Public Headers:<X11/StringDefs.h> <X11/Xaw/Viewport.h>
Private Header:<X11/Xaw/ViewportP.h>
Class Name:Viewport
Class Pointer:viewportWidgetClass
Instantiation:widget = XtCreateWidget(name, viewportWidgetClass, ...)
CLASS HIERARCHY
Core → Constraint → Form → Viewport
DESCRIPTION
The Viewport widget consists of a frame window, one or two Scrollbars, and an inner window (usually containing a child widget). The size of the frame window is determined by the viewing size of the data that is to be displayed and the dimensions to which the Viewport is created. The inner window is the full size of the data that is to be displayed and is clipped by the frame window. The Viewport widget controls the scrolling of the data directly. No application callbacks are required for scrolling.
When the geometry of the frame window is equal in size to the inner window, or when the data does not require scrolling, the Viewport widget automatically removes any scroll bars. The forceBars option causes the Viewport widget to display any scroll bar permanently.
RESOURCES
When creating a Viewport widget instance, the following resources are retrieved from the argument list or from the resource database:
| Name (XtN...) | Type | Default | Description | |||
| XtNaccelerators | Accelerator- Table |
NULL | List of event-to-action bindings to be executed by this widget, even though the event occurred in another widget. | |||
| XtNancestor− Sensitive |
Boolean | True | (D) Sensitivity state of the ancestors of this widget: a widget is insensitive if either it or any of its ancestors is insensitive. | |||
| XtNallowHoriz | Boolean | FALSE | Flag to allow horizontal scroll bars. | |||
| XtNallowVert | Boolean | FALSE | Flag to allow vertical scroll bars. | |||
| XtNbackground | Pixel | XtDefault− Background |
Window background color. | |||
| XtNbackground− Pixmap |
Pixmap | XtUnspecified− Pixmap |
Window background pixmap. | |||
| XtNborderColor | Pixel | XtDefault− Foreground |
Window border color. | |||
| XtNborderPixmap | Pixmap | XtUnspecified− Pixmap |
Window border pixmap. | |||
| XtNborderWidth | Dimension | 1 | Width of the border in pixels. | |||
| XtNchildren | WidgetList | NULL | (R) List of all current children of this composite widget. | |||
| XtNcolormap | Colormap | Parent’s colormap. | Colormap that this widget will use. | |||
| XtNdepth | int | Parent’s depth. | (C) Depth of this widget’s window. | |||
| XtNdestroy− Callback |
XtCallback- List |
NULL | Callback for XtDestroyWidget(). | |||
| XtNforceBars | Boolean | FALSE | Flag to force display of scroll bars. | |||
| XtNheight | Dimension | Height of child. | Height of the widget. | |||
| XtNmappedWhen− Managed |
Boolean | TRUE | Whether XtMapWidget() is automatic. | |||
| XtNnumChildren | Cardinal | 0 | (R) Number of children in this composite widget. | |||
| (R5) XtNreport- Callback |
XtCallback- List |
NULL | Called when viewed area changes. | |||
| XtNscreen | Screen | Parent’s screen. | (R) Screen on which this widget is displayed. | |||
| XtNsensitive | Boolean | TRUE | Whether widget should receive input. | |||
| XtNtranslations | Translation- Table |
NULL | Event-to-action translations. | |||
| XtNuseBottom | Boolean | FALSE | Flag to indicate bottom/top bars. | |||
| XtNuseRight | Boolean | FALSE | Flag to indicate right/left bars. | |||
| XtNwidth | Dimension | Width of child. | Width of the widget. | |||
| XtNx | Position | 0 | x coordinate in pixels. | |||
| XtNy | Position | 0 | y coordinate in pixels. | |||
The new resource defined by Viewport (not inherited from superclasses) is:
XtNreportCallback
A list of functions to invoke whenever the managed child widget changes size or position. The call_data argument is of type XawPannerReport ∗, shown on the reference page for the Panner widget. New in R5.
The Viewport widget manages a single child widget. When the size of the child is larger than the size of the Viewport, the user can interactively move the child within the Viewport by repositioning the scroll bars.
The default size of the Viewport before it is realized is the width and/or height of the child. After it is realized, the Viewport will allow its child to grow vertically or horizontally if
XtNallowVert or XtNallowHoriz, respectively, were set. If the corresponding vertical or horizontal scrollbar is not enabled, the Viewport will propagate the geometry request to its own parent and the child will be allowed to change size only if the (grand) parent allows it. Regardless of whether or not scrollbars are enabled in the corresponding direction, if the child requests a new size smaller than the Viewport size, the change will be allowed only if the parent of the Viewport allows the Viewport to shrink to the appropriate dimension.
The scrollbar children of the Viewport are named horizontal and vertical. By using these names the programmer can specify resources for the individual scrollbars. XtSetValues() can be used to modify the resources dynamically once the widget ID has been obtained with XtNameToWidget().
Note that although the Viewport is a subclass of the Form, no resources for the Form may be supplied for any of the children of the Viewport. These constraints are managed internally, and are not meant for public consumption.
PUBLIC FUNCTIONS
To insert a child into a Viewport widget, use XtCreateWidget() and specify as the parent the widget ID of the (previously created) Viewport.
•To remove a child from a Viewport widget, use XtUnmanageChild() or XtDestroyWidget() and specify the widget ID of the child.
•To delete the inner window, any children, and the frame window, use XtDestroyWidget() and specify the widget ID of the Viewport widget.
SEE ALSO
Scrollbar.