#ifndef lint
#endif /* lint */
/***********************************************************
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <./Xaw3_1XawInit.h>
#include <./Xaw3_1Scrollbar.h>
#include <./Xaw3_1ViewportP.h>
static void ScrollUpDownProc(), ThumbProc();
static Boolean GetGeometry();
};
static void Initialize(), ConstraintInitialize(),
{ /* core_class fields */
/* class_name */ "Viewport",
/* widget_size */ sizeof(ViewportRec),
/* class_initialize */ XawInitializeWidgetSet,
/* class_part_init */ NULL,
/* class_inited */ FALSE,
/* initialize */ Initialize,
/* initialize_hook */ NULL,
/* realize */ Realize,
/* actions */ NULL,
/* num_actions */ 0,
/* resources */ resources,
/* xrm_class */ NULLQUARK,
/* compress_motion */ TRUE,
/* compress_exposure */ TRUE,
/* compress_enterleave*/ TRUE,
/* visible_interest */ FALSE,
/* destroy */ NULL,
/* resize */ Resize,
/* expose */ XtInheritExpose,
/* set_values */ SetValues,
/* set_values_hook */ NULL,
/* set_values_almost */ XtInheritSetValuesAlmost,
/* get_values_hook */ NULL,
/* accept_focus */ NULL,
/* version */ XtVersion,
/* callback_private */ NULL,
/* tm_table */ NULL,
/* query_geometry */ PreferredGeometry,
/* display_accelerator*/ XtInheritDisplayAccelerator,
/* extension */ NULL
},
{ /* composite_class fields */
/* geometry_manager */ GeometryManager,
/* change_managed */ ChangeManaged,
/* insert_child */ XtInheritInsertChild,
/* delete_child */ XtInheritDeleteChild,
/* extension */ NULL
},
{ /* constraint_class fields */
/* subresourses */ NULL,
/* subresource_count */ 0,
/* constraint_size */ sizeof(ViewportConstraintsRec),
/* initialize */ ConstraintInitialize,
/* destroy */ NULL,
/* set_values */ NULL,
/* extension */ NULL
},
{ /* form_class fields */
/* layout */ Layout
},
{ /* viewport_class fields */
/* empty */ 0
}
};
{
{XtNorientation, NULL},
};
if (horizontal) {
}
else {
}
XtManageChild( bar );
return bar;
}
/* ARGSUSED */
{
/*
* Initialize all widget pointers to NULL.
*/
/*
* Create Clip Widget.
*/
num_args = 0;
return; /* If we are not forcing the bars then we are done. */
if (w->viewport.allowhoriz)
(void) CreateScrollbar(w, True);
(void) CreateScrollbar(w, False);
/*
* Set the clip widget to the correct height.
*/
num_args = 0;
}
/* ARGSUSED */
{
}
{
*value_mask |= CWBitGravity;
XtRealizeWidget( clip );
XtRealizeWidget( child );
XtMapWidget( child );
}
}
/* ARGSUSED */
{
(void) CreateScrollbar( w, True );
(void) CreateScrollbar( w, False );
}
}
/* take care of bars, &tc. */
return False;
}
{
register int i;
if (XtIsManaged(*childP)
{
break;
}
}
if (XtIsRealized(widget)) {
if (!XtIsRealized(child)) {
#ifdef notdef
/* this is dirty, but it saves the following code: */
XtRealizeWidget( child );
XtMapWidget( child );
#else
XtRealizeWidget( child );
#endif /* notdef */
}
XtMapWidget( child );
}
}
/* %%% do we need to hide this child from Form? */
}
}
#ifdef notdef
#endif
}
Widget w;
{
}
static void RedrawThumbs(w)
{
}
static void MoveChild(w, x, y)
Position x, y;
{
if (x >= 0) x = 0;
if (y >= 0) y = 0;
XtMoveWidget(child, x, y);
RedrawThumbs(w);
}
{
static void ComputeWithForceBars();
intended.border_width = 0;
&clip_width, &clip_height);
}
else {
/*
* intended.{width,height} caches the eventual child dimensions,
* but we don't set the mode bits until after we decide that the
* child's preferences are not acceptable.
*/
if (!w->viewport.allowhoriz)
else
else
if (!query) {
}
do { /* while intended != prev */
if (query) {
}
/*
* note that having once decided to turn on either bar
* we'll not change our mind until we're next resized,
* thus avoiding potential oscillations.
*/
#define CheckHoriz() \
if (!needshoriz) { \
needshoriz = True; \
} \
}
/*enddef*/
CheckHoriz();
if (!needsvert) {
CheckHoriz();
}
}
}
}
}
if (XtIsRealized(clip))
if (!needshoriz) {
if (destroy_scrollbars) {
XtDestroyWidget( bar );
}
}
else {
: -bw),
: -bw) );
}
}
if (!needsvert) {
if (destroy_scrollbars) {
XtDestroyWidget( bar );
}
}
else {
: -bw),
: -bw) );
}
}
MoveChild(w,
}
}
/* Function Name: ComputeWithForceBars
* Description: Computes the layout give forcebars is set.
* Arguments: widget - the viewport widget.
* query - whether or not to query the child.
* intended - the cache of the childs height is
* stored here ( USED AND RETURNED ).
* clip_width, clip_height - size of clip window.
* (USED AND RETURNED ).
* Returns: none.
*/
static void
int *clip_width, *clip_height;
{
/*
* If forcebars then needs = allows = has.
* Thus if needsvert is set it MUST have a scrollbar.
*/
if (w->viewport.allowhoriz)
}
if (!w->viewport.allowhoriz) {
}
if ( query ) {
else
else
}
}
else {
if (w->viewport.allowhoriz)
}
}
{
}
/* ARGSUSED */
FormWidget w;
{
return False;
}
{
Position x, y;
MoveChild(w, x, y);
}
/* ARGSUSED */
float *percent;
{
Position x, y;
#else /* else not macII */
#endif /* macII */
else
#else /* else not macII */
#endif /* macII */
else
MoveChild(w, x, y);
}
{
&& request->border_width > 0))
return XtGeometryNo;
);
/* horizontal scrollbar will be needed so possibly reduce height */
reconfigured = True;
}
else {
}
}
/* vertical scrollbar will be needed, so possibly reduce width */
if (!rWidth) {
}
else
reconfigured = True;
}
}
else {
}
}
}
else {
}
if (reconfigured)
ComputeLayout( (Widget)w,
/*query=*/ False,
return result;
}
Widget w;
{
return False;
if (XtIsRealized(w)) {
} else {
/* This is the Realize call; we'll inherit a w&h iff none currently */
}
}
== XtGeometryAlmost)
return (result == XtGeometryYes);
}
Widget w;
{
constraints, reply );
else
return XtGeometryYes;
}