Beispiel #1
0
//
//
//  This is a fix of XmCreateFormDialog() which causes memory fault
//  on SGI indigo with Motif 1.1 and X11R4.
//  The original code was copied from Xm/Form.c.
//  NOTE:  This function creates a form contained by a shell which
//         takes popup/popdownCallback resources BUT minWidth/Height.
//
// FIXME: We may use different methods to create a FormDialog
// 	  on different platforms(by #ifdef) if neccesary.
//	  Right now I just use XmUtility:CreateFormDialog(),
//	  hoping it's OK on all platforms.
// 
Widget Dialog::CreateMainForm(Widget parent, String name, 
                              ArgList arglist, Cardinal argcount)
{
#ifdef XmFormDialogWorks
   return XmCreateFormDialog(parent,name,arglist,argcount);
#else
   Widget form_shell;
   Widget form;
   Arg shell_arglist[2];
   int shell_argcount = 0;
   char buffer[256];

   /*  Create a pop-up shell for the form box.  */

   sprintf(buffer,"%sPopup",name);
   XtSetArg (shell_arglist[0], XmNallowShellResize, True);
   /* This function causes problem on indigo.
    * form_shell = XmCreateDialogShell (parent, buffer,
    *                                 shell_arglist, 1);
    */
   /* Use the following instead of the above */
   form_shell = XtCreateWidget(buffer, xmDialogShellWidgetClass,
                                parent, shell_arglist, 1);

   /*  Create the widget  */

   form = XtCreateWidget (name, xmFormWidgetClass,
                          form_shell, arglist, argcount);
   XtAddCallback (form, XmNdestroyCallback, (XtCallbackProc)DestroyParentCB, NULL);
   return form;
#endif // XmFormDialogWorks

}
Beispiel #2
0
Stopwatch_display::Stopwatch_display (Widget &parent)
{
  // Instantiate the  sub-components of the Stopwatch_display
  this->frame_ = XtCreateWidget ("frame",
                                 xmFrameWidgetClass,
                                 parent,
                                 0,
                                 0);

  this->label_ = XtCreateWidget ("label",
                                 xmLabelWidgetClass,
                                 this->frame_,
                                 0,
                                 0);
}
Beispiel #3
0
Datei: DrawnB.c Projekt: att/uwin
Widget
XmCreateDrawnButton(Widget parent, char *name,
		    Arg *arglist, Cardinal argcount)
{
    return XtCreateWidget(name, xmDrawnButtonWidgetClass, parent,
			  arglist, argcount);
}
Widget ColormapEditor::createWorkArea(Widget parent)
{
    Arg    arg[8];
    int    n;

    ASSERT(parent);

    //
    // Create the outer and inner frame.
    //
    n = 0;
    XtSetArg(arg[n], XmNresizePolicy,    XmRESIZE_NONE);
    n++;
    this->colormapEditor = XtCreateWidget("editor", xmColorMapEditorWidgetClass,
                                          parent, arg, n);

    //
    // Make sure context sensitive help works.
    //
    this->installComponentHelpCallback(this->colormapEditor);


    XtAddCallback(this->colormapEditor,
                  XmNactivateCallback,
                  (XtCallbackProc)ColormapEditor_ActiveCB,
                  (XtPointer)this);

    //
    // Return the topmost widget of the work area.
    //
    return this->colormapEditor;
}
Beispiel #5
0
/* ARGSUSED */
static void 
SecondaryObjectCreate(
        Widget req,
        Widget new_w,
        ArgList args,
        Cardinal *num_args )
{
    XmBaseClassExt              *cePtr;
    Arg                         myArgs[1];
    ArgList                     mergedArgs;

    XtSetArg(myArgs[0] ,XmNlogicalParent, new_w);

    if (*num_args)
       mergedArgs = XtMergeArgLists(args, *num_args, myArgs, XtNumber(myArgs));
    else
       mergedArgs = myArgs;


    cePtr = _XmGetBaseClassExtPtr(XtClass(new_w), XmQmotif);
    (void) XtCreateWidget(XtName(new_w),
                         (*cePtr)->secondaryObjectClass,
			 XtParent(new_w) ? XtParent(new_w) : new_w,
			 mergedArgs, *num_args + 1);

    if (mergedArgs != myArgs)
      XtFree( (char *) mergedArgs);
}
Beispiel #6
0
/****************************************************************
 * Create an instance of the widget
 ****************/
