예제 #1
0
Widget 
XmGetDragContext(
        Widget w,
        Time time )
{
	XmDisplay		xmDisplay;
	XmDragContext	matchedDC = NULL, dc = NULL;
	Cardinal		i;

	_XmWidgetToAppContext(w);
	_XmAppLock(app);

	xmDisplay = (XmDisplay)XmGetXmDisplay(XtDisplay(w));
	for(i = 0; i < xmDisplay->composite.num_children; i++)
	{
		dc = (XmDragContext)(xmDisplay->composite.children[i]);
		if ((XmIsDragContext((Widget) dc)) && (CHECK_TIME(dc, time)) &&
			((!matchedDC) ||
				(matchedDC->drag.dragStartTime
					< dc->drag.dragStartTime)) &&
			!dc->core.being_destroyed)
			matchedDC = dc;
	}
	_XmAppUnlock(app);
	return((Widget)matchedDC);
}
예제 #2
0
파일: Display.c 프로젝트: att/uwin
unsigned char
_XmGetDragProtocolStyle(Widget w)
{
    Widget disp = XmGetXmDisplay(XtDisplay(w));

#if 0
    DEBUGOUT(_LtDebug(__FILE__, w, "_XmGetDragProtocolStyle()\n"));
#endif
    switch (Display_DragReceiverProtocolStyle(disp))
    {
    case XmDRAG_NONE:
    case XmDRAG_DROP_ONLY:
	return XmDRAG_NONE;

    case XmDRAG_PREFER_PREREGISTER:
    case XmDRAG_PREREGISTER:
    case XmDRAG_PREFER_DYNAMIC:
	return XmDRAG_PREREGISTER;

    case XmDRAG_DYNAMIC:
	return XmDRAG_DYNAMIC;

    case XmDRAG_PREFER_RECEIVER:
    default:
	return XmDRAG_NONE;
    }
}
예제 #3
0
static void 
Realize(
        register Widget w,
        XtValueMask *p_valueMask,
        XSetWindowAttributes *attributes )
{
	XmDisplay   dd = (XmDisplay) XmGetXmDisplay(XtDisplay(w));
	Cursor SashCursor = 
		((XmDisplayInfo *)(dd->display.displayInfo))->SashCursor;
	
	if (0L == SashCursor)
		{
		/* create some data shared among all instances on this 
		** display; the first one along can create it, and 
		** any one can remove it; note no reference count
		*/
        	SashCursor = 
		((XmDisplayInfo *)(dd->display.displayInfo))->SashCursor = 
			XCreateFontCursor(XtDisplay(w), XC_crosshair);
		XtAddCallback((Widget)dd, XtNdestroyCallback, 
			SashDisplayDestroyCallback, (XtPointer) NULL);
		}

	attributes->cursor = SashCursor;
	XtCreateWindow (w, InputOutput, CopyFromParent, 
		*p_valueMask | CWCursor, attributes);
}
예제 #4
0
/* 
   This function is used for setting the "last editable widget on which a
   select, edit, insert, or paste operation was performed and is a destination
   for quick paste and certain clipboard functions" (for this display 
   connection) and is not necessarily a text widget.  
   Under current usage by Motif internals:
   This function is for squirreling away the widget that has the destination
   cursor so that it can be retrieved when pasting from a menu.  Called by 
   _XmTextSetDestinationSelection.
*/
void _XmSetDestination (Display *dpy, Widget w)
{
      XmDisplay   dd = (XmDisplay) XmGetXmDisplay(dpy);	/* w may be NULL */
      if ((XmDisplay)NULL != dd)
	((XmDisplayInfo *)(dd->display.displayInfo))->destinationWidget =
		w;	
}
예제 #5
0
unsigned char 
_XmGetDragProtocolStyle(
        Widget w )
{
    XmDisplay		xmDisplay;
    unsigned char	style;

    xmDisplay = (XmDisplay) XmGetXmDisplay(XtDisplay(w));

    switch(xmDisplay->display.dragReceiverProtocolStyle) {
	  case XmDRAG_NONE:
	  case XmDRAG_DROP_ONLY:
	    style = XmDRAG_NONE;
	    break;
	  case XmDRAG_DYNAMIC:
	    style = XmDRAG_DYNAMIC;
	    break;
	  case XmDRAG_PREFER_DYNAMIC:
	  case XmDRAG_PREFER_PREREGISTER:
	  case XmDRAG_PREREGISTER:
	    style = XmDRAG_PREREGISTER;
	    break;
	  default:
	    style = XmDRAG_NONE;
	    break;
	}
    return style;
}
예제 #6
0
파일: test2.c 프로젝트: melanj/lesstif
int
main(int argc, char **argv)
{
	Widget toplevel, one, d;
	XtAppContext app;
	XmFontList fontlist;

	XmString xmstr1 = XmStringCreateLtoR("\n\nHere is a\n\n", "MY_FONT1");
	XmString xmstr2 = XmStringCreate("different font", "MY_FONT");
	XmString xmstr3 = XmStringCreate("accelerator", "MY_FONT");
	XmStringContext context;
	char *text;
	XmStringCharSet tag;
	XmStringDirection dir;
	Boolean sep;

	XmString xmstr = XmStringConcat(xmstr1, xmstr2);

	XtSetLanguageProc(NULL, NULL, NULL);

	toplevel = XtVaAppInitialize(&app, "Label", NULL, 0, &argc, argv, NULL, NULL);

	d = XmGetXmDisplay(XtDisplay(toplevel));
	XtAddCallback(d, XmNnoFontCallback, NoFontCB, NULL);
	XtAddCallback(d, XmNnoRenditionCallback, NoRenditionCB, NULL);

	fontlist = XmFontListAppendEntry(NULL,
		XmFontListEntryCreate("MY_FONT",
			XmFONT_IS_FONT,
			XLoadQueryFont(XtDisplay(toplevel),
			"-adobe-helvetica-bold-o-normal--17-0-75-75-p-*-iso8859-1")));
	fontlist = XmFontListAppendEntry(fontlist,
		XmFontListEntryCreate("MY_FONT1",
			XmFONT_IS_FONT,
			XLoadQueryFont(XtDisplay(toplevel),
			"-adobe-helvetica-bold-r-normal--17-0-75-75-p-*-iso8859-1")));

	one = XtVaCreateManagedWidget("One", xmLabelWidgetClass, toplevel,
		XmNfontList, fontlist,
		XmNlabelString, xmstr,
		XmNacceleratorText, xmstr3,
		NULL);

	XtRealizeWidget(toplevel);

/* Note: the following values are the result of
 * querying the current geometry.
 */
{
static XtWidgetGeometry Expected[] = {
   {CWWidth | CWHeight            ,    0,    0,  112,   58, 0,0,0}, /* One */
};
/* toplevel should be replaced with to correct applicationShell */
	PrintDetails(toplevel, Expected);
}

	LessTifTestMainLoop(toplevel);
	exit(0);
}
예제 #7
0
파일: test4.c 프로젝트: melanj/lesstif
int
main(int argc, char **argv)
{
	Widget		toplevel, one, d;
	XtAppContext	app;
	XmFontList	fontlist;
	XmString	xms;
	Arg           args[10];
	XmTab         tabs[MAX_COLUMNS];
	XmTabList     tablist;
	XmRendition   renditions[MAX_COLUMNS];
	XmRenderTable rendertable;
	XmStringTable xmstring_table;
	int           xmstring_count;
	Pixel         pixels[MAX_COLUMNS];
	int           n, i;

	XtSetLanguageProc(NULL, NULL, NULL);
	toplevel = XtVaAppInitialize(&app, "Label", NULL, 0, &argc, argv,
		fallback, NULL);

	d = XmGetXmDisplay(XtDisplay(toplevel));

	/* Create the multi-column data for the list */

	xmstring_table = CreateListData(&xmstring_count) ;

	xms = xmstring_table[0];
	for (i=1; i<xmstring_count; i++) {
		XmString	s, x;
		s = XmStringSeparatorCreate();
		x = XmStringConcat(xms, s);
		xms = XmStringConcat(x, xmstring_table[i]);
	}

	one = XtVaCreateManagedWidget("One", xmLabelWidgetClass, toplevel,
		XmNalignment,	XmALIGNMENT_BEGINNING,
		XmNlabelString, xms,
		NULL);

	XtRealizeWidget(toplevel);

#if 0
/* Note: the following values are the result of
 * querying the current geometry.
 */
{
static XtWidgetGeometry Expected[] = {
   {CWWidth | CWHeight            ,    0,    0,  112,   58, 0,0,0}, /* One */
};
/* toplevel should be replaced with to correct applicationShell */
PrintDetails(toplevel, Expected);
}
#endif

	LessTifTestMainLoop(toplevel);
	exit(0);
}
예제 #8
0
unsigned short
_XmGetFocusFlag(Widget w, 
		unsigned int mask)
{
  XmDisplay dd = (XmDisplay)XmGetXmDisplay(XtDisplay(w));

  return ((unsigned short)((XmDisplayInfo *)
	   (dd->display.displayInfo))->resetFocusFlag & mask);
}
예제 #9
0
파일: DragBS.c 프로젝트: att/uwin
/*
 * fetch and/or set the ATOM_PAIRS.  This is triggered at least once
 * by the first call to XmInternAtom().
 */
