1 /*---------------------------------------------------------------------------- 2 -- 3 -- Module: xitSetPos 4 -- 5 -- Project: xit - X Internal Toolkit 6 -- System: xit - X Internal Toolkit 7 -- Subsystem: <> 8 -- Function block: <> 9 -- 10 -- Description: 11 -- Attaches a widget to a relative position within a form. 12 -- 13 -- Filename: xitSetPos.c 14 -- 15 -- Authors: Roger Larsson, Ulrika Bornetun 16 -- Creation date: 1991-10-20 17 -- 18 -- 19 -- (C) Copyright Ulrika Bornetun, Roger Larsson (1995) 20 -- All rights reserved 21 -- 22 -- Permission to use, copy, modify, and distribute this software and its 23 -- documentation for any purpose and without fee is hereby granted, 24 -- provided that the above copyright notice appear in all copies. Ulrika 25 -- Bornetun and Roger Larsson make no representations about the usability 26 -- of this software for any purpose. It is provided "as is" without express 27 -- or implied warranty. 28 ----------------------------------------------------------------------------*/ 29 30 /* SCCS module identifier. */ 31 static char SCCSID[] = "@(#) Module: xitSetPos.c, Version: 1.1, Date: 95/02/18 15:10:48"; 32 33 34 /*---------------------------------------------------------------------------- 35 -- Include files 36 ----------------------------------------------------------------------------*/ 37 38 #include <X11/Intrinsic.h> 39 #include <X11/Shell.h> 40 41 #include <Xm/Xm.h> 42 43 #include "xitTools.h" 44 45 46 /*---------------------------------------------------------------------------- 47 -- Macro definitions 48 ----------------------------------------------------------------------------*/ 49 50 51 /*---------------------------------------------------------------------------- 52 -- Type declarations 53 ----------------------------------------------------------------------------*/ 54 55 56 /*---------------------------------------------------------------------------- 57 -- Global definitions 58 ----------------------------------------------------------------------------*/ 59 60 61 /*---------------------------------------------------------------------------- 62 -- Function prototypes 63 ----------------------------------------------------------------------------*/ 64 65 66 67 /*---------------------------------------------------------------------------- 68 -- Functions 69 ----------------------------------------------------------------------------*/ 70 71 void xitSetPositional(Widget widget,int top,int left,int right,int bottom)72 xitSetPositional( Widget widget, 73 int top, 74 int left, 75 int right, 76 int bottom ) 77 { 78 79 /* Variables. */ 80 int n; 81 Arg args[ 10 ]; 82 83 84 /* Code. */ 85 86 n = 0; 87 88 if( top > 0 ) { 89 XtSetArg( args[ n ], XmNtopAttachment, XmATTACH_POSITION ); n++; 90 XtSetArg( args[ n ], XmNtopPosition, top ); n++; 91 } 92 93 if( left > 0 ) { 94 XtSetArg( args[ n ], XmNleftAttachment, XmATTACH_POSITION ); n++; 95 XtSetArg( args[ n ], XmNleftPosition, left ); n++; 96 } 97 98 if( right > 0 ) { 99 XtSetArg( args[ n ], XmNrightAttachment, XmATTACH_POSITION ); n++; 100 XtSetArg( args[ n ], XmNrightPosition, right ); n++; 101 } 102 103 if( bottom > 0 ) { 104 XtSetArg( args[ n ], XmNbottomAttachment, XmATTACH_POSITION ); n++; 105 XtSetArg( args[ n ], XmNbottomPosition, bottom ); n++; 106 } 107 108 XtSetValues( widget, args, n ); 109 110 } /* xitSetPositional */ 111