Widget 
XmCreateCommand(
        Widget parent,
        String name,
        ArgList al,
        Cardinal ac )
{
    Widget   w;
    ArgList  argsNew;

    /* add dialogType to arglist and force to XmDIALOG_COMMAND... */
    /* big time bad stuff will happen if they use prompt type...  */
    /* (like, no list gets created, but used all through command) */

    /*  allocate arglist, copy args, add dialog type arg */
    argsNew = (ArgList) XtMalloc (sizeof(Arg) * (ac + 1));
    memcpy( argsNew, al, sizeof(Arg) * ac);
    XtSetArg (argsNew[ac], XmNdialogType, XmDIALOG_COMMAND);  ac++;

    /*  create Command, free argsNew, return */
    w = XtCreateWidget (name, xmCommandWidgetClass, parent, argsNew, ac);
    XtFree ((char *) argsNew);

    return (w);
}
Beispiel #7
0
int
main(int argc, char *argv[])
{
    XtAppContext app;
    Widget shell, w;
    void *before;
    void *after;
    int iter = 0;
    int diff = 0;
    int total = 0;

    shell = XtAppInitialize(&app, "Test", NULL, 0,
			    &argc, argv, NULL, NULL, 0);
    while (iter < 10000)
    {
	before = sbrk((ptrdiff_t) 0);
	w = XtCreateWidget("name", xmScrollBarWidgetClass, shell, NULL, 0);
	XtDestroyWidget(w);
	after = sbrk((ptrdiff_t) 0);
	if ((int)((char *)after - (char *)before) > 0)
	{
	    if (iter != 0)
	    {
	      /* printf("%i %i %p %i\n", iter, iter - diff, after -
		 before, (after - before) / (iter - diff)); */
		total += (int)((char *)after - (char *)before);
	    }
	    diff = iter;
	}
	iter++;
    }
    printf("leaking %i bytes per Create/Destroy\n", total / iter);
    exit((int)(total / iter));
}
Beispiel #8
0
Widget
XmCreatePanner(Widget parent, String name,
	       ArgList args, Cardinal num_args)
{
    return(XtCreateWidget(name, xmPannerWidgetClass,
			  parent, args, num_args));
}
Beispiel #9
0
/*ARGSUSED*/
void
ConfigError(void)
{
    static int first = 1;

    if (first) {
	Widget command;

	errcurrent = XtCreateWidget("error", formWidgetClass,
			 	     configp, NULL, 0);
	(void) XtCreateManagedWidget("label", labelWidgetClass,
				      errcurrent, NULL, 0);
	command = XtCreateManagedWidget("command", commandWidgetClass,
					errcurrent, NULL, 0);
	XtAddCallback(command, XtNcallback, ErrorCallback, NULL);

	XtRealizeWidget(errcurrent);
    }

    oldcurrent = current;
    XtChangeManagedSet(&current, 1, NULL, NULL, &errcurrent, 1);
    current = errcurrent;

    XtSetSensitive(ok, False);
}
Beispiel #10
0
/*-------------------------------------------------------------------------*/
static Widget CreateMatrix(
Widget parent,
String name,
ArgList arglist,
Cardinal argcount 
) {
   Widget matrix;
   Widget textChild;
   
   matrix = XtCreateWidget(name, xbaeMatrixWidgetClass, parent,
                              arglist, argcount);

#ifndef TEXTCHILD_BUG
   XtVaGetValues(matrix, XmNtextField, &textChild, NULL);
   XtAddCallback(textChild, XmNlosingFocusCallback,
                  qmonMatrixLoseFocus, (XtPointer) matrix);
#endif
   XtAddCallback(matrix, XmNtraverseCellCallback, 
                     qmonMatrixTraverse, NULL);
   XtAddCallback(matrix, XmNselectCellCallback, 
                     qmonMatrixSelect, NULL);
   /*
   ** register callback procedures
   */
   XmtVaRegisterCallbackProcedures(
         "DeleteLines", DeleteLines, XtRWidget,
         "ColumnZeroNoEdit", ColumnZeroNoEdit, NULL,
         "ColumnNoEdit", ColumnNoEdit, NULL,
         NULL);

   return matrix;
}
Beispiel #11
0
static Widget
xlw_create_menubar (widget_instance *instance)
{
  Widget widget;
  Arg al[5];
  int ac = 0;

  XtSetArg (al[ac], XtNmenu, instance->info->val); ac++;
#ifdef emacs
  XtSetArg (al[ac], XtNshowGrip, 0); ac++;
  XtSetArg (al[ac], XtNresizeToPreferred, 1); ac++;
  XtSetArg (al[ac], XtNallowResize, 1); ac++;
#endif

  /* This used to use XtVaCreateWidget, but an old Xt version
     has a bug in XtVaCreateWidget that frees instance->info->name.  */
  widget
    = XtCreateWidget (instance->info->name, xlwMenuWidgetClass,
		      instance->parent, al, ac);

  XtAddCallback (widget, XtNopen, pre_hook, (XtPointer)instance);
  XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance);
  XtAddCallback (widget, XtNleaveCallback, leave_hook, (XtPointer)instance);
  XtAddCallback (widget, XtNenterCallback, enter_hook, (XtPointer)instance);
  return widget;
}
Beispiel #12
0
static Widget
CreateScrollBar(XtermWidget xw, int x, int y, int height)
{
    Widget scrollWidget;

#ifdef MOTIF
    static Arg argList[] = {
        {XmNx,		(XtArgVal) 0},
        {XmNy,		(XtArgVal) 0},
        {XmNheight,		(XtArgVal) 0},
        /* motif widget doesn't have reverse video garbage */
        {XmNorientation,	(XtArgVal) XmVERTICAL},
        {XmNsliderMark,	(XtArgVal) XmNONE},
        {XmNborderWidth,	(XtArgVal) 1},
    };

    argList[0].value = (XtArgVal) x;
    argList[1].value = (XtArgVal) y;
    argList[2].value = (XtArgVal) height;

    scrollWidget = XtCreateWidget("scrollbar", xmScrollBarWidgetClass,
                                  (Widget)xw, argList, XtNumber(argList));
    XtAddCallback (scrollWidget, XmNvalueChangedCallback, ScrollTextTo, 0);
    XtAddCallback (scrollWidget, XmNdragCallback, ScrollTextTo, 0);
#else
    static Arg argList[] = {
        {XtNx,		(XtArgVal) 0},
        {XtNy,		(XtArgVal) 0},
        {XtNheight,		(XtArgVal) 0},
        {XtNreverseVideo,	(XtArgVal) 0},
        {XtNorientation,	(XtArgVal) XtorientVertical},
        {XtNborderWidth,	(XtArgVal) 1},
    };

    argList[0].value = (XtArgVal) x;
    argList[1].value = (XtArgVal) y;
    argList[2].value = (XtArgVal) height;
    argList[3].value = (XtArgVal) xw->misc.re_verse;

    scrollWidget = XtCreateWidget("scrollbar", scrollbarWidgetClass,
                                  (Widget)xw, argList, XtNumber(argList));
    XtAddCallback (scrollWidget, XtNscrollProc, ScrollTextUpDownBy, 0);
    XtAddCallback (scrollWidget, XtNjumpProc, ScrollTextTo, 0);
#endif /* MOTIF */
    return (scrollWidget);
}
Beispiel #13
0
Widget
XltCreateFilePicker(Widget parent,
		   char *name,
		   Arg *arglist,
		   Cardinal argCount)
{
	return XtCreateWidget(name, xltFilePickerWidgetClass, parent, arglist, argCount);
}
Beispiel #14
0
Widget
XltCreateNumEntry(Widget parent,
		  char *name,
		  Arg *arglist,
		  Cardinal argCount)
{
    return XtCreateWidget(name, xrwsNumEntryWidgetClass, parent, arglist, argCount);
}
Beispiel #15
0
Widget XmdsCreateExprField(Widget parent,char *name,ArgList args,Cardinal argcount)
{
  Widget widg;
  xmdsExprClassRec.core_class.initialize = InitializeExprField;
  widg = XtCreateWidget(name,(WidgetClass)&xmdsExprClassRec,parent,args,argcount);
  xmdsExprClassRec.core_class.initialize = InitializeExpr;
  return widg;
}
Beispiel #16
0
Widget
XltCreateHost(Widget parent,
	      char *name,
	      Arg *arglist,
	      Cardinal argCount)
{
    return XtCreateWidget(name, xrwsHostWidgetClass, parent, arglist, argCount);
}
Beispiel #17
0
/*
 *   NAME:    GuiCreateWorkArea
 *   FUNCTION: 
 *   RETURNS:  
 */