extern void
_XmInitAtomPairs(Display *display)
{
    Window win;
    char *dstr;
    Display *d;

    DEBUGOUT(_LtDebug0(__FILE__, NULL, "%s:_XmInitAtomPairs(%d)\n",
		      __FILE__, __LINE__));

    if ((win = read_drag_window(display)) == None)
    {
	dstr = XDisplayString(display);

	d = XOpenDisplay(dstr);

	if (d == NULL)
	{
	    _XmWarning((Widget)XmGetXmDisplay(display),
		       "Where's your display?");

	    return;
	}

	XGrabServer(d);

	if ((win = read_drag_window(d)) == None)
	{
	    XSetCloseDownMode(d, RetainPermanent);

	    win = create_drag_window(d);

	    write_drag_window(d, &win);
	}

	XCloseDisplay(d);
    }

    set_drag_window(display, win);

    if (!read_atom_pairs(display))
    {
	XGrabServer(display);

	if (!read_atom_pairs(display))
	{
	    write_atom_pairs(display);
	}

	XUngrabServer(display);

	XFlush(display);
    }
}
예제 #10
0
/* This public function retrieves the widget saved by _XmSetDestination. */
Widget XmGetDestination (Display *display)
{
      XmDisplay   dd = (XmDisplay) XmGetXmDisplay(display);
      Widget w = (Widget)NULL;
      _XmDisplayToAppContext(display);

      _XmAppLock(app);
      if ((XmDisplay)NULL != dd)
	 w = ((XmDisplayInfo *)(dd->display.displayInfo))->destinationWidget;
      _XmAppUnlock(app);
      return w;
}
예제 #11
0
파일: Sash.c 프로젝트: att/uwin
static void
realize(Widget w, XtValueMask *value_mask, XSetWindowAttributes *attributes)
{
    Widget disp = XmGetXmDisplay(XtDisplay(w));

    *value_mask |= CWCursor;
    attributes->cursor =
	((XmDisplayInfo *) Display_DisplayInfo(disp))->SashCursor;

#define superclass (&xmPrimitiveClassRec)
    (*superclass->core_class.realize) (w, value_mask, attributes);
#undef superclass
}
예제 #12
0
파일: Display.c 프로젝트: att/uwin
/*
 * This action is triggered whenever a MappingNotify event happens on our
 * display's wire. Then we will invalidate the cached modifier mappings
 * and reload the virtual keysym stuff. This way LessTif applications --
 * contrary to some software foundations' stuff -- can be reconfigured
 * during run-time.
 */
