home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
x
/
volume13
/
xdtm
/
part02
< prev
next >
Wrap
Internet Message Format
|
1991-05-18
|
30KB
Path: uunet!cs.utexas.edu!sun-barr!newstop!exodus!cogs.sussex.ac.uk
From: eddyg@cogs.sussex.ac.uk (EdwardJ. Groenendaal)
Newsgroups: comp.sources.x
Subject: v13i007: xdtm - X Desktop Manager for the X Window System, Part02/11
Message-ID: <13571@exodus.Eng.Sun.COM>
Date: 19 May 91 00:02:46 GMT
References: <csx-13i006:xdtm@uunet.UU.NET>
Sender: news@exodus.Eng.Sun.COM
Lines: 829
Approved: argv@sun.com
Submitted-by: Edward "J." Groenendaal <eddyg@cogs.sussex.ac.uk>
Posting-number: Volume 13, Issue 7
Archive-name: xdtm/part02
Submitted-by: eddyg@cste
Archive-name: xdtm/part02
---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is part 02 of xdtm
# ============= xdtm/Xedw/XedwForm.c ==============
if test ! -d 'xdtm'; then
echo 'x - creating directory xdtm'
mkdir 'xdtm'
fi
if test ! -d 'xdtm/Xedw'; then
echo 'x - creating directory xdtm/Xedw'
mkdir 'xdtm/Xedw'
fi
if test -f 'xdtm/Xedw/XedwForm.c' -a X"$1" != X"-c"; then
echo 'x - skipping xdtm/Xedw/XedwForm.c (File already exists)'
else
echo 'x - extracting xdtm/Xedw/XedwForm.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xdtm/Xedw/XedwForm.c' &&
X#include <X11/copyright.h>
X
X/*****************************************************************************
X * XedwForm is a modified version of the Athena Widget Form.
X * Added capabilities :
X * 1) Children may chose not to be resized in any particular plane.
X * 2) Children may chose to extend their widths to the edge of the application.
X * 3) Children may have linked widths and heights.
X * The default is that these capabilities are turned off.
X * See XedwForm.h for resource list.
X *
X * Edward Groenendaal, 20th Feb 1991.
X *
X * Changes to the original source :
X * 1) Changed all references of Form to XedwForm and form to xedwForm.
X * 2) Added resources
X * 3) Rewrote Resize(), Layout() and LayoutChild().
X *****************************************************************************/
X
X#include <X11/IntrinsicP.h>
X#include <X11/StringDefs.h>
X#include <X11/Xmu/Converters.h>
X#include <X11/Xmu/CharSet.h>
X#include <X11/Xaw/XawInit.h>
X#include "XedwFormP.h"
X
X/* Private Definitions */
X
Xstatic int default_value = -99999;
X
X#define Offset(field) XtOffset(XedwFormWidget, xedwForm.field)
Xstatic XtResource resources[] = {
X {XtNdefaultDistance, XtCThickness, XtRInt, sizeof(int),
X Offset(default_spacing), XtRImmediate, (caddr_t)4}
X};
X#undef Offset
X
Xstatic XtEdgeType defEdge = XtRubber;
X
X#define Offset(field) XtOffset(XedwFormConstraints, xedwForm.field)
Xstatic XtResource xedwFormConstraintResources[] = {
X {XtNtop, XtCEdge, XtREdgeType, sizeof(XtEdgeType),
X Offset(top), XtREdgeType, (XtPointer)&defEdge},
X {XtNbottom, XtCEdge, XtREdgeType, sizeof(XtEdgeType),
X Offset(bottom), XtREdgeType, (XtPointer)&defEdge},
X {XtNleft, XtCEdge, XtREdgeType, sizeof(XtEdgeType),
X Offset(left), XtREdgeType, (XtPointer)&defEdge},
X {XtNright, XtCEdge, XtREdgeType, sizeof(XtEdgeType),
X Offset(right), XtREdgeType, (XtPointer)&defEdge},
X {XtNhorizDistance, XtCThickness, XtRInt, sizeof(int),
X Offset(dx), XtRInt, (XtPointer) &default_value},
X {XtNfromHoriz, XtCWidget, XtRWidget, sizeof(Widget),
X Offset(horiz_base), XtRWidget, (XtPointer)NULL},
X {XtNvertDistance, XtCThickness, XtRInt, sizeof(int),
X Offset(dy), XtRInt, (XtPointer) &default_value},
X {XtNfromVert, XtCWidget, XtRWidget, sizeof(Widget),
X Offset(vert_base), XtRWidget, (XtPointer)NULL},
X {XtNrubberWidth, XtCBoolean, XtRBoolean, sizeof(Boolean), /* new */
X Offset(rubber_width), XtRImmediate, (XtPointer) True},
X {XtNrubberHeight, XtCBoolean, XtRBoolean, sizeof(Boolean), /* new */
X Offset(rubber_height), XtRImmediate, (XtPointer) True},
X {XtNfullWidth, XtCBoolean, XtRBoolean, sizeof(Boolean), /* new */
X Offset(full_width), XtRImmediate, (XtPointer) False},
X {XtNfullHeight, XtCBoolean, XtRBoolean, sizeof(Boolean), /* new */
X Offset(full_height), XtRImmediate, (XtPointer) False},
X {XtNwidthLinked, XtCWidget, XtRWidget, sizeof(Widget),
X Offset(width_link), XtRWidget, (XtPointer)NULL}, /* new */
X {XtNheightLinked, XtCWidget, XtRWidget, sizeof(Widget),
X Offset(height_link), XtRWidget, (XtPointer)NULL}, /* new */
X {XtNresizable, XtCBoolean, XtRBoolean, sizeof(Boolean),
X Offset(allow_resize), XtRImmediate, (XtPointer) FALSE},
X};
X#undef Offset
X
Xstatic void ClassInitialize(), ClassPartInitialize(), Initialize(), Resize();
Xstatic void ConstraintInitialize();
Xstatic Boolean SetValues(), ConstraintSetValues();
Xstatic XtGeometryResult GeometryManager(), PreferredGeometry();
Xstatic void ChangeManaged();
Xstatic Boolean Layout(XedwFormWidget, Dimension, Dimension);
X
XXedwFormClassRec xedwFormClassRec = {
X { /* core_class fields */
X /* superclass */ (WidgetClass) &constraintClassRec,
X /* class_name */ "XedwForm",
X /* widget_size */ sizeof(XedwFormRec),
X /* class_initialize */ ClassInitialize,
X /* class_part_init */ ClassPartInitialize,
X /* class_inited */ FALSE,
X /* initialize */ Initialize,
X /* initialize_hook */ NULL,
X /* realize */ XtInheritRealize,
X /* actions */ NULL,
X /* num_actions */ 0,
X /* resources */ resources,
X /* num_resources */ XtNumber(resources),
X /* xrm_class */ NULLQUARK,
X /* compress_motion */ TRUE,
X /* compress_exposure */ TRUE,
X /* compress_enterleave*/ TRUE,
X /* visible_interest */ FALSE,
X /* destroy */ NULL,
X /* resize */ Resize, /* new */
X /* expose */ XtInheritExpose,
X /* set_values */ SetValues,
X /* set_values_hook */ NULL,
X /* set_values_almost */ XtInheritSetValuesAlmost,
X /* get_values_hook */ NULL,
X /* accept_focus */ NULL,
X /* version */ XtVersion,
X /* callback_private */ NULL,
X /* tm_table */ NULL,
X /* query_geometry */ PreferredGeometry,
X /* display_accelerator*/ XtInheritDisplayAccelerator,
X /* extension */ NULL
X },
X { /* composite_class fields */
X /* geometry_manager */ GeometryManager,
X /* change_managed */ ChangeManaged,
X /* insert_child */ XtInheritInsertChild,
X /* delete_child */ XtInheritDeleteChild,
X /* extension */ NULL
X },
X { /* constraint_class fields */
X /* subresourses */ xedwFormConstraintResources,
X /* subresource_count */ XtNumber(xedwFormConstraintResources),
X /* constraint_size */ sizeof(XedwFormConstraintsRec),
X /* initialize */ ConstraintInitialize,
X /* destroy */ NULL,
X /* set_values */ ConstraintSetValues,
X /* extension */ NULL
X },
X { /* xedwForm_class fields */
X /* layout */ Layout
X }
X};
X
XWidgetClass xedwFormWidgetClass = (WidgetClass)&xedwFormClassRec;
X
X/****************************************************************
X *
X * Private Procedures
X *
X ****************************************************************/
X
X
Xstatic XrmQuark XtQChainLeft, XtQChainRight, XtQChainTop,
X XtQChainBottom, XtQRubber;
X
X#define done(address, type) \
X{ toVal->size = sizeof(type); \
X toVal->addr = (caddr_t) address; \
X return; \
X}
X
Xstatic void _CvtStringToEdgeType(XrmValuePtr args,
X Cardinal *num_args,
X XrmValuePtr fromVal,
X XrmValuePtr toVal)
X{
X static XtEdgeType edgeType;
X XrmQuark q;
X char lowerName[1000];
X
X XmuCopyISOLatin1Lowered (lowerName, (char*)fromVal->addr);
X q = XrmStringToQuark(lowerName);
X if (q == XtQChainLeft) {
X edgeType = XtChainLeft;
X done(&edgeType, XtEdgeType);
X }
X if (q == XtQChainRight) {
X edgeType = XtChainRight;
X done(&edgeType, XtEdgeType);
X }
X if (q == XtQChainTop) {
X edgeType = XtChainTop;
X done(&edgeType, XtEdgeType);
X }
X if (q == XtQChainBottom) {
X edgeType = XtChainBottom;
X done(&edgeType, XtEdgeType);
X }
X if (q == XtQRubber) {
X edgeType = XtRubber;
X done(&edgeType, XtEdgeType);
X }
X XtStringConversionWarning(fromVal->addr, "edgeType");
X toVal->addr = NULL;
X toVal->size = 0;
X}
X
Xstatic void ClassInitialize(void)
X{
X static XtConvertArgRec parentCvtArgs[] = {
X {XtBaseOffset, (caddr_t)XtOffset(Widget, core.parent), sizeof(Widget)}
X };
X XawInitializeWidgetSet();
X XtQChainLeft = XrmStringToQuark("chainleft");
X XtQChainRight = XrmStringToQuark("chainright");
X XtQChainTop = XrmStringToQuark("chaintop");
X XtQChainBottom = XrmStringToQuark("chainbottom");
X XtQRubber = XrmStringToQuark("rubber");
X
X XtAddConverter( XtRString, XtREdgeType, _CvtStringToEdgeType, NULL, 0 );
X XtAddConverter( XtRString, XtRWidget, XmuCvtStringToWidget,
X parentCvtArgs, XtNumber(parentCvtArgs) );
X}
X
Xstatic void ClassPartInitialize(WidgetClass class)
X{
X register XedwFormWidgetClass c = (XedwFormWidgetClass)class;
X
X if (((Boolean (*)())c->xedwForm_class.layout) == XtInheritLayout)
X c->xedwForm_class.layout = Layout;
X}
X
X
Xstatic void Initialize(Widget request, Widget new)
X{
X XedwFormWidget fw = (XedwFormWidget)new;
X
X fw->xedwForm.old_width = fw->core.width;
X fw->xedwForm.old_height = fw->core.height;
X fw->xedwForm.no_refigure = False;
X fw->xedwForm.needs_relayout = False;
X fw->xedwForm.resize_in_layout = True;
X}
X
X
Xstatic void RefigureLocations(XedwFormWidget w)
X{
X if (w->xedwForm.no_refigure) {
X w->xedwForm.needs_relayout = True;
X } else {
X (*((XedwFormWidgetClass)w->core.widget_class)->xedwForm_class.layout)
X ( w, w->core.width, w->core.height );
X w->xedwForm.needs_relayout = False;
X }
X}
X
Xstatic Boolean Layout(XedwFormWidget fw, Dimension width, Dimension height)
X{
X int num_children = fw->composite.num_children;
X WidgetList children = fw->composite.children;
X Widget *childP;
X Position maxx, maxy;
X static void LayoutChild();
X Boolean ret_val;
X
X for (childP = children; childP - children < num_children; childP++) {
X XedwFormConstraints xedwForm =
X (XedwFormConstraints)(*childP)->core.constraints;
X xedwForm->xedwForm.layout_state = LayoutPending;
X }
X
X maxx = maxy = 1;
X for (childP = children; childP - children < num_children; childP++) {
X if (XtIsManaged(*childP)) {
X Position x, y;
X LayoutChild(*childP);
X x = (*childP)->core.x + (*childP)->core.width
X + ((*childP)->core.border_width << 1);
X y = (*childP)->core.y + (*childP)->core.height
X + ((*childP)->core.border_width << 1);
X if (maxx < x) maxx = x; /* Track width */
X if (maxy < y) maxy = y; /* Track Height */
X }
X }
X
X /* I want to be this big */
X fw->xedwForm.preferred_width = (maxx += fw->xedwForm.default_spacing);
X fw->xedwForm.preferred_height = (maxy += fw->xedwForm.default_spacing);
X
X /* Go back and check to see if any widgets want to be full height or
X * full width, if so, do it, dont recalculate sizes, assume the programmer
X * didn't make any silly mistakes like putting another widget to the right
X * of a full width one. EG.
X * Should really do this in one pass.
X */
X
X for (childP = children; childP - children < num_children; childP++) {
X XedwFormConstraints form = (XedwFormConstraints)(*childP)->core.constraints;
X Position newwidth = (Position)(*childP)->core.width;
X Position newheight = (Position)(*childP)->core.height;
X if (form->xedwForm.full_width == True)
X form->xedwForm.virtual_width = newwidth =
X (maxx - ((form->xedwForm.dx) +
X ((*childP)->core.border_width * 2) +
X ((*childP)->core.x)));
X if (form->xedwForm.full_height == True)
X form->xedwForm.virtual_height = newheight =
X (maxy - ((form->xedwForm.dy) +
X ((*childP)->core.border_width * 2) +
X ((*childP)->core.y)));
X /* Resize the widget if it has been changed. XtResizeWidget does the checking */
X XtResizeWidget(*childP, newwidth, newheight, (*childP)->core.border_width);
X }
X
X if (fw->xedwForm.resize_in_layout
X && (maxx != fw->core.width || maxy != fw->core.height)) {
X XtGeometryResult result;
X result = XtMakeResizeRequest(fw, (Dimension)maxx, (Dimension)maxy,
X (Dimension*)&maxx, (Dimension*)&maxy );
X if (result == XtGeometryAlmost)
X result = XtMakeResizeRequest(fw, (Dimension)maxx, (Dimension)maxy,
X NULL, NULL );
X fw->xedwForm.old_width = fw->core.width;
X fw->xedwForm.old_height = fw->core.height;
X ret_val = (result == XtGeometryYes);
X } else ret_val = False;
X
X return ret_val;
X}
X
X
Xstatic void LayoutChild(Widget w)
X{
X XedwFormConstraints xedwForm = (XedwFormConstraints)w->core.constraints;
X Position x, y;
X Dimension width, height;
X Widget ref;
X
X switch (xedwForm->xedwForm.layout_state) {
X
X case LayoutPending:
X xedwForm->xedwForm.layout_state = LayoutInProgress;
X break;
X
X case LayoutDone:
X return;
X
X case LayoutInProgress:
X {
X String subs[2];
X Cardinal num_subs = 2;
X subs[0] = w->core.name;
X subs[1] = w->core.parent->core.name;
X XtAppWarningMsg(XtWidgetToApplicationContext(w),
X "constraintLoop","XedwFormLayout","XawToolkitError",
X "constraint loop detected while laying out child '%s'"
X " in XedwFormWidget '%s'",
X subs, &num_subs);
X return;
X }
X }
X x = xedwForm->xedwForm.dx;
X y = xedwForm->xedwForm.dy;
X if ((ref = xedwForm->xedwForm.width_link) != (Widget)NULL) {
X LayoutChild(ref);
X width = xedwForm->xedwForm.virtual_width = ref->core.width;
X XtResizeWidget(w, width, w->core.height, w->core.border_width);
X }
X if ((ref = xedwForm->xedwForm.height_link) != (Widget)NULL) {
X LayoutChild(ref);
X height = xedwForm->xedwForm.virtual_height = ref->core.height;
X XtResizeWidget(w, w->core.width, height, w->core.border_width);
X }
X if ((ref = xedwForm->xedwForm.horiz_base) != (Widget)NULL) {
X LayoutChild(ref);
X x += ref->core.x + ref->core.width + (ref->core.border_width << 1);
X }
X if ((ref = xedwForm->xedwForm.vert_base) != (Widget)NULL) {
X LayoutChild(ref);
X y += ref->core.y + ref->core.height + (ref->core.border_width << 1);
X }
X XtMoveWidget( w, x, y );
X xedwForm->xedwForm.layout_state = LayoutDone;
X}
X
X
Xstatic Position TransformCoord(Position loc,
X Dimension old, Dimension new,
X XtEdgeType type)
X{
X if (type == XtRubber) {
X if ( ((int) old) > 0)
X loc = (loc * new) / old;
X }
X else if (type == XtChainBottom || type == XtChainRight)
X loc += (Position)new - (Position)old;
X
X /* I don't see any problem with returning values less than zero. */
X
X return (loc);
X}
X
X
Xstatic void Resize(Widget w)
X{
X XedwFormWidget fw = (XedwFormWidget)w;
X WidgetList children = fw->composite.children;
X int num_children = fw->composite.num_children;
X Widget *childP;
X Position x, y;
X Dimension width, height;
X
X for (childP = children; childP - children < num_children; childP++) {
X XedwFormConstraints xedwForm = (XedwFormConstraints)(*childP)->core.constraints;
X if (!XtIsManaged(*childP)) continue;
X x = TransformCoord( (*childP)->core.x, fw->xedwForm.old_width,
X fw->core.width, xedwForm->xedwForm.left );
X y = TransformCoord( (*childP)->core.y, fw->xedwForm.old_height,
X fw->core.height, xedwForm->xedwForm.top );
X
X if (xedwForm->xedwForm.rubber_width)
X xedwForm->xedwForm.virtual_width =
X TransformCoord((Position)((*childP)->core.x
X + xedwForm->xedwForm.virtual_width
X + 2 * (*childP)->core.border_width),
X fw->xedwForm.old_width, fw->core.width,
X xedwForm->xedwForm.right )
X - (x + 2 * (*childP)->core.border_width);
X
X if (xedwForm->xedwForm.rubber_height)
X xedwForm->xedwForm.virtual_height =
X TransformCoord((Position)((*childP)->core.y
X + xedwForm->xedwForm.virtual_height
X + 2 * (*childP)->core.border_width),
X fw->xedwForm.old_height, fw->core.height,
X xedwForm->xedwForm.bottom )
X - ( y + 2 * (*childP)->core.border_width);
X
X width = (Dimension)
X (xedwForm->xedwForm.virtual_width < 1) ? 1 : xedwForm->xedwForm.virtual_width;
X height = (Dimension)
X (xedwForm->xedwForm.virtual_height < 1) ? 1 : xedwForm->xedwForm.virtual_height;
X
X XtConfigureWidget( *childP, x, y, (Dimension)width, (Dimension)height,
X (*childP)->core.border_width );
X }
X
X fw->xedwForm.old_width = fw->core.width;
X fw->xedwForm.old_height = fw->core.height;
X}
X
X
Xstatic XtGeometryResult GeometryManager(Widget w,
X XtWidgetGeometry *request,
X XtWidgetGeometry *reply)
X{
X XedwFormConstraints xedwForm = (XedwFormConstraints)w->core.constraints;
X XtWidgetGeometry allowed;
X
X if ((request->request_mode & ~(XtCWQueryOnly | CWWidth | CWHeight)) ||
X !xedwForm->xedwForm.allow_resize)
X return XtGeometryNo;
X
X if (request->request_mode & CWWidth)
X allowed.width = request->width;
X else
X allowed.width = w->core.width;
X
X if (request->request_mode & CWHeight)
X allowed.height = request->height;
X else
X allowed.height = w->core.height;
X
X if (allowed.width == w->core.width && allowed.height == w->core.height)
X return XtGeometryNo;
X
X if (!(request->request_mode & XtCWQueryOnly)) {
X /* reset virtual width and height. */
X xedwForm->xedwForm.virtual_width = w->core.width = allowed.width;
X xedwForm->xedwForm.virtual_height = w->core.height = allowed.height;
X RefigureLocations( (XedwFormWidget)w->core.parent );
X }
X return XtGeometryYes;
X}
X
X
X
Xstatic Boolean SetValues(Widget current, Widget request, Widget new)
X{
X return( FALSE );
X}
X
X
Xstatic void ConstraintInitialize(Widget request, Widget new)
X{
X XedwFormConstraints xedwForm = (XedwFormConstraints)new->core.constraints;
X XedwFormWidget fw = (XedwFormWidget)new->core.parent;
X
X xedwForm->xedwForm.virtual_width = (int) new->core.width;
X xedwForm->xedwForm.virtual_height = (int) new->core.height;
X
X if (xedwForm->xedwForm.dx == default_value)
X xedwForm->xedwForm.dx = fw->xedwForm.default_spacing;
X
X if (xedwForm->xedwForm.dy == default_value)
X xedwForm->xedwForm.dy = fw->xedwForm.default_spacing;
X}
X
Xstatic Boolean ConstraintSetValues(Widget current, Widget request, Widget new)
X{
X return( FALSE );
X}
X
Xstatic void ChangeManaged(Widget w)
X{
X XedwFormWidget fw = (XedwFormWidget)w;
X XedwFormConstraints xedwForm;
X WidgetList children, childP;
X int num_children = fw->composite.num_children;
X Widget child;
X
X /*
X * Reset virtual width and height for all children.
X */
X
X for (children = childP = fw->composite.children ;
X childP - children < num_children; childP++) {
X child = *childP;
X if (XtIsManaged(child)) {
X xedwForm = (XedwFormConstraints)child->core.constraints;
X if ( child->core.width != 1)
X xedwForm->xedwForm.virtual_width = (int) child->core.width;
X if ( child->core.height != 1)
X xedwForm->xedwForm.virtual_height = (int) child->core.height;
X }
X }
X RefigureLocations( (XedwFormWidget)w );
X}
X
X
Xstatic XtGeometryResult PreferredGeometry(Widget widget,
X XtWidgetGeometry *request,
X XtWidgetGeometry *reply)
X{
X XedwFormWidget w = (XedwFormWidget)widget;
X
X reply->width = w->xedwForm.preferred_width;
X reply->height = w->xedwForm.preferred_height;
X reply->request_mode = CWWidth | CWHeight;
X if ( request->request_mode & (CWWidth | CWHeight) ==
X reply->request_mode & CWWidth | CWHeight
X && request->width == reply->width
X && request->height == reply->height)
X return XtGeometryYes;
X else if (reply->width == w->core.width && reply->height == w->core.height)
X return XtGeometryNo;
X else
X return XtGeometryAlmost;
X}
X
X
X/**********************************************************************
X *
X * Public routines
X *
X **********************************************************************/
X
X/*
X * Set or reset figuring (ignored if not realized)
X */
X
Xvoid XedwFormDoLayout(Widget w, Boolean doit)
X{
X register XedwFormWidget fw = (XedwFormWidget)w;
X
X fw->xedwForm.no_refigure = !doit;
X
X if ( XtIsRealized(w) && fw->xedwForm.needs_relayout )
X RefigureLocations( fw );
X}
SHAR_EOF
chmod 0644 xdtm/Xedw/XedwForm.c ||
echo 'restore of xdtm/Xedw/XedwForm.c failed'
Wc_c="`wc -c < 'xdtm/Xedw/XedwForm.c'`"
test 18923 -eq "$Wc_c" ||
echo 'xdtm/Xedw/XedwForm.c: original size 18923, current size' "$Wc_c"
fi
# ============= xdtm/Xedw/XedwForm.h ==============
if test -f 'xdtm/Xedw/XedwForm.h' -a X"$1" != X"-c"; then
echo 'x - skipping xdtm/Xedw/XedwForm.h (File already exists)'
else
echo 'x - extracting xdtm/Xedw/XedwForm.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xdtm/Xedw/XedwForm.h' &&
X/*****************************************************************************
XCopyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
Xand the Massachusetts Institute of Technology, Cambridge, Massachusetts.
X
X All Rights Reserved
X
XPermission to use, copy, modify, and distribute this software and its
Xdocumentation for any purpose and without fee is hereby granted,
Xprovided that the above copyright notice appear in all copies and that
Xboth that copyright notice and this permission notice appear in
Xsupporting documentation, and that the names of Digital or MIT not be
Xused in advertising or publicity pertaining to distribution of the
Xsoftware without specific, written prior permission.
X
XDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
XDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
XSOFTWARE.
X
X*****************************************************************************/
X
X#ifndef _XedwForm_h
X#define _XedwForm_h
X
X#include <X11/Constraint.h>
X#include <X11/Xaw/Form.h>
X
X/***********************************************************************
X *
X * XedwForm Widget
X *
X ***********************************************************************/
X
X/* Parameters:
X
X Name Class RepType Default Value
X ---- ----- ------- -------------
X background Background Pixel XtDefaultBackground
X border BorderColor Pixel XtDefaultForeground
X borderWidth BorderWidth Dimension 1
X defaultDistance Thickness int 4
X destroyCallback Callback Pointer NULL
X height Height Dimension computed at realize
X mappedWhenManaged MappedWhenManaged Boolean True
X sensitive Sensitive Boolean True
X width Width Dimension computed at realize
X x Position Position 0
X y Position Position 0
X
X*/
X
X/* Constraint parameters:
X
X Name Class RepType Default Value
X ---- ----- ------- -------------
X bottom Edge XtEdgeType XtRubber
X fromHoriz Widget Widget (left edge of xedwForm)
X fromVert Widget Widget (top of xedwForm)
X fullHeight Boolean Boolean False
X fullWidth Boolean Boolean False
X horizDistance Thickness int defaultDistance
X left Edge XtEdgeType XtRubber
X resizable Boolean Boolean False
X right Edge XtEdgeType XtRubber
X rubberHeight Boolean Boolean True
X rubberWidth Boolean Boolean True
X top Edge XtEdgeType XtRubber
X vertDistance Thickness int defaultDistance
X widthLinked Widget Widget NULL
X heightLinked Widget Widget NULL
X
X*/
X
X
X
X#define XtNfullHeight "fullHeight"
X#define XtNfullWidth "fullWidth"
X#define XtNrubberHeight "rubberHeight"
X#define XtNrubberWidth "rubberWidth"
X#define XtNwidthLinked "widthLinked"
X#define XtNheightLinked "heightLinked"
X
Xtypedef struct _XedwFormClassRec *XedwFormWidgetClass;
Xtypedef struct _XedwFormRec *XedwFormWidget;
X
Xextern WidgetClass xedwFormWidgetClass;
X
Xextern void XedwFormDoLayout(Widget, Boolean); /* Boolean doit */
X
X
X#endif /* _XedwForm_h */
SHAR_EOF
chmod 0644 xdtm/Xedw/XedwForm.h ||
echo 'restore of xdtm/Xedw/XedwForm.h failed'
Wc_c="`wc -c < 'xdtm/Xedw/XedwForm.h'`"
test 3912 -eq "$Wc_c" ||
echo 'xdtm/Xedw/XedwForm.h: original size 3912, current size' "$Wc_c"
fi
# ============= xdtm/Xedw/XedwFormP.h ==============
if test -f 'xdtm/Xedw/XedwFormP.h' -a X"$1" != X"-c"; then
echo 'x - skipping xdtm/Xedw/XedwFormP.h (File already exists)'
else
echo 'x - extracting xdtm/Xedw/XedwFormP.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'xdtm/Xedw/XedwFormP.h' &&
X
X/*****************************************************************************
XCopyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
Xand the Massachusetts Institute of Technology, Cambridge, Massachusetts.
X
X All Rights Reserved
X
XPermission to use, copy, modify, and distribute this software and its
Xdocumentation for any purpose and without fee is hereby granted,
Xprovided that the above copyright notice appear in all copies and that
Xboth that copyright notice and this permission notice appear in
Xsupporting documentation, and that the names of Digital or MIT not be
Xused in advertising or publicity pertaining to distribution of the
Xsoftware without specific, written prior permission.
X
XDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
XDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
XSOFTWARE.
X
X******************************************************************************/
X
X/* XedwForm widget private definitions. This Form is identical to the XawForm
X * Widget except for a few added capabilities.
X */
X
X#ifndef _XedwFormP_h
X#define _XedwFormP_h
X
X#include "XedwForm.h"
X#include <X11/Xaw/FormP.h>
X#include <X11/ConstrainP.h>
X
Xtypedef struct {
X Boolean (*layout)(XedwFormWidget, Dimension, Dimension );
X} XedwFormClassPart;
X
Xtypedef struct _XedwFormClassRec {
X CoreClassPart core_class;
X CompositeClassPart composite_class;
X ConstraintClassPart constraint_class;
X XedwFormClassPart xedwForm_class;
X} XedwFormClassRec;
X
Xextern XedwFormClassRec xedwFormClassRec;
X
Xtypedef struct _XedwFormPart {
X /* resources */
X int default_spacing; /* default distance between children */
X
X /* private state */
X Dimension old_width, old_height; /* last known dimensions */
X int no_refigure; /* no re-layout while > 0 */
X Boolean needs_relayout; /* next time no_refigure == 0 */
X Boolean resize_in_layout; /* should layout() do geom request? */
X Dimension preferred_width, preferred_height; /* cached from layout */
X} XedwFormPart;
X
Xtypedef struct _XedwFormRec {
X CorePart core;
X CompositePart composite;
X ConstraintPart constraint;
X XedwFormPart xedwForm;
X} XedwFormRec;
X
Xtypedef struct _XedwFormConstraintsPart {
X/*
X * Constraint Resources.
X */
X XtEdgeType top, bottom, /* where to drag edge on resize */
X left, right;
X int dx; /* desired horiz offset */
X int dy; /* desired vertical offset */
X Widget horiz_base; /* measure dx from here if non-null */
X Widget vert_base; /* measure dy from here if non-null */
X Widget width_link; /* get width from this widget if non-null */
X Widget height_link; /* get height from this widget if non-null */
X Boolean allow_resize; /* True if child may request resize */
X Boolean full_width; /* True if child wants to be full width */
X Boolean full_height; /* True if child wants to be full height */
X Boolean rubber_width; /* True if the child may resize width */
X Boolean rubber_height; /* True if the child may resize height */
X
X/*
X * Private contstraint resources.
X */
X
X int virtual_width, virtual_height;
X
X/*
X * What the size of this child would be if we did not impose the
X * constraint the width and height must be greater than zero (0).
X */
X
X LayoutState layout_state; /* temporary layout state */
X} XedwFormConstraintsPart;
X
Xtypedef struct _XedwFormConstraintsRec {
X XedwFormConstraintsPart xedwForm;
X} XedwFormConstraintsRec, *XedwFormConstraints;
X
X#endif /* _XawXedwFormP_h */
SHAR_EOF
chmod 0644 xdtm/Xedw/XedwFormP.h ||
echo 'restore of xdtm/Xedw/XedwFormP.h failed'
Wc_c="`wc -c < 'xdtm/Xedw/XedwFormP.h'`"
test 4040 -eq "$Wc_c" ||
echo 'xdtm/Xedw/XedwFormP.h: original size 4040, current size' "$Wc_c"
fi
true || echo 'restore of xdtm/Xedw/XedwList.c failed'
echo End of part 2, continue with part 3
exit 0
--
Dan Heller
O'Reilly && Associates Z-Code Software Comp-sources-x:
Senior Writer President comp-sources-x@uunet.uu.net
argv@ora.com argv@zipcode.com