Widget
GuiCreateWorkArea(
   Widget parent, 
   char *name, 
   ArgList arglist, 
   Cardinal argcount)
{
   return XtCreateWidget(name, workAreaWidgetClass, parent, arglist, argcount);
}
Beispiel #18
0
Widget
XmLCreateTree(Widget parent,
              char *name,
              ArgList arglist,
              Cardinal argcount)
	{
	return XtCreateWidget(name, xmlTreeWidgetClass, parent,
		arglist, argcount);
	}
Beispiel #19
0
Widget
XmCreateCommand(Widget parent,
		char *name,
		Arg *argList,
		Cardinal argcount)
{
    return XtCreateWidget(name, xmCommandWidgetClass, parent,
			  argList, argcount);
}
Beispiel #20
0
/* ARGSUSED */
static void
XawVendorShellInitialize(Widget req, Widget cnew,
			 ArgList args, Cardinal *num_args)
{
    XtAddEventHandler(cnew, (EventMask) 0, TRUE, _XEditResCheckMessages, NULL);
    XtAddEventHandler(cnew, (EventMask) 0, TRUE, XmuRegisterExternalAgent, NULL);
    XtCreateWidget("shellext", xawvendorShellExtWidgetClass,
		   cnew, args, *num_args);
}
Beispiel #21
0
status
ws_create_window(PceWindow sw, PceWindow parent)
{ Widget w;
  DisplayObj d = getDisplayGraphical((Graphical)sw);

					/* create the widget */
  { Arg args[8];
    Cardinal n = 0;
    int pen = valInt(sw->pen);

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Actually, it appears Xt is ignoring the geometry parameters.  Hence,
ws_realise_frame() sends ->geometry to all windows.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

    XtSetArg(args[n], XtNx,	      valInt(sw->area->x)); n++;
    XtSetArg(args[n], XtNy,	      valInt(sw->area->y)); n++;
    XtSetArg(args[n], XtNwidth,       valInt(sw->area->w) - 2*pen); n++;
    XtSetArg(args[n], XtNheight,      valInt(sw->area->h) - 2*pen); n++;
    XtSetArg(args[n], XtNborderWidth, pen); n++;
    XtSetArg(args[n], XtNinput,       True); n++;
    if ( instanceOfObject(sw->background, ClassColour) )
    { XtSetArg(args[n], XtNbackground, getPixelColour(sw->background, d));
      n++;
    } else
    { Pixmap pm = (Pixmap) getXrefObject(sw->background, d);

      XtSetArg(args[n], XtNbackgroundPixmap, pm); n++;
    }

    DEBUG(NAME_create, Cprintf("Calling XtCreateWidget ..."));
    w = XtCreateWidget(strName(sw->name),
		       canvasWidgetClass,
		       isDefault(parent) ? widgetFrame(sw->frame)
					 : widgetWindow(parent),
		       args, n);
    DEBUG(NAME_create, Cprintf("Widget = %p\n", w));
  }

  if ( !w )
    return errorPce(w, NAME_createFailed);

  setWidgetWindow(sw, w);

  XtAddCallback(w, XtNeventCallback,   event_window, sw);
  XtAddCallback(w, XtNexposeCallback,  expose_window, sw);
  XtAddCallback(w, XtNresizeCallback,  resize_window, sw);
  XtAddCallback(w, XtNdestroyCallback, destroy_window, sw);

  if ( notDefault(parent) )		/* make a sub-window */
  { XtManageChild(w);
    send(sw, NAME_displayed, ON, EAV);
  }

  succeed;
}
Beispiel #22
0
/************************************************************************
 *									*
 * XmCreateMainWindow -                                         	*
 *									*
 ************************************************************************/