static void 
RefreshMapping(Widget w, XEvent *event,
	       String *Params, Cardinal *NumParams)
{
    /*
     * NOTE: w is always NULL with mapping notifications! So we just
     * look up the offending display widget and refresh the virtual
     * key bindings. Happy refreshing...
     */
    DEBUGOUT(_LtDebug(__FILE__, w, "Refreshing virtual key bindings.\n"));

    _XmRefreshVirtKeys(XmGetXmDisplay(event->xmapping.display));
}
예제 #13
0
/*----------------------------------------------------------------------*/
/* extern */ Boolean
XfeDisplayIsUserGrabbed(Widget w)
{
	XmDisplayRec *	xm_display;

	assert( _XfeIsAlive(w) );

	xm_display = (XmDisplayRec *) XmGetXmDisplay(XtDisplay(w));

	assert( xm_display != NULL );

	return xm_display->display.userGrabbed;	
}
예제 #14
0
/*----------------------------------------------------------------------*/
/* extern */ void
XfeDisplaySetUserGrabbed(Widget w,Boolean grabbed)
{
	XmDisplayRec *	xm_display;

	assert( _XfeIsAlive(w) );

	xm_display = (XmDisplayRec *) XmGetXmDisplay(XtDisplay(w));

	assert( xm_display != NULL );

	xm_display->display.userGrabbed = grabbed;
}
예제 #15
0
/*ARGSUSED*/
static void 
TreeUpdateHandler(
        Widget w,
        XtPointer client,
        XtPointer call )
{
    XmAnyCallbackStruct	    	*anyCB = (XmAnyCallbackStruct *)call;
    XmDisplay	  	dd = (XmDisplay) XmGetXmDisplay(XtDisplay(w));

    if (dd->display.dragReceiverProtocolStyle == XmDRAG_NONE)
		return;

    switch(anyCB->reason) {
      case XmCR_DROP_SITE_TREE_ADD:
	{
	    XmDropSiteTreeAddCallback cb =
	      (XmDropSiteTreeAddCallback)anyCB;

	    if (XtIsRealized(cb->rootShell)) {
		_XmSetDragReceiverInfo(dd, cb->rootShell);
	    }
	    else {
		XtAddEventHandler(cb->rootShell, 
				  StructureNotifyMask, False,
				  SetDragReceiverInfo,
				  (XtPointer)cb->rootShell);
	    }
	    /*
	     * ClientMessages are not maskable so all we have to
	     * do is indicate interest in non-maskable events.
	     */
	    XtAddEventHandler(cb->rootShell, NoEventMask, True,
			      ReceiverShellExternalSourceHandler,
			      (XtPointer)dd);
	}
	break;
      case XmCR_DROP_SITE_TREE_REMOVE:
	{
	    XmDropSiteTreeRemoveCallback cb =
	      (XmDropSiteTreeRemoveCallback)anyCB;
	    XtRemoveEventHandler(cb->rootShell, NoEventMask, True,
				 ReceiverShellExternalSourceHandler,
				 (XtPointer)dd);
	    if (XtIsRealized(cb->rootShell))
	      _XmClearDragReceiverInfo(cb->rootShell);
	}
	break;
      default:
	break;
    }
}
예제 #16
0
파일: DropTrans.c 프로젝트: att/uwin
Widget
XmDropTransferStart(Widget widget,
		    ArgList arglist,
		    Cardinal argcount)
{
    Widget disp = XmGetXmDisplay(XtDisplay(widget));

    DEBUGOUT(_LtDebug(__FILE__, widget, "%s:XmDropTransferStart(%d)\n",
    	__FILE__, __LINE__));
    DEBUGOUT(_LtDebugPrintArgList(__FILE__, widget, arglist, argcount, False));


    return DTC_StartTransferProc(Display_DropTransferClass(disp)) (widget,
								   arglist,
								   argcount);
}
예제 #17
0
/*ARGSUSED*/
static void 
SetDragReceiverInfo(
        Widget w,
        XtPointer client_data,
        XEvent *event,
        Boolean *dontSwallow )
{
    XmDisplay	dd = (XmDisplay) XmGetXmDisplay(XtDisplay(w));

    if (XtIsRealized(w)) {
	_XmSetDragReceiverInfo(dd, (Widget)client_data);
	XtRemoveEventHandler(w, StructureNotifyMask, False,
			     SetDragReceiverInfo,
			     client_data);
    }
}
예제 #18
0
    static void
draw_shadows(XmEnhancedButtonWidget eb)
{
    GC		top_gc;
    GC		bottom_gc;
    Boolean	etched_in;

    if (!eb->primitive.shadow_thickness)
       return;

    if ((eb->core.width <= 2 * eb->primitive.highlight_thickness)
	    || (eb->core.height <= 2 * eb->primitive.highlight_thickness))
	return;

#if !defined(LESSTIF_VERSION) && (XmVersion > 1002)
    {
	XmDisplay	dpy;

	dpy = (XmDisplay) XmGetXmDisplay(XtDisplay(eb));
	etched_in = dpy->display.enable_etched_in_menu;
    }
#else
    etched_in = False;
#endif
    if (!etched_in ^ eb->pushbutton.armed)
    {
	top_gc = eb->primitive.top_shadow_GC;
	bottom_gc = eb->primitive.bottom_shadow_GC;
    }
    else
    {
	top_gc = eb->primitive.bottom_shadow_GC;
	bottom_gc = eb->primitive.top_shadow_GC;
    }

    XmeDrawShadows(XtDisplay(eb), XtWindow(eb),
	    top_gc,
	    bottom_gc,
	    eb->primitive.highlight_thickness,
	    eb->primitive.highlight_thickness,
	    eb->core.width - 2 * eb->primitive.highlight_thickness,
	    eb->core.height - 2 * eb->primitive.highlight_thickness,
	    eb->primitive.shadow_thickness,
	    (unsigned)(etched_in ? XmSHADOW_IN : XmSHADOW_OUT));
}
예제 #19
0
/*ARGSUSED*/
void 
XmCvtStringToUnitType(
        XrmValuePtr args,	/* unused */
        Cardinal *num_args,	/* unused */
        XrmValue *from_val,
        XrmValue *to_val )
{
   Display * dpy = _XmGetDefaultDisplay();

   /* we cannot call XmRUnitType directly, since it would loop
      if a program registers this function with to_type = XmRUnitType (which
      is very likely).
      So we use REAL_UNIT_TYPE_NAME, which has been registered with the
      same semantics as the original XmRUnitType in RepType.c */
   XtConvertAndStore(XmGetXmDisplay(dpy), XmRString, from_val,
		     REAL_UNIT_TYPE_NAME, to_val);

}
예제 #20
0
파일: Display.c 프로젝트: att/uwin
Widget
XmGetDragContext(Widget w, Time time)
{
    Widget disp = XmGetXmDisplay(XtDisplay(w)), dc = NULL;
    Cardinal i;

    DEBUGOUT(_LtDebug(__FILE__, w, "%s:XmGetDragContext(%d)\n",
    	__FILE__, __LINE__));
    for (i = 0; i < MGR_NumChildren(disp); i++)
    {
	if (XmIsDragContext(MGR_Children(disp)[i]))
	{
	    /* too late */
	    if (DC_DragStartTime(MGR_Children(disp)[i]) > time)
	    {
		continue;
	    }

	    /* too early */
	    if (DC_DragFinishTime(MGR_Children(disp)[i]) != CurrentTime &&
		DC_DragFinishTime(MGR_Children(disp)[i]) < time)
	    {
		continue;
	    }

	    /* either nothing yet, or later than what we have already */
	    if (dc == NULL ||
		(DC_DragStartTime(MGR_Children(disp)[i]) >=
		 DC_DragStartTime(dc)))
	    {

		/* somebody's not doing a Cancel and it's not being removed */
		if (!CoreBeingDestroyed(MGR_Children(disp)[i]))
		{
		    dc = MGR_Children(disp)[i];
		}
	    }
	}
    }

    return dc;
}
예제 #21
0
파일: test2.c 프로젝트: melanj/lesstif
void DumpGrabList(Widget w)
{
    XmDisplay    wd;
    XmModalData  modal;
    int          i;

    wd = (XmDisplay) XmGetXmDisplay(XtDisplayOfObject(w));
    printf("\n*** Grab List Dump ***\n");
    modal = wd->display.modals;
    printf("%i entries in grab list\n", wd->display.numModals);
    for ( i = 0; i < wd->display.numModals; i++ ) {
        printf("Entry #%i ----------\n", (int)(i + 1));
	DumpW((Widget) modal->wid,     "  wid     = ", "            ", "  ");
	DumpW((Widget) modal->ve,      "  ve      = ", "            ", "  ");
	DumpW((Widget) modal->grabber, "  grabber = ", "            ", "  ");
	printf("  exclusive = %s, spring loaded = %s\n",
	       modal->exclusive ? "Yes" : "No",
	       modal->springLoaded ? "Yes" : "No");
	modal++;
    }
} /* DumpGrabList */
예제 #22
0
/*ARGSUSED*/
static void 
SashDisplayDestroyCallback 
	( Widget w,
        XtPointer client_data,	/* unused */
        XtPointer call_data )	/* unused */
{
	XmDisplay   dd = (XmDisplay) XmGetXmDisplay(XtDisplay(w));
	Cursor SashCursor;
        if ((XmDisplay)NULL != dd)
	{
	  SashCursor  = 
		((XmDisplayInfo *)(dd->display.displayInfo))->SashCursor;
	    if (0L != SashCursor)
		{
			XFreeCursor(XtDisplay(w), SashCursor);
			/*
			((XmDisplayInfo *)(dd->display.displayInfo))->SashCursor= 0L;
			*/
		}
	}
}
예제 #23
0
파일: DropTrans.c 프로젝트: att/uwin
static Widget
start_drop_transfer(Widget refWidget,
		    ArgList args, Cardinal argCount)
{
    Widget disp = XmGetXmDisplay(XtDisplay(refWidget)), dt;

    DEBUGOUT(_LtDebug(__FILE__, refWidget, "%s:start_drop_transfer(%d)\n",
    	__FILE__, __LINE__));

    dt = XtCreateWidget("drop_transfer",
			Display_DropTransferClass(disp),
			disp, args, argCount);

    /* refWidget had BETTER be a DC */
    DT_DragContext(dt) = refWidget;
    DT_Timestamp(dt) = DC_DragFinishTime(refWidget);

    XtAppAddTimeOut(XtWidgetToApplicationContext(dt), 0,
		    drop_timer, (XtPointer)dt);
    return dt;
}
예제 #24
0
Widget 
_XmGetDragContextFromHandle(
        Widget w,
        Atom iccHandle )
{
	XmDisplay		xmDisplay;
	XmDragContext	dc;
	Cardinal		i;

	xmDisplay = (XmDisplay)XmGetXmDisplay(XtDisplay(w));

	for(i = 0; i < xmDisplay->composite.num_children; i++)
	{
		dc = (XmDragContext)(xmDisplay->composite.children[i]);
		if ((XmIsDragContext((Widget) dc)) && 
			(dc->drag.iccHandle == iccHandle) &&
			!dc->core.being_destroyed)
			return((Widget)dc);
	}
	return(NULL);
}
예제 #25
0
파일: Display.c 프로젝트: att/uwin
Widget
_XmGetDragContextFromHandle(Widget w, Atom iccHandle)
{
    Widget disp = XmGetXmDisplay(XtDisplay(w)), dc;
    Cardinal c;

    DEBUGOUT(_LtDebug(__FILE__, w, "%s:_XmGetDragContextFromHandle(%d)\n",
    	__FILE__, __LINE__));
    for (c = 0; c < MGR_NumChildren(disp); c++)
    {

	dc = MGR_Children(disp)[c];

	if (XmIsDragContext(dc))
	{
	    if (DC_ICCHandle(dc) == iccHandle && !CoreBeingDestroyed(dc))
	    {
		return dc;
	    }
	}
    }

    return NULL;
}
예제 #26
0
파일: awt_motif21.c 프로젝트: frohoff/jdk6
void
awt_motif_enableSingleDragInitiator(Widget w) {
    XtAddCallback(XmGetXmDisplay(XtDisplay(w)),
                  XmNdragStartCallback, (XtCallbackProc)CheckDragInitiator,
                  (XtPointer)w);
}
예제 #27
0
파일: Xphace.c 프로젝트: Gilles86/afni
int main( int argc , char * argv[] )
{
   Widget rc , lab ;
   int ww , uu ;

   if( argc < 2 || strcmp(argv[1],"-help") == 0 ){
      printf("Usage: Xphace im1 [im2]\n"
             "Interactive image mergerizing via FFTs.\n"
             "Image files are in PGM or JPEG format.\n") ; exit(0) ;
   }

   mainENTRY("Xphace main") ; machdep() ;

   ww = PH_loadim( argv[1] ) ;
   if( ww < 0 ) exit(1) ;
   if( argc > 2 ){
      ww = PH_loadim( argv[2] ) ;
      if( ww < 0 ) exit(1) ;
   } else {
      PH_loadim( "noise=1" ) ;
   }

   MAIN_shell = XtVaAppInitialize( &MAIN_app , "AFNI" , NULL , 0 ,
                                   &argc , argv , FALLback , NULL ) ;

   if( MAIN_shell == NULL ){
      fprintf(stderr,"\n*** Cannot initialize X11 ***\n") ; exit(1) ;
   }

   MAIN_dc = MCW_new_DC( MAIN_shell , 32 , 0 , NULL,NULL , 1.0 , 0 ) ;

   XtVaSetValues( XmGetXmDisplay(XtDisplay(MAIN_shell)) ,
                    XmNdragInitiatorProtocolStyle , XmDRAG_NONE ,
                    XmNdragReceiverProtocolStyle  , XmDRAG_NONE ,
                  NULL ) ;

   MAIN_rc = XtVaCreateWidget( "AFNI" , xmRowColumnWidgetClass , MAIN_shell ,
                                 XmNpacking     , XmPACK_TIGHT ,
                                 XmNorientation , XmVERTICAL   ,
                                 XmNtraversalOn , True ,
                               NULL ) ;

   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

   rc = XtVaCreateWidget( "AFNI" , xmRowColumnWidgetClass , MAIN_rc ,
                            XmNpacking     , XmPACK_TIGHT ,
                            XmNorientation , XmHORIZONTAL ,
                            XmNtraversalOn , True ,
                          NULL ) ;

   lab = XtVaCreateManagedWidget( "AFNI" , xmLabelWidgetClass , rc ,
                                    LABEL_ARG( "Magn. " ) ,
                                    XmNmarginHeight, 0 ,
                                    XmNmarginWidth , 0 ,
                                  NULL ) ;

   MAGN_scale = XtVaCreateManagedWidget( "AFNI" , xmScaleWidgetClass , rc ,
                                            XmNminimum       , 0 ,
                                            XmNmaximum       , 100 ,
                                            XmNvalue         , 0 ,
                                            XmNwidth         , P_swide ,
                                            XmNshowValue     , True ,
                                            XmNscaleMultiple , 10 ,
                                            XmNorientation   , XmHORIZONTAL ,
                                            XmNtraversalOn , True ,
                                         NULL ) ;

   XtAddCallback( MAGN_scale , XmNvalueChangedCallback , PH_scale_CB , NULL ) ;
   XtManageChild( rc ) ;

   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

   rc = XtVaCreateWidget( "AFNI" , xmRowColumnWidgetClass , MAIN_rc ,
                            XmNpacking     , XmPACK_TIGHT ,
                            XmNorientation , XmHORIZONTAL ,
                            XmNtraversalOn , True ,
                          NULL ) ;

   lab = XtVaCreateManagedWidget( "AFNI" , xmLabelWidgetClass , rc ,
                                    LABEL_ARG( "Phase " ) ,
                                    XmNmarginHeight, 0 ,
                                    XmNmarginWidth , 0 ,
                                  NULL ) ;

   PHASE_scale = XtVaCreateManagedWidget( "AFNI" , xmScaleWidgetClass , rc ,
                                            XmNminimum       , 0 ,
                                            XmNmaximum       , 100 ,
                                            XmNvalue         , 0 ,
                                            XmNwidth         , P_swide ,
                                            XmNshowValue     , True ,
                                            XmNscaleMultiple , 10 ,
                                            XmNorientation   , XmHORIZONTAL ,
                                            XmNtraversalOn , True ,
                                         NULL ) ;

   XtAddCallback( PHASE_scale , XmNvalueChangedCallback , PH_scale_CB , NULL ) ;
   XtManageChild( rc ) ;

   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

   XtManageChild( MAIN_rc ) ;
   XtRealizeWidget( MAIN_shell ) ; NI_sleep(1) ;

#if 0
   XtVaSetValues( MAIN_rc     , XmNwidth , P_swide , NULL ) ;
   XtVaSetValues( MAGN_scale  , XmNwidth , P_swide , NULL ) ;
   XtVaSetValues( PHASE_scale , XmNwidth , P_swide , NULL ) ;
#endif

   XtVaSetValues( MAIN_shell ,
                    XmNmwmDecorations, MWM_DECOR_BORDER | MWM_DECOR_TITLE | MWM_DECOR_MENU ,
                    XmNmwmFunctions  , MWM_FUNC_MOVE | MWM_FUNC_CLOSE ,
                    XmNtitle         , "Xphace Controls" ,
                  NULL ) ;

   (void) XtAppAddTimeOut( MAIN_app , 1234 , PH_startup_timeout_CB , NULL ) ;
   XtAppMainLoop( MAIN_app ) ;
   exit(0) ;
}
예제 #28
0
  return ((unsigned short)((XmDisplayInfo *)
	   (dd->display.displayInfo))->resetFocusFlag & mask);
}


void 
_XmSetFocusFlag(Widget w,
		unsigned int mask,
#if NeedWidePrototypes
		int value)
#else
     		Boolean value)
#endif /* NeedWidePrototypes */
{
  XmDisplay dd = (XmDisplay)XmGetXmDisplay(XtDisplay(w));

  if (value)
     ((XmDisplayInfo *)
	 (dd->display.displayInfo))->resetFocusFlag |= mask;
  else
     ((XmDisplayInfo *)
	 (dd->display.displayInfo))->resetFocusFlag &= ~mask;
}
     

static Boolean 
UpdatePointerData(Widget w,
		  XEvent *event)
{
  XmFocusData focusData;
예제 #29
0
// Find an existing, or create a new, XFontStruct
// based on this wxFont and the given scale. Append the
// font to list in the private data for future reference.
wxXFont* wxFont::GetInternalFont(double scale, WXDisplay* display) const
{
    if ( !Ok() )
        return NULL;

    long intScale = long(scale * 100.0 + 0.5); // key for wxXFont
    int pointSize = (M_FONTDATA->m_pointSize * 10 * intScale) / 100;

    // search existing fonts first
    wxList::compatibility_iterator node = M_FONTDATA->m_fonts.GetFirst();
    while (node)
    {
        wxXFont* f = (wxXFont*) node->GetData();
        if ((!display || (f->m_display == display)) && (f->m_scale == intScale))
            return f;
        node = node->GetNext();
    }

    // not found, create a new one
    wxString xFontSpec;
    XFontStruct *font = (XFontStruct *)
                        wxLoadQueryNearestFont(pointSize,
                                               M_FONTDATA->m_family,
                                               M_FONTDATA->m_style,
                                               M_FONTDATA->m_weight,
                                               M_FONTDATA->m_underlined,
                                               wxT(""),
                                               M_FONTDATA->m_encoding,
                                               &xFontSpec);

    if ( !font )
    {
        wxFAIL_MSG( wxT("Could not allocate even a default font -- something is wrong.") );

        return NULL;
    }

    wxXFont* f = new wxXFont;
#if wxMOTIF_NEW_FONT_HANDLING
    XFreeFont( (Display*) display, font );
#else
    f->m_fontStruct = (WXFontStructPtr)font;
#endif
    f->m_display = ( display ? display : wxGetDisplay() );
    f->m_scale = intScale;

#if wxMOTIF_USE_RENDER_TABLE
    XmRendition rendition;
    XmRenderTable renderTable;
    Arg args[5];
    int count = 0;

#if wxMOTIF_NEW_FONT_HANDLING
    char* fontSpec = wxStrdup(xFontSpec.mb_str());
    XtSetArg( args[count], XmNfontName, fontSpec ); ++count;
    XtSetArg( args[count], XmNfontType, XmFONT_IS_FONTSET ); ++count;
#else
    XtSetArg( args[count], XmNfont, font ); ++count;
#endif
    XtSetArg( args[count], XmNunderlineType,
              GetUnderlined() ? XmSINGLE_LINE : XmNO_LINE ); ++count;
    rendition = XmRenditionCreate( XmGetXmDisplay( (Display*)f->m_display ),
                                   (XmStringTag)"",
                                   args, count );
    renderTable = XmRenderTableAddRenditions( NULL, &rendition, 1,
                                              XmMERGE_REPLACE );

    f->m_renderTable = (WXRenderTable)renderTable;
    f->m_rendition = (WXRendition)rendition;
    wxASSERT( f->m_renderTable != NULL );
#else // if !wxMOTIF_USE_RENDER_TABLE
    f->m_fontList = XmFontListCreate ((XFontStruct*) font, XmSTRING_DEFAULT_CHARSET);
    wxASSERT( f->m_fontList != NULL );
#endif

    M_FONTDATA->m_fonts.Append(f);

    return f;
}
예제 #30
0
파일: DragBS.c 프로젝트: att/uwin
/*
 * write the atoms table out to the drag window
 */
static void
write_atoms_table(Display *display, XmDndAtomsTable tbl)
{
    char atoms[1000];
    XmDndAtoms atoms_rec;
    XmDndBufMgrRec bmgr;
    Atom pa;
    int i;
    Window win;

    DEBUGOUT(_LtDebug0(__FILE__, NULL, "%s:write_atoms_table(%d)\n",
		      __FILE__, __LINE__));

    if (tbl == NULL)
    {
	_XmWarning((Widget)XmGetXmDisplay(display),
		   "No DRAG_ATOMS to write to DRAG_WINDOW.");

	return;
    }

    atoms_rec.byte_order = _XmByteOrder();
    atoms_rec.protocol_version = DND_PROTOCOL_VERSION;
    atoms_rec.num_atoms = tbl->num_entries;

    bmgr.atoms = atoms;
    bmgr.atom_ptr = atoms;
    bmgr.atom_start = NULL;
    bmgr.atom_size = 0;
    bmgr.atom_avail = 1000;

    _XmWriteDragBuffer(&bmgr, False, (char *)&atoms_rec, sizeof(XmDndAtoms));

    for (i = 0; i < tbl->num_entries; i++)
    {
	_XmWriteDragBuffer(&bmgr, False, (char *)&tbl->entries[i],
			   sizeof(XmDndAtomsTableEntryRec));

    }

    ((XmDndAtoms *) (bmgr.atoms))->data_size = bmgr.atom_size;

    pa = XmInternAtom(display, _XA_MOTIF_DRAG_ATOMS, False);

    win = get_drag_window(display);

    begin_protection(display, win);

    XChangeProperty(display, win, pa, pa, 8, PropModeReplace,
		    (unsigned char *)bmgr.atoms, bmgr.atom_size);

    if (bmgr.atoms != bmgr.atom_ptr)
    {
	XtFree(bmgr.atoms);
    }

    end_protection(display);

    if (bad_window)
    {
	_XmWarning((Widget)XmGetXmDisplay(display),
		   "Bad window writing DRAG_ATOMS on DRAG_WINDOW.");
    }
}