Widget 
XmCreateMainWindow(
        Widget parent,
        char *name,
        ArgList args,
        Cardinal argCount )
{
    return (XtCreateWidget(name, xmMainWindowWidgetClass, parent, 
			     args, argCount ) );
}
Beispiel #23
0
/*****
* Name: 		XmCreateBalloon
* Return Type: 	Widget
* Description: 	creates an XmBalloonWidget.
* In: 
*	parent:		parent for this new widget;
*	name:		name for the newly created widget;
*	argslist:	list of arguments to be used for creating this widget;
*	argcount:	size of arglist;
* Returns:
*	the ID of the newly created widget on success, NULL on failure.
*****/
Widget
XmCreateBalloon(Widget parent, String name, ArgList arglist, Cardinal argcount)
{
	if(parent)
		return(XtCreateWidget(name, xmBalloonWidgetClass, parent,
			arglist, argcount));
	_XmHTMLWarning(__WFUNC__(NULL, "XmCreateBalloon"), "XmBalloon requires "
		"a non-NULL parent");
	return(NULL);
}
Beispiel #24
0
Widget 
XmCreateArrowButton(
        Widget parent,
        char *name,
        ArgList arglist,
        Cardinal argcount )
{
  return XtCreateWidget(name, xmArrowButtonWidgetClass, parent, 
			arglist, argcount);
}
Beispiel #25
0
Widget
XmCreateCommandDialog(Widget parent, char *name,
		      Arg *arglist, Cardinal argcount)
{
    char *s;
    Widget d;

    s = _XmMakeDialogName(name);

#if 0
    d = XtCreateWidget(s, xmDialogShellWidgetClass, parent, arglist, argcount);
#else
    d = XmCreateDialogShell(parent, s, arglist, argcount);
#endif

    XtFree(s);

    return XtCreateWidget(name, xmCommandWidgetClass, d, arglist, argcount);
}
Beispiel #26
0
Widget 
ViewMsgDialog::createWorkArea ( Widget shell )
{

    Widget form = XtCreateWidget(
			"Work_Area", xmFormWidgetClass,
			shell, NULL, 0);

    _main = XtVaCreateManagedWidget ("separateViewWindow", 
		xmMainWindowWidgetClass,
		form, 
		XmNleftAttachment, XmATTACH_FORM,
		XmNtopAttachment, XmATTACH_FORM,
		XmNbottomAttachment, XmATTACH_FORM,
		XmNrightAttachment, XmATTACH_FORM,
		NULL);

    Widget form1 = XtCreateWidget("Work_Area", xmFormWidgetClass,
 				  _main, NULL, 0);
    printHelpId("form", form1);
    /* add help callback */
    // XtAddCallback(form1, XmNhelpCallback, HelpCB, helpId);


    my_editor = new DtMailEditor(form1, this);
    my_editor->initialize();

    my_editor->attachArea()->setOwnerShell(this);

    Widget wid = my_editor->container();

    XtVaSetValues( wid,
  	XmNrightAttachment,XmATTACH_FORM, 
  	XmNleftAttachment,XmATTACH_FORM, 
  	XmNtopAttachment,XmATTACH_FORM, 
  	XmNbottomAttachment, XmATTACH_FORM,
  	NULL );

    XtManageChild(form1);

    return form;
}				 
Widget CurveCreateNav( Widget parent, char *name, ArgList args, int argCount,
	Widget main_curve)
{
  CurveWidget w;

  w = (CurveWidget) XtCreateWidget( name, curveWidgetClass, parent, args, argCount);
  w->curve.is_navigator = 1;
  w->curve.curve_ctx = 0;
  w->curve.main_curve_widget = main_curve;
  return (Widget) w;
}
Beispiel #28
0
/*ARGSUSED*/
static void
XawTreeInitialize(Widget grequest, Widget gnew,
		  ArgList args, Cardinal *num_args)
{
    TreeWidget request = (TreeWidget) grequest, cnew = (TreeWidget) gnew;
    Arg arglist[2];

    /*
     * Make sure the widget's width and height are 
     * greater than zero.
     */
    if (request->core.width <= 0) cnew->core.width = 5;
    if (request->core.height <= 0) cnew->core.height = 5;

    /*
     * Set the padding according to the orientation
     */
    if (request->tree.hpad == 0 && request->tree.vpad == 0) {
	if (IsHorizontal (request)) {
	    cnew->tree.hpad = TREE_HORIZONTAL_DEFAULT_SPACING;
	    cnew->tree.vpad = TREE_VERTICAL_DEFAULT_SPACING;
	} else {
	    cnew->tree.hpad = TREE_VERTICAL_DEFAULT_SPACING;
	    cnew->tree.vpad = TREE_HORIZONTAL_DEFAULT_SPACING;
	}
    }

    /*
     * Create a graphics context for the connecting lines.
     */
    cnew->tree.gc = get_tree_gc (cnew);

    /*
     * Create the hidden root widget.
     */
    cnew->tree.tree_root = (Widget) NULL;
    XtSetArg(arglist[0], XtNwidth, 1);
    XtSetArg(arglist[1], XtNheight, 1);
    cnew->tree.tree_root = XtCreateWidget ("root", widgetClass, gnew,
					  arglist,TWO);

    /*
     * Allocate the array used to hold the widest values per depth
     */
    cnew->tree.largest = NULL;
    cnew->tree.n_largest = 0;
    initialize_dimensions (&cnew->tree.largest, &cnew->tree.n_largest, 
			   TREE_INITIAL_DEPTH);

    /*
     * make sure that our gravity is one of the acceptable values
     */
    check_gravity (cnew, WestGravity);
} 
Beispiel #29
0
Widget GrowCreateNav( Widget parent, char *name, ArgList args, int argCount,
	Widget main_grow)
{
  GrowWidget w;

  w = (GrowWidget) XtCreateWidget( name, growWidgetClass, parent, args, argCount);
  w->grow.is_navigator = 1;
  w->grow.grow_ctx = 0;
  w->grow.main_grow_widget = main_grow;
  return (Widget) w;
}
Widget ColPalCreateNav( Widget parent, char *name, ArgList args, int argCount,
	Widget main_colpal)
{
  ColPalWidget w;

  w = (ColPalWidget) XtCreateWidget( name, colpalWidgetClass, parent, args, argCount);
  w->colpal.is_navigator = 1;
  w->colpal.colpal_ctx = 0;
  w->colpal.main_colpal_widget = main_colpal;
  return (Widget) w;
}