Example #1
0
//
// create a LABEL + Edit line + an apply button
//
void
InvAnnotationEditor::createEditLine(Widget parent)
{
    Arg args[5];
    int i(0);

    Widget rc = XmCreateRowColumn(parent, (char *)"rc", NULL, 0);
    //    XtSetArg(args[i], XmNlabelString, descStr); i++;

    i = 0;
    XmString descStr = XmStringCreateSimple((char *)"enter annotation text:");
    XtSetArg(args[i], XmNlabelString, descStr);
    i++;
    Widget description = XmCreateLabel(rc, (char *)"description", args, 1);

    mTextField_ = XmCreateTextField(rc, (char *)"tf", NULL, 0);

    Widget applyBut = XmCreatePushButton(rc, (char *)"Apply", NULL, 0);

    XtAddCallback(applyBut, XmNactivateCallback, editApplyCB, (XtPointer) this);

    // manage all
    XtManageChild(rc);
    XtManageChild(description);
    XtManageChild(mTextField_);
    XtManageChild(applyBut);
}
Example #2
0
int
main(int argc, char **argv)
{
	Widget		toplevel, spb, bb, list, tf;
	XtAppContext	app;
	XmString	item;
	Arg			al[10];
	int			ac;

	XtSetLanguageProc(NULL, NULL, NULL);

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

	bb = XmCreateForm(toplevel, "bb", NULL, 0);
	XtManageChild(bb);

	XtRealizeWidget(toplevel);

	ac = 0;
	spb = XmCreateSpinBox(bb, "spinbox", al, ac);
	XtAddCallback(spb, XmNvalueChangedCallback, ModifyVerify, NULL);

	ac = 0;
	XtSetArg(al[ac], XmNspinBoxChildType, XmNUMERIC); ac++;
	XtSetArg(al[ac], XmNdecimalPoints, 1); ac++;
	tf = XmCreateTextField(spb, "tf", al, ac);
	XtManageChild(tf);

	XtManageChild(spb);

	LessTifTestMainLoop(toplevel);

	exit(0);
}
Example #3
0
Widget create_labeled_textfield(Widget *parent, char *label_string) {
	Widget form_widget;
	Widget label_widget;
	Widget text_widget;
	Arg args[8];
	int n = 0;

	XtSetArg(args[n], XmNfractionBase, 10); n++;
	XtSetArg(args[n], XmNnavigationType, XmNONE); n++;
	form_widget = XmCreateForm(*parent, "form", args, n);

	n = 0;
	XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
	XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
	XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
	XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION); n++;
	XtSetArg(args[n], XmNrightPosition, 3); n++;
	XtSetArg(args[n], XmNalignment, XmALIGNMENT_END); n++;
	XtSetArg(args[n], XmNnavigationType, XmNONE); n++;
	label_widget = XmCreateLabelGadget(form_widget, label_string, args, n);
	XtManageChild(label_widget);

	n = 0;
	XtSetArg(args[n], XmNtraversalOn, True); n++;
	XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
	XtSetArg(args[n], XmNleftPosition, 4); n++;
	XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
	XtSetArg(args[n], XmNnavigationType, XmTAB_GROUP); n++;
	text_widget = XmCreateTextField(form_widget, "text", args, n);
	XtManageChild(text_widget);

	XtManageChild(form_widget);

	return text_widget;
}
Example #4
0
Widget CreateInputField ( Widget parent )
{
     Widget text = XmCreateTextField ( parent, "input", NULL, 0 );

    XtManageChild ( text );

    return ( text );
}
Example #5
0
/* -------------------------------------------------------------------- */
static void CreatePreferences()
{
  int		i;
  Cardinal	n;
  Arg		args[2];
  Widget	frame, RC, plRC, label, b[3];

  PreferShell = XtCreatePopupShell("prefParmsShell",
                   topLevelShellWidgetClass, AppShell, NULL, 0);

  PreferWindow = XmCreateRowColumn(PreferShell, (char *)"prefRC", NULL, 0);

  n = 0;
  frame = XmCreateFrame(PreferWindow, (char *)"prefFrame", args, n);
  XtManageChild(frame);

  n = 0;
  RC = XmCreateRowColumn(frame, (char *)"prefRC", args, n);

  for (i = 0; i < TOTAL_PREFERS; ++i)
    {
    plRC = XmCreateRowColumn(RC, (char *)"plRC", args, n);
    XtManageChild(plRC);

    sprintf(buffer, "prefer%d", i);
    label = XmCreateLabel(plRC, buffer, args, n);
    XtManageChild(label);

    prefText[i] = XmCreateTextField(plRC, (char *)"prefText", args, n);
    XtManageChild(prefText[i]);
    XtAddCallback(prefText[i], XmNlosingFocusCallback, ApplyPreferences, NULL);
    }


  /* Command buttons.
   */
  n = 0;
  frame = XmCreateFrame(PreferWindow, (char *)"buttonFrame", args, 0);
  XtManageChild(frame);

  n = 0;
  plRC = XmCreateForm(frame, (char *)"buttonRC", args, n);

  n = 0;
  b[0] = XmCreatePushButton(plRC, (char *)"dismissButton", args, n);
  XtAddCallback(b[0], XmNactivateCallback, DismissWindow, PreferWindow);

  n = 0;
  b[1] = XmCreatePushButton(plRC, (char *)"saveButton", args, n);
  XtAddCallback(b[1], XmNactivateCallback, SavePreferences, NULL);

  XtManageChildren(b, 2);

  XtManageChild(plRC);
  XtManageChild(RC);

}	/* END CREATEPREFERENCES */
Example #6
0
	int main(int argc, char *argv[])
	{
		int i, n;
		Arg args[10];
		XtAppContext app;
		Widget toplevel, rowcol, sep, button;
		XmString str_months[12];

		setlocale(LC_ALL, "");

		//建立顶级窗口
		toplevel = XtVaAppInitialize(&app, "Text", NULL, 0,
			&argc, argv, NULL, NULL);

		//建立rowcolumn 布局
		n = 0;
		XtSetArg(args[n], XmNpacking, XmPACK_TIGHT);   n++;
		rowcol = XmCreateRowColumn(toplevel, "rowcol", args, n);
		XtManageChild(rowcol);

		//建立输入条
		n = 0;
		XtSetArg(args[n], XmNvalue, "输入条");	n++;
		textf = XmCreateTextField(rowcol, "textf", args, n);
		XtManageChild(textf);
		//建立回调
		XtAddCallback(textf, XmNactivateCallback, 
			(XtCallbackProc)checkit, NULL);

		//建立输入区
		n = 0;
		XtSetArg(args[n], XmNrows, 10);				n++;
		XtSetArg(args[n], XmNcolumns, 40);			n++;
		XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT);	n++;
		XtSetArg(args[n], XmNvalue, "输入区域\n请测试");	n++;
		text = XmCreateScrolledText(rowcol, "text", args, n);
		//text = XmCreateText(rowcol, "text", args, n);
		XtManageChild(text);
		
		//建立分隔符
		sep = XmCreateSeparator(rowcol, "separator", NULL, 0);
		XtManageChild(sep);

		//建立一个普通按钮
		button = XmCreatePushButton(rowcol, 
			"打印输入条和文本区内容", NULL, 0);
		XtManageChild(button);
		XtAddCallback(button, XmNactivateCallback,
			(XtCallbackProc)checkit, NULL);

		//显示窗口
		XtRealizeWidget(toplevel);

		//进入事件循环
		XtAppMainLoop(app);

	}
Example #7
0
void
main (int argc, char **argv)
{
    Arg args[10];
    int n;

    CommonTestInit (argc, argv);

    n=0;
    Parent = XmCreateFrame (Shell1, "Frame", args, n);
    XtManageChild (Parent);

    n=0;
    XtSetArg (args[n], XmNarrowLayout, XmARROWS_FLAT_END); n++;
    XtSetArg (args[n], XmNrepeatDelay, 0); n++;
    XtSetArg (args[n], XmNarrowOrientation, XmHORIZONTAL); n++;
    SpinBox1 = XmCreateSpinBox (Parent, "SpinBox1", args, n);
    XtManageChild (SpinBox1);
    XtAddCallback (SpinBox1, XmNvalueChangedCallback, ValueChanged,
    (XtPointer)NULL);
    XtAddCallback (SpinBox1, XmNmodifyVerifyCallback, ModifyVerify,
    (XtPointer)0);


    n=0;
    XtSetArg (args[n], XmNspinBoxChildType, XmNUMERIC); n++;
    XtSetArg (args[n], XmNminimumValue, 1); n++;
    XtSetArg (args[n], XmNmaximumValue, 10); n++;
    XtSetArg (args[n], XmNincrementValue, 3); n++;
    XtSetArg (args[n], XmNposition, 2); n++;
    XtSetArg (args[n], XmNpositionType, XmPOSITION_INDEX); n++;
    TextF1 = XmCreateTextField (SpinBox1, "TextF1", args,n);
    XtManageChild (TextF1);

    XtRealizeWidget (Shell1);

    CommonPause();
    CommonPause();
   
    XtAddCallback( SpinBox1, XmNmodifyVerifyCallback, CrossedBound,
                   (XtPointer)0 );
    CommonPause();
    XtRemoveCallback( SpinBox1, XmNmodifyVerifyCallback, CrossedBound,
                      (XtPointer)0 );
    XtAddCallback( SpinBox1, XmNmodifyVerifyCallback, SetPosition,
                   (XtPointer)0 );
    CommonPause();
    XtRemoveCallback( SpinBox1, XmNmodifyVerifyCallback, SetPosition,
                      (XtPointer)0 );
    CommonPause();
    CommonPause();

    XtAppMainLoop (app_context);

    
}
Example #8
0
File: motif.c Project: E-LLP/QuIP
void make_text_field(QSP_ARG_DECL  Screen_Obj *sop)
{
#ifdef HAVE_MOTIF
	Arg al[5];
	int ac = 0;
	int w;

//fprintf(stderr,"make_text_field BEGIN\n");
	sop->so_frame = generic_frame(curr_panel->po_panel_obj,
		sop, XmSHADOW_IN);

	XtSetArg(al[ac], XmNeditable, TRUE); ac++;
	XtSetArg(al[ac], XmNrecomputeSize, FALSE); ac++;
	/* used to use full width of panel */
	//XtSetArg(al[ac], XmNwidth, PO_WIDTH(curr_panel)-30 ); ac++;
	/* Pick a width based on the length of the initial text - assume font width of 8 pixels? */

	w = 10+strlen(sop->so_content_text)*8;
//fprintf(stderr,"Using width of %d for string \"%s\"\n",w,sop->so_content_text);
	XtSetArg(al[ac], XmNwidth, w ); ac++;
	// Do we need to set the height explicitly???
	XtSetArg(al[ac], XmNheight, 32 ); ac++;

	XtSetArg(al[ac], XmNmaxLength, 40 ); ac++;

	// This generates a lot of warnings, not correct usage?
	//XtSetArg(al[ac], XmNvalue, (char *)sop->so_content_text ); ac++;

	sop->so_obj = XmCreateTextField(sop->so_frame, (char *)sop->so_name, al, ac);

	// The callback is called when we set the default value
	// if this is called after the callback is assigned.
	// So we set the value BEFORE assigning the callback...

	XmTextFieldSetString(sop->so_obj, (char *)sop->so_content_text );

//fprintf(stderr,"make_text_field:  obj = 0x%lx\n",(long)sop->so_obj);
//fprintf(stderr,"make_text_field:  adding text_func callback for value changed\n");
	XtAddCallback(sop->so_obj, XmNvalueChangedCallback, text_func, NULL);
	XtAddCallback(sop->so_obj, XmNlosingFocusCallback, text_func2, NULL);

	// the callback seems to be called right away?
	// Why?
	// This was commented out, but in that case the widget does not appear!?
	XtManageChild(sop->so_obj);

	// The callback is called when we set the default value
	// Let's try setting the value BEFORE assigning the callback...

	//XmTextFieldSetString(sop->so_obj, (char *)sop->so_content_text );

#endif /* HAVE_MOTIF */
}
Example #9
0
	int main(int argc, char *argv[])
	{
		int i, n;
		Arg args[10];
		XtAppContext app;
		Widget toplevel, rowcol, textf, text;
		XmString str_months[12];

		setlocale(LC_ALL, "");

		//建立顶级窗口
		toplevel = XtVaAppInitialize(&app, "Edit", NULL, 0,
			&argc, argv, NULL, NULL);

		//建立rowcolumn 布局
		n = 0;
		XtSetArg(args[n], XmNpacking, XmPACK_TIGHT);   n++;
		rowcol = XmCreateRowColumn(toplevel, "rowcol", args, n);
		XtManageChild(rowcol);

		//建立输入条
		n = 0;
		XtSetArg(args[n], XmNvalue, "输入条");	n++;
		textf = XmCreateTextField(rowcol, "textf", args, n);
		XtManageChild(textf);

		//建立文本区
		n = 0;
		XtSetArg(args[n], XmNrows, 10);				n++;
		XtSetArg(args[n], XmNcolumns, 40);			n++;
		XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT);	n++;
		XtSetArg(args[n], XmNwordWrap, True);			n++;
		XtSetArg(args[n], XmNvalue, "输入区域\n请测试");	n++;
		text = XmCreateScrolledText(rowcol, "text", args, n);
		XtManageChild(text);
		
		//显示窗口
		XtRealizeWidget(toplevel);

		//edit
		XmTextSetInsertionPosition(text, 3);
		XmTextInsert(text, 5, "测试插入");
		XmTextSetSelection(text, 5, 8, CurrentTime);
		XmTextCopy(text, CurrentTime);
		XmTextSetInsertionPosition(text, 1);
		XmTextPaste(text);
		

		//进入事件循环
		XtAppMainLoop(app);

	}
Example #10
0
main (int argc, char *argv[])
{
    Widget         toplevel, text_w, form, rowcol, label_w;
    XtAppContext   app;
    int            i;
    void           print_result(Widget, XtPointer, XtPointer);
    Arg            args[8];
    int            n;

    XtSetLanguageProc (NULL, NULL, NULL);
    toplevel = XtVaAppInitialize (&app, "Demos", NULL, 0, &argc, argv, NULL,     
                                    sessionShellWidgetClass, NULL);

    rowcol = XmCreateRowColumn (toplevel, "rowcol", NULL, 0);

    for (i = 0; i < XtNumber (labels); i++) {
        n = 0;
        XtSetArg (args[n], XmNfractionBase, 10);       n++;
        XtSetArg (args[n], XmNnavigationType, XmNONE); n++;
        form = XmCreateForm (rowcol, "form", args, n);

        n = 0;
        XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM);       n++;
        XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM);    n++;
        XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM);      n++;
        XtSetArg (args[n], XmNrightAttachment, XmATTACH_POSITION); n++;
        XtSetArg (args[n], XmNrightPosition, 3);                   n++;
        XtSetArg (args[n], XmNalignment, XmALIGNMENT_END);         n++;
        XtSetArg (args[n], XmNnavigationType, XmNONE);             n++;
        label_w = XmCreateLabelGadget (form, labels[i], args, n);
        XtManageChild (label_w);

        n = 0;
        XtSetArg (args[n], XmNtraversalOn, True);                 n++;
        XtSetArg (args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
        XtSetArg (args[n], XmNleftPosition, 4);                   n++;
        XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM);    n++;
        XtSetArg (args[n], XmNnavigationType, XmTAB_GROUP);       n++;
        text_w = XmCreateTextField (form, "text_w", args, n);
        XtManageChild (text_w);

        /* When user hits return, print the label+value of text_w */
        XtAddCallback (text_w, XmNactivateCallback, print_result, 
                            (XtPointer) labels[i]);
        XtManageChild (form);
    }

    XtManageChild (rowcol);
    XtRealizeWidget (toplevel);
    XtAppMainLoop (app);
}
Example #11
0
//a radio button to specify whether
//to use a reference part or not
void InvPartEditor::createReferenceButtons(Widget parent)
{
    Arg args[5];
    //Now the togglebutton and textfield for the reference part
    XtSetArg(args[0], XmNorientation, XmVERTICAL);
    Widget referencePartSelection = XtCreateManagedWidget("parent", xmRowColumnWidgetClass, parent, args, 1);
    Widget useReference = XmCreateToggleButton(referencePartSelection, (char *)"Use reference Part", NULL, 0);
    XtAddCallback(useReference, XmNvalueChangedCallback, useReferenceCB, (XtPointer) this);
    useReferenceButtons(this, false);
    XtManageChild(useReference);
    Widget referencedPartName = XmCreateTextField(referencePartSelection, (char *)"referencedPartname", NULL, 0);
    XtAddCallback(referencedPartName, XmNactivateCallback, referencePartNameCB, (XtPointer) this);
    XtManageChild(referencedPartName);
}
Example #12
0
int
main(int argc, char **argv)
{
	Widget		toplevel, nb, b, tf, cw;
	XtAppContext	app;
	Arg		al[10];
	int		ac;

	XtSetLanguageProc(NULL, NULL, NULL);

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

	ac = 0;
	XtSetArg(al[ac], XmNbindingType, XmSOLID); ac++;
	nb = XmCreateNotebook(toplevel, "notebook", al, ac);

	ac = 0;
	XtSetArg(al[ac], XmNnotebookChildType, XmPAGE); ac++;
	XtSetArg(al[ac], XmNpageNumber, 1); ac++;
	tf = XmCreateTextField(nb, "tf", al, ac);
	XtManageChild(tf);

	ac = 0;
	XtSetArg(al[ac], XmNnotebookChildType, XmPAGE); ac++;
	XtSetArg(al[ac], XmNpageNumber, 2); ac++;
	b = XmCreatePushButton(nb, "quit", al, ac);
	XtManageChild(b);
	XtAddCallback(b, XmNactivateCallback, Quit, NULL);

	ac = 0;
	XtSetArg(al[ac], XmNpageNumber, 1); ac++;
	b = XmCreatePushButton(nb, "Editor", al, ac);
	XtManageChild(b);

	ac = 0;
	XtSetArg(al[ac], XmNpageNumber, 2); ac++;
	b = XmCreatePushButton(nb, "Quit", al, ac);
	XtManageChild(b);

	XtManageChild(nb);

	XtRealizeWidget(toplevel);

	check_geometry(toplevel);

	LessTifTestMainLoop(toplevel);

	exit(0);
}
Example #13
0
static void
initialize(Widget request, Widget new_w, ArgList args, Cardinal *num_args)
{
#ifdef DEBUG
    printf("%s:initialize(%d) - %s %ix%i\n", __FILE__, __LINE__, 
    	XtName(new_w),
    	XtWidth(new_w), XtHeight(new_w));
#endif

    FilePicker_Label(new_w) = XmCreateLabel(new_w, XtName(new_w), args, *num_args);
    FilePicker_TextField(new_w) = XmCreateTextField(new_w, "TextField", args, *num_args);
    FilePicker_Button(new_w) = XltCreateBubbleButton(new_w, "Browse", args, *num_args);
    if (XtHeight(new_w) == 0)
    {
    	XtHeight(new_w) = XtHeight(FilePicker_Label(new_w)) > XtHeight(FilePicker_TextField(new_w)) ? XtHeight(FilePicker_Label(new_w)) : XtHeight(FilePicker_TextField(new_w));
    	XtHeight(new_w) = XtHeight(new_w) > XtHeight(FilePicker_Button(new_w)) ? XtHeight(new_w) : XtHeight(FilePicker_Button(new_w));
    }
    XtVaSetValues(FilePicker_Label(new_w),
    	XmNalignment, XmALIGNMENT_BEGINNING,
    	XmNtopAttachment, XmATTACH_FORM,
    	XmNleftAttachment, XmATTACH_FORM,
    	XmNrightAttachment, XmATTACH_WIDGET,
    	XmNrightWidget, FilePicker_TextField(new_w),
    	XmNbottomAttachment, XmATTACH_FORM,
    	NULL);
    XtVaSetValues(FilePicker_Button(new_w),
    	XmNtopAttachment, XmATTACH_FORM,
    	XmNtopOffset, (int)((XtHeight(new_w) - XtHeight(FilePicker_Button(new_w))) / 2),
    	XmNrightAttachment, XmATTACH_FORM,
    	NULL);
    XtVaSetValues(FilePicker_TextField(new_w),
    	XmNtopAttachment, XmATTACH_FORM,
    	XmNtopOffset, (int)((XtHeight(new_w) - XtHeight(FilePicker_TextField(new_w))) / 2),
    	XmNrightAttachment, XmATTACH_WIDGET,
    	XmNrightWidget, FilePicker_Button(new_w),
    	NULL);
    if (FilePicker_Value(new_w))
    {
    	XmTextFieldSetString(FilePicker_TextField(new_w), FilePicker_Value(new_w));
	XmTextFieldSetInsertionPosition(FilePicker_TextField(new_w), XmTextFieldGetLastPosition(FilePicker_TextField(new_w)));
    }
    XtManageChild(FilePicker_Label(new_w));
    XtManageChild(FilePicker_Button(new_w));
    XtManageChild(FilePicker_TextField(new_w));
    XtAddCallback(FilePicker_Button(new_w), XmNactivateCallback, (XtCallbackProc)BrowseCallback, NULL);
    /*
    XtAddCallback(new_w, XmNhelpCallback, (XtCallbackProc)Help, NULL);
    */
}
Example #14
0
static Widget
style_value (int i)
{
  Widget w, l;
  n = 0;
  stdarg (XmNtopAttachment, XmATTACH_POSITION);
  stdarg (XmNtopPosition, i);
  stdarg (XmNbottomAttachment, XmATTACH_POSITION);
  stdarg (XmNbottomPosition, i + 1);
  stdarg (XmNleftAttachment, XmATTACH_FORM);
  stdarg (XmNrightAttachment, XmATTACH_FORM);
  stdarg (XmNalignment, XmALIGNMENT_END);
  l = XmCreateLabel (value_labels, value_names[i], args, n);
  XtManageChild (l);

  n = 0;
  stdarg (XmNtopAttachment, XmATTACH_POSITION);
  stdarg (XmNtopPosition, i);
  stdarg (XmNbottomAttachment, XmATTACH_POSITION);
  stdarg (XmNbottomPosition, i + 1);
  stdarg (XmNleftAttachment, XmATTACH_FORM);
  stdarg (XmNrightAttachment, XmATTACH_FORM);
  stdarg (XmNcolumns, 8);
  w = XmCreateTextField (value_texts, value_names[i], args, n);
  XtAddCallback (w, XmNvalueChangedCallback,
		 (XtCallbackProc) style_value_cb, (XtPointer) (size_t) i);
  XtManageChild (w);

  n = 0;
  stdarg (XmNtopAttachment, XmATTACH_POSITION);
  stdarg (XmNtopPosition, i);
  stdarg (XmNbottomAttachment, XmATTACH_POSITION);
  stdarg (XmNbottomPosition, i + 1);
  stdarg (XmNleftAttachment, XmATTACH_FORM);
  stdarg (XmNrightAttachment, XmATTACH_FORM);
  stdarg (XmNlabelString, ustr);
  units_pb[i] = XmCreatePushButton (units_form, value_names[i], args, n);
  XtAddCallback (units_pb[i], XmNactivateCallback,
		 (XtCallbackProc) units_cb, (XtPointer) (size_t) i);
  XtManageChild (units_pb[i]);

  return w;
}
Example #15
0
void InvPartEditor::createRegFrame(Widget parent)
{
    Widget regFrame = XtVaCreateManagedWidget(
                          "RegFrame",
                          xmFrameWidgetClass, parent,
                          XmNleftAttachment, XmATTACH_FORM,
                          XmNrightAttachment, XmATTACH_FORM,
                          XmNleftOffset, 5,
                          XmNrightOffset, 5,
                          XmNbottomOffset, 5,
                          XmNtopOffset, 5,
                          XmNtopAttachment, XmATTACH_FORM,
                          XmNbottomAttachment, XmATTACH_WIDGET,
                          //XmNbottomWidget,      push_button,
                          NULL);
    Arg args[5];
    //Now the togglebutton and textfield for the reference part
    XtSetArg(args[0], XmNorientation, XmVERTICAL);
    Widget regCol = XtCreateManagedWidget("parent", xmRowColumnWidgetClass, regFrame, args, 1);

    XmString descStr = XmStringCreateSimple((char *)"Enter regular expression to specify parts");
    XtSetArg(args[0], XmNlabelString, descStr);
    Widget description = XmCreateLabel(regCol, (char *)"description", args, 1);
    Widget visible = XmCreatePushButton(regCol, (char *)"visible", NULL, 0);
    Widget invisible = XmCreatePushButton(regCol, (char *)"invisible", NULL, 0);
    Widget invert = XmCreatePushButton(regCol, (char *)"invert", NULL, 0);
    XtManageChild(description);
    XtManageChild(visible);
    XtManageChild(invisible);
    XtManageChild(invert);
    //A text field to specify  part-ids by a given regular expression
    //since this widget is referenced by several callback
    //it is no local variable but a member of the class.
    partname_ = XmCreateTextField(regCol, (char *)"partname_", NULL, 0);
    XtManageChild(partname_);
    XtAddCallback(invert, XmNactivateCallback, invertByNameCB, (XtPointer) this);
    XtAddCallback(invisible, XmNactivateCallback, unselectByNameCB, (XtPointer) this);
    XtAddCallback(visible, XmNactivateCallback, selectByNameCB, (XtPointer) this);
}
Example #16
0
int
main(int argc, char **argv)
{
  Widget toplevel;
  Widget Form;
  Widget Label;
  XtAppContext app;

  XtSetLanguageProc(NULL, NULL, NULL);

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

  printf("\nCreate a TextField\n");
  Label = XmCreateTextField(toplevel, "TestWidget", NULL, 0);
  DoTests(Label);

  printf("\nManage the TextField\n");
  XtManageChild(Label);
  DoTests(Label);

  printf("\nRealize the TextField\n");
  XtRealizeWidget(toplevel);
  DoTests(Label);

  printf("%s\n",GlobalResult ? "All Passed" : "One or more Failed");

  
{
    static XtWidgetGeometry Expected[] = {
   CWWidth | CWHeight            ,   57,   73,  138,   31, 0,0,0, /* TestWidget */ 
    };
    PrintDetails(toplevel,Expected);
};
  LessTifTestMainLoop(toplevel);

  exit(GlobalResult ? 0 : 1);
}
Example #17
0
Widget XmCreateTextField_TNK(Widget parent, String name, ArgList arglist,Cardinal argcount) { return XmCreateTextField(parent, name, arglist, argcount);}
Example #18
0
/*<----------------------------------------------------------------------------------------->*/
void InitPanneauEdition()
{
   Arg	args[10];
   XmString label;
   XmStringTable labelTable;
   register int n;	
   char nomShell[128];
   int lng = 0;
   
   Xinit("xrec");
   lng = c_getulng();
   
   memset(&champOriginal, '\000', sizeof(_Champ));

   n = 0;
   strcpy(nomShell, XtName(SuperWidget.topLevel));
   strcat(nomShell, nomPanneauEdition[lng]);
   peTopLevel = XtAppCreateShell(nomShell, nomShell, 
				 applicationShellWidgetClass,
				 XtDisplay(SuperWidget.topLevel), args, n);

   peForme = (Widget) XmCreateForm(peTopLevel, "form", NULL, 0);
   XtManageChild(peForme);

   n = 0;
   XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
   XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
   peFermer = (Widget)XmCreatePushButton(peForme, labelFermer[lng], args, n);
   XtAddCallback(peFermer, XmNactivateCallback, (XtCallbackProc)  PeFermer, NULL);
   XtManageChild(peFermer);

   n = 0;
   XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
   XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
   XtSetArg(args[n], XmNrightWidget, peFermer); n++;
   peAfficher = (Widget)XmCreatePushButton(peForme, labelAfficher[lng], args, n);
   XtAddCallback(peAfficher, XmNactivateCallback, (XtCallbackProc)  PeAfficher, NULL);
   XtManageChild(peAfficher);

   n = 0;
   XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
   XtSetArg(args[n], XmNtopWidget, peFermer); n++;
   XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
   peFrame = (Widget) XmCreateFrame(peForme, "form", args, n);
   XtManageChild(peFrame);

   n = 0;
   XtSetArg (args[n], XmNorientation, XmVERTICAL);  n++;
   XtSetArg (args[n], XmNnumColumns, 1);  n++;
   peRC = (Widget) XmCreateRowColumn(peFrame, "RC", args, n);
   XtManageChild(peRC);
   
   n=0;
   XtSetArg (args[n], XmNorientation, XmVERTICAL);  n++;
   XtSetArg (args[n], XmNpacking, XmPACK_COLUMN);  n++;
   XtSetArg (args[n], XmNnumColumns, 2);  n++;
   peRCBoutons = (Widget) XmCreateRowColumn(peRC, "RCBoutons", args, n);
   XtManageChild(peRCBoutons);
   
   label = XmStringCreateLtoR(EditerValeurs[lng], XmSTRING_DEFAULT_CHARSET);
   n = 0;
   XtSetArg(args[n], XmNlabelString, label); n++;
   XtSetArg (args[n], XmNsensitive, False);  n++;
   peEditerValeurs = (Widget) XmCreatePushButton(peRCBoutons, EditerValeurs[lng], args, n);
   XtAddCallback(peEditerValeurs, XmNactivateCallback, (XtCallbackProc)  PeEditerValeurs, MODIFIER);
   XtManageChild(peEditerValeurs);
   XmStringFree(label);
   
   label = XmStringCreateLtoR(AnnulerEdition[lng], XmSTRING_DEFAULT_CHARSET);
   n = 0;
   XtSetArg(args[n], XmNlabelString, label); n++;
   XtSetArg (args[n], XmNsensitive, False);  n++;
   peAnnulerEdition = (Widget) XmCreatePushButton(peRCBoutons, AnnulerEdition[lng], args, n);
   XtAddCallback(peAnnulerEdition, XmNactivateCallback, (XtCallbackProc)  PeAnnulerEdition, NULL);
   XtManageChild(peAnnulerEdition);
   XmStringFree(label);
   
   label = XmStringCreateLtoR(Enregistrer[lng], XmSTRING_DEFAULT_CHARSET);
   n = 0;
   XtSetArg(args[n], XmNlabelString, label); n++;
   XtSetArg (args[n], XmNsensitive, False);  n++;
   peEnregistrer = (Widget) XmCreatePushButton(peRCBoutons, Enregistrer[lng], args, n);
   XtAddCallback(peEnregistrer, XmNactivateCallback, (XtCallbackProc)  PeEnregistrer, NULL);
   XtManageChild(peEnregistrer);
   XmStringFree(label);
   
   label = XmStringCreateLtoR(RemettreValeurs[lng], XmSTRING_DEFAULT_CHARSET);
   n = 0;
   XtSetArg(args[n], XmNlabelString, label); n++;
   XtSetArg(args[n], XmNsensitive, False); n++;
   peRemettreValeurs = (Widget) XmCreatePushButton(peRCBoutons, RemettreValeurs[lng], args, n);
   XtAddCallback(peRemettreValeurs, XmNactivateCallback, (XtCallbackProc)  PeEditerValeurs, (XtPointer) REMETTRE);
   XtManageChild(peRemettreValeurs);
   XmStringFree(label);
   
   label = XmStringCreateLtoR(RefaireEdition[lng], XmSTRING_DEFAULT_CHARSET);
   n = 0;
   XtSetArg(args[n], XmNlabelString, label); n++;
   XtSetArg (args[n], XmNsensitive, False);  n++;
   peRefaireEdition = (Widget) XmCreatePushButton(peRCBoutons, RefaireEdition[lng], args, n);
   XtAddCallback(peRefaireEdition, XmNactivateCallback, (XtCallbackProc)  PeRefaireEdition, NULL);
   XtManageChild(peRefaireEdition);
   XmStringFree(label);
   
   label = XmStringCreateLtoR(AnnulerToutesModifs[lng], XmSTRING_DEFAULT_CHARSET);
   n = 0;
   XtSetArg(args[n], XmNlabelString, label); n++;
   XtSetArg (args[n], XmNsensitive, False);  n++;
   peAnnulerToutesModifs = (Widget) XmCreatePushButton(peRCBoutons, AnnulerToutesModifs[lng], args, n);
   XtAddCallback(peAnnulerToutesModifs, XmNactivateCallback, (XtCallbackProc)  PeAnnulerToutesModifs, NULL);
   XtManageChild(peAnnulerToutesModifs);
   XmStringFree(label);
   
   n = 0;
   peSeparateurs[0] =  (Widget) XmCreateSeparator(peRC, "sep 1", args, n);
   XtManageChild(peSeparateurs[0]);
   
   labelTable = (XmString *)calloc(1, sizeof(XmString *));
   labelTable[0] = label;
   
   n=0;
   XtSetArg (args[n], XmNorientation, XmVERTICAL);  n++;
   XtSetArg (args[n], XmNnumColumns, 1);  n++;
   peRCValRemplacement = (Widget) XmCreateRowColumn(peRC, "Val", args, n);
   XtManageChild(peRCValRemplacement);
   
   label = XmStringCreateLtoR(NouvelleValeur[lng], XmSTRING_DEFAULT_CHARSET);
   n=0;
   peLabelValRemplacement = (Widget) XmCreateLabel(peRCValRemplacement, NouvelleValeur[lng], args, n);
   XtManageChild(peLabelValRemplacement);
   XmStringFree(label);
   
   n = 0;
   XtSetArg (args[n], XmNvalue, "0.0000");  n++;
   XtSetArg (args[n], XmNblinkRate, 0);  n++;
   peTextValRemplacement = (Widget) XmCreateTextField(peRCValRemplacement, "text", args, n);
   XtManageChild(peTextValRemplacement);
   
   n = 0;
   peSeparateurs[2] =  (Widget) XmCreateSeparator(peRC, "sep 2", args, n);
   XtManageChild(peSeparateurs[2]);
   
   n=0;
   XtSetArg (args[n], XmNorientation, XmVERTICAL);  n++;
   XtSetArg (args[n], XmNnumColumns, 1);  n++;
   peRCEtikRemplacement = (Widget) XmCreateRowColumn(peRC, "Etik", args, n);
   XtManageChild(peRCEtikRemplacement);
   
   label = XmStringCreateLtoR(NouvelleEtiquette[lng], XmSTRING_DEFAULT_CHARSET);
   n=0;
   peLabelEtikRemplacement = (Widget) XmCreateLabel(peRCEtikRemplacement, NouvelleEtiquette[lng], args, n);
   XtManageChild(peLabelEtikRemplacement);
   XmStringFree(label);
   
   n = 0;
   XtSetArg (args[n], XmNmaxLength, 8);  n++;
   XtSetArg (args[n], XmNvalue, EtiquetteDefaut[lng]);  n++;
   XtSetArg (args[n], XmNblinkRate, 0);  n++;
   peTextEtikRemplacement = (Widget) XmCreateTextField(peRCEtikRemplacement, "text", args, n);
   XtManageChild(peTextEtikRemplacement);

   peInfo = (Widget) CreateInfoDialog(peTopLevel);
   peWarning = (Widget) CreateWarningDialog(peTopLevel);
   peWarningWithCancel = (Widget) CreateWarningDialogWithCancelBox(peTopLevel);

   }
Example #19
0
void
XltHostSelect(Widget W, Widget w)
{
    while (!XtIsTopLevelShell(W))
	W = XtParent(W);
    /*
    fprintf(stderr, "%s:%s(%d) - %s %s %s\n", __FILE__, __FUNCTION__, __LINE__,
    	XtName(W), XtName(w),
    	Host_Dialog(w) ? XtName(Host_Dialog(w)) : "NULL");
    */
    if (Host_Dialog(w) == NULL)
    {
	Widget Form;
	Widget Form1;
	Widget Form2;
	Widget HostLabel;
	Widget HostText;
	Widget PortLabel;
	Widget PortText;
	String Name;

	Name = XtMalloc(strlen(XtName(w)) + 7);
	sprintf(Name, "%sSelect", XtName(w));
	Host_Dialog(w) = XmCreateMessageDialog(W, Name, NULL, 0);
	XtFree(Name);
	Form = XmCreateForm(Host_Dialog(w), "Form", NULL, 0);

	Form1 = XmCreateForm(Form, "HostForm", NULL, 0);
	XtVaSetValues(Form1,
		      XmNtopAttachment, XmATTACH_FORM,
		      XmNleftAttachment, XmATTACH_FORM,
		      XmNrightAttachment, XmATTACH_FORM,
		      NULL);
	HostLabel = XmCreateLabel(Form1, "Host", NULL, 0);
	HostText = XmCreateTextField(Form1, "HostText", NULL, 0);
	XtVaSetValues(HostLabel,
		      XmNtopAttachment, XmATTACH_FORM,
		      XmNleftAttachment, XmATTACH_FORM,
		      XmNbottomAttachment, XmATTACH_FORM,
		      NULL);
	XtVaSetValues(HostText,
		      XmNtopAttachment, XmATTACH_FORM,
		      XmNbottomAttachment, XmATTACH_FORM,
		      XmNleftAttachment, XmATTACH_WIDGET,
		      XmNleftWidget, HostLabel,
		      XmNrightAttachment, XmATTACH_FORM,
		      NULL);
	XtManageChild(HostLabel);
	XtManageChild(HostText);
	XtManageChild(Form1);

	Form2 = XmCreateForm(Form, "PortForm", NULL, 0);
	XtVaSetValues(Form2,
		      XmNtopAttachment, XmATTACH_WIDGET,
		      XmNtopWidget, Form1,
		      XmNleftAttachment, XmATTACH_FORM,
		      XmNrightAttachment, XmATTACH_FORM,
		      NULL);
	PortLabel = XmCreateLabel(Form2, "Port", NULL, 0);
	PortText = XmCreateTextField(Form2, "PortText", NULL, 0);
	XtVaSetValues(PortLabel,
		      XmNtopAttachment, XmATTACH_FORM,
		      XmNleftAttachment, XmATTACH_FORM,
		      XmNbottomAttachment, XmATTACH_FORM,
		      NULL);
	XtVaSetValues(PortText,
		      XmNtopAttachment, XmATTACH_FORM,
		      XmNbottomAttachment, XmATTACH_FORM,
		      XmNleftAttachment, XmATTACH_WIDGET,
		      XmNleftWidget, PortLabel,
		      XmNrightAttachment, XmATTACH_FORM,
		      NULL);
	XtManageChild(PortLabel);
	XtManageChild(PortText);
	XtManageChild(Form2);

	XtManageChild(Form);
	XtAddCallback(Host_Dialog(w), XmNokCallback, (XtCallbackProc)OpenHost, w);
	XtAddCallback(Host_Dialog(w), XmNhelpCallback, (XtCallbackProc)XltHelpOnHostSelect, w);
    }
    XmTextFieldSetString(XtNameToWidget(Host_Dialog(w), "*HostText"), Host_Name(w));
    XmTextFieldSetString(XtNameToWidget(Host_Dialog(w), "*PortText"), Host_Port(w));
    XtManageChild(Host_Dialog(w));
}
Example #20
0
/*
 * Function:  _DtPrintCreateMarginFrame
 *
 * Creates a frame for specifying margins.  The frame contains four text
 * fields, one for each _DtPrintMarginEnum.
 *
 *	parent -	specifies the parent of the frame.
 *
 * Returns the widget id of the frame.
 */
Widget
_DtPrintCreateMarginFrame(
	Widget			parent
	)
{
    DtpoMarginFrame
		*info;
    Arg		args[16];
    int		n;
    XmString	xms;

    info = (DtpoMarginFrame *) XtMalloc( sizeof(DtpoMarginFrame) );

    n = 0;
    XtSetArg(args[n], XmNchildHorizontalAlignment, XmALIGNMENT_BEGINNING); n++;
    XtSetArg(args[n], XmNchildVerticalAlignment, XmALIGNMENT_CENTER); n++;
    XtSetArg(args[n], XmNuserData, info); n++;
    info->frame = XmCreateFrame(parent, "MarginFrame", args, n);
    XtAddCallback(
		info->frame,
		XmNdestroyCallback,
		_DtPrintDestroyMarginFrameCB,
		(XtPointer) info
		);

    xms = XmStringCreateLocalized(DTPO_MARGIN_FRAME_LABEL);
    n = 0;
    XtSetArg(args[n], XmNchildType, XmFRAME_TITLE_CHILD); n++;
    XtSetArg(args[n], XmNchildHorizontalAlignment, XmALIGNMENT_BEGINNING); n++;
    XtSetArg(args[n], XmNchildVerticalAlignment, XmALIGNMENT_CENTER); n++;
    XtSetArg(args[n], XmNlabelString, xms); n++;
    info->label = XmCreateLabel(info->frame, "MarginLabel", args, n);
    XtManageChild(info->label);
    XmStringFree(xms);

    n = 0;
    XtSetArg(args[n], XmNallowOverlap, False); n++;
    XtSetArg(args[n], XmNfractionBase, 2); n++;
    info->form = XmCreateForm(info->frame, "MarginForm", args, n);

    n = 0;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION); n++;
    XtSetArg(args[n], XmNrightPosition, 1); n++;
    XtSetArg(args[n], XmNrightOffset, 5); n++;
    info->top = XmCreateTextField(info->form, "MarginTopText", args, n);
    XtManageChild(info->top);

    xms = XmStringCreateLocalized(DTPO_MARGIN_FRAME_TOP_MARGIN_LABEL);

    n = 0;
    XtSetArg(args[n], XmNlabelString, xms); n++;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNtopWidget, info->top); n++;
    XtSetArg(args[n], XmNtopOffset, 0); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
    XtSetArg(args[n], XmNrightWidget, info->top); n++;
    XtSetArg(args[n], XmNrightOffset, 3); n++;
    XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNbottomWidget, info->top); n++;
    XtSetArg(args[n], XmNbottomOffset, 0); n++;
    info->top_label =
      XmCreateLabelGadget(info->form, "MarginTopLabel", args, n);
    XmStringFree(xms);
    XtManageChild(info->top_label);

    n = 0;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNtopWidget, info->top); n++;
    XtSetArg(args[n], XmNtopOffset, 0); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
    info->right = XmCreateTextField(info->form, "MarginRightText", args, n);
    XtManageChild(info->right);

    xms = XmStringCreateLocalized(DTPO_MARGIN_FRAME_RIGHT_MARGIN_LABEL);
    n = 0;
    XtSetArg(args[n], XmNlabelString, xms); n++;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNtopWidget, info->right); n++;
    XtSetArg(args[n], XmNtopOffset, 0); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
    XtSetArg(args[n], XmNrightWidget, info->right); n++;
    XtSetArg(args[n], XmNrightOffset, 3); n++;
    XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNbottomWidget, info->right); n++;
    XtSetArg(args[n], XmNbottomOffset, 0); n++;
    info->right_label =
      XmCreateLabelGadget(info->form, "MarginRightLabel", args, n);
    XmStringFree(xms);
    XtManageChild(info->right_label);

    n = 0;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
    XtSetArg(args[n], XmNtopWidget, info->top); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNrightWidget, info->top); n++;
    XtSetArg(args[n], XmNrightOffset, 0); n++;
    info->bottom = XmCreateTextField(info->form, "MarginBottomText", args, n);
    XtManageChild(info->bottom);

    xms = XmStringCreateLocalized(DTPO_MARGIN_FRAME_BOTTOM_MARGIN_LABEL);
    n = 0;
    XtSetArg(args[n], XmNlabelString, xms); n++;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNtopWidget, info->bottom); n++;
    XtSetArg(args[n], XmNtopOffset, 0); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
    XtSetArg(args[n], XmNrightWidget, info->bottom); n++;
    XtSetArg(args[n], XmNrightOffset, 3); n++;
    XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNbottomWidget, info->bottom); n++;
    XtSetArg(args[n], XmNbottomOffset, 0); n++;
    info->bottom_label =
      XmCreateLabelGadget(info->form, "MarginBottomLabel", args, n);
    XmStringFree(xms);
    XtManageChild(info->bottom_label);

    n = 0;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNtopWidget, info->bottom); n++;
    XtSetArg(args[n], XmNtopOffset, 0); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNrightWidget, info->right); n++;
    XtSetArg(args[n], XmNrightOffset, 0); n++;
    info->left = XmCreateTextField(info->form, "MarginLeftText", args, n);
    XtManageChild(info->left);

    xms = XmStringCreateLocalized(DTPO_MARGIN_FRAME_LEFT_MARGIN_LABEL);
    n = 0;
    XtSetArg(args[n], XmNlabelString, xms); n++;
    XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNtopWidget, info->left); n++;
    XtSetArg(args[n], XmNtopOffset, 0); n++;
    XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++;
    XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
    XtSetArg(args[n], XmNrightWidget, info->left); n++;
    XtSetArg(args[n], XmNrightOffset, 3); n++;
    XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
    XtSetArg(args[n], XmNbottomWidget, info->left); n++;
    XtSetArg(args[n], XmNbottomOffset, 0); n++;
    info->left_label =
      XmCreateLabelGadget(info->form, "MarginLeftLabel", args, n);
    XmStringFree(xms);
    XtManageChild(info->left_label);

    XtManageChild(info->form);
    return info->frame;
}
Example #21
0
static void
initialize(Widget request, Widget new_w, ArgList args, Cardinal *num_args)
{
    Dimension h;

#ifdef DEBUG
    printf("NumEntry - initialize(%s) - %i args\n", XtName(new_w), *num_args);
#endif
    XtHeight(new_w) = 0;
    XtWidth(new_w) = 0;
    NumEntry_Value(new_w) = XtNewString(NumEntry_Value(new_w));
    NumEntry_Label(new_w) = XmCreateLabel(new_w, "Label", NULL, 0);
    if (NumEntry_LabelString(new_w) == NULL)
    {
	NumEntry_LabelString(new_w) = XmStringCreateSimple(XtName(new_w));
    }
    XtVaSetValues(NumEntry_Label(new_w),
		  XmNlabelString, NumEntry_LabelString(new_w),
		  NULL);
    XtOverrideTranslations(NumEntry_Label(new_w), XtParseTranslationTable(tm_table));
    XtManageChild(NumEntry_Label(new_w));
    XtHeight(new_w) = XtHeight(new_w) > XtHeight(NumEntry_Label(new_w)) ? XtHeight(new_w) : XtHeight(NumEntry_Label(new_w));
    XtWidth(new_w) += XtWidth(NumEntry_Label(new_w));

    NumEntry_TextField(new_w) = XmCreateTextField(new_w, "Text", NULL, 0);
    XtAddCallback(NumEntry_TextField(new_w), XmNvalueChangedCallback, (XtCallbackProc)ValueChange, (XtPointer)NULL);
    XtAddCallback(NumEntry_TextField(new_w), XmNactivateCallback, (XtCallbackProc)Activate, (XtPointer)NULL);
    XtAddCallback(NumEntry_TextField(new_w), XmNlosingFocusCallback, (XtCallbackProc)LosingFocus, (XtPointer)NULL);
    XtVaSetValues(NumEntry_TextField(new_w),
		  XmNvalue, NumEntry_Value(new_w),
		  XmNcolumns, NumEntry_Columns(new_w),
		  NULL);
    XtOverrideTranslations(NumEntry_TextField(new_w), XtParseTranslationTable(tm_table));
    XtOverrideTranslations(NumEntry_TextField(new_w), XtParseTranslationTable(text_tm_table));
    XtManageChild(NumEntry_TextField(new_w));
    XtHeight(new_w) = XtHeight(new_w) > XtHeight(NumEntry_TextField(new_w)) ? XtHeight(new_w) : XtHeight(NumEntry_TextField(new_w));
    XtWidth(new_w) += XtWidth(NumEntry_TextField(new_w));
    h = XtHeight(new_w);
    h = (h * 2) / 3;
    NumEntry_RowColumn(new_w) = XmCreateRowColumn(new_w, "RowCol", NULL, 0);
    XtVaSetValues(NumEntry_RowColumn(new_w),
		  XmNtraversalOn, False,
		  XmNpacking, XmPACK_COLUMN,
		  XmNorientation, XmHORIZONTAL,
		  XmNnumColumns, 1,
		  NULL);
    XtOverrideTranslations(NumEntry_RowColumn(new_w), XtParseTranslationTable(tm_table));
    NumEntry_UpArrow(new_w) = XmCreateArrowButton(NumEntry_RowColumn(new_w), "UpArrow", NULL, 0);
    XtAddCallback(NumEntry_UpArrow(new_w), XmNactivateCallback, (XtCallbackProc)StepValue, (XtPointer)1);
    XtAddCallback(NumEntry_UpArrow(new_w), XmNarmCallback, (XtCallbackProc)AutoRepeat, (XtPointer)True);
    XtAddCallback(NumEntry_UpArrow(new_w), XmNdisarmCallback, (XtCallbackProc)AutoRepeat, (XtPointer)False);
    XtVaSetValues(NumEntry_UpArrow(new_w),
		  XmNwidth, h,
		  XmNarrowDirection, XmARROW_UP,
		  NULL);
    XtOverrideTranslations(NumEntry_UpArrow(new_w), XtParseTranslationTable(tm_table));
    XtManageChild(NumEntry_UpArrow(new_w));
    NumEntry_DnArrow(new_w) = XmCreateArrowButton(NumEntry_RowColumn(new_w), "DnArrow", NULL, 0);
    XtAddCallback(NumEntry_DnArrow(new_w), XmNactivateCallback, (XtCallbackProc)StepValue, (XtPointer)-1);
    XtAddCallback(NumEntry_DnArrow(new_w), XmNarmCallback, (XtCallbackProc)AutoRepeat, (XtPointer)True);
    XtAddCallback(NumEntry_DnArrow(new_w), XmNdisarmCallback, (XtCallbackProc)AutoRepeat, (XtPointer)False);
    XtVaSetValues(NumEntry_DnArrow(new_w),
		  XmNwidth, h,
		  XmNarrowDirection, XmARROW_DOWN,
		  NULL);
    XtOverrideTranslations(NumEntry_DnArrow(new_w), XtParseTranslationTable(tm_table));
    XtManageChild(NumEntry_DnArrow(new_w));
    XtVaSetValues(NumEntry_RowColumn(new_w),
		  XmNtopAttachment, XmATTACH_FORM,
		  XmNbottomAttachment, XmATTACH_FORM,
		  XmNleftAttachment, XmATTACH_NONE,
		  XmNrightAttachment, XmATTACH_FORM,
		  NULL);
    XtVaSetValues(NumEntry_TextField(new_w),
		  XmNtopAttachment, XmATTACH_FORM,
		  XmNbottomAttachment, XmATTACH_FORM,
		  XmNleftAttachment, XmATTACH_NONE,
		  XmNrightAttachment, XmATTACH_WIDGET,
		  XmNrightWidget, NumEntry_RowColumn(new_w),
		  NULL);
    XtVaSetValues(NumEntry_Label(new_w),
		  XmNalignment, XmALIGNMENT_BEGINNING,
		  XmNtopAttachment, XmATTACH_FORM,
		  XmNbottomAttachment, XmATTACH_FORM,
		  XmNleftAttachment, XmATTACH_FORM,
		  XmNrightAttachment, XmATTACH_WIDGET,
		  XmNrightWidget, NumEntry_TextField(new_w),
		  NULL);
    {
    XtWidgetGeometry pref;

	XtQueryGeometry(NumEntry_RowColumn(new_w), NULL, &pref);
	XtWidth(new_w) += pref.width;
    }
    XtManageChild(NumEntry_RowColumn(new_w));
    XtAddCallback(new_w, XmNhelpCallback, (XtCallbackProc)Help, NULL);
    NumEntry_TimerId(new_w) = (XtIntervalId)NULL;
    NumEntry_Result(new_w) = XltCalc(NumEntry_Value(new_w));
}
Example #22
0
Widget
CreateConstraintResourceControls( Widget parent, Widget left_widget,
                             Widget bottom_widget,
 			     unsigned int child_type )
{
	XmString	string;
	Widget		RowColumn;
	Widget          ArrowSensLabel, ArrowSensPulldown, ArrowSensOptions,
	                ArrowSensPB[NUM_ARROW_SENS_BTNS];
	Widget          DecimalPtsLabel, DecimalPtsTF;
	Widget          IncrValueLabel, IncrValueTF;
	Widget          MaxValueLabel, MaxValueTF;
	Widget          MinValueLabel, MinValueTF;
	Widget          NumValuesLabel, NumValuesTF;
	Widget          PositionLabel;
	Widget          ChildTypeLabel, ChildTypePulldown, ChildTypeOptions,
                        ChildTypePB[NUM_CHILD_TYPE_BTNS];
	Widget          ValuesLabel, ValuesList;
	char		buffer[30], buffer2[30];
	Widget          client_widget;
	int		i, j;	
        XmStringTable   stringTable;

        client_widget = ( child_type == XmSTRING ) ? StringTextF :
                        NumericTextF;

        n = 0;
        XtSetArg( args[n], XmNleftAttachment, XmATTACH_WIDGET ); n++;
        XtSetArg( args[n], XmNleftWidget, left_widget ); n++;
        XtSetArg( args[n], XmNbottomAttachment, XmATTACH_WIDGET ); n++;
        XtSetArg( args[n], XmNbottomWidget, bottom_widget ); n++;
        XtSetArg(args[n], XmNnumColumns, 9); n++;
        XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
        XtSetArg(args[n], XmNpacking, XmPACK_COLUMN); n++;
        RowColumn = XmCreateRowColumn( parent, "RowColumn", args, n );
	XtManageChild( RowColumn );


      /*
       *  Create label and option menu for XmNarrowSensitivity resource.
       */
        string = XmStringCreateLtoR("Arrow Sensitivity",
                   XmFONTLIST_DEFAULT_TAG );
        n = 0;
        XtSetArg( args[n], XmNlabelString, string ); n++;
        ArrowSensLabel = XmCreateLabel( RowColumn, "ArrowSensLabel",
                             args, n );
        XtManageChild( ArrowSensLabel );
        XmStringFree( string );

        n = 0;
        ArrowSensPulldown = XmCreatePulldownMenu(RowColumn,
                                                 "ArrowSensPulldown",
                                                 args, n);

        for ( i = 0; i < NUM_ARROW_SENS_BTNS; i++ )
        {
           string = XmStringCreateLtoR( arrow_sens_strings[i],
                      XmFONTLIST_DEFAULT_TAG );
           if ( child_type == XmSTRING )
                sprintf( buffer, "StringArrowSensPB%d", i );
           else if ( child_type == XmNUMERIC )
                sprintf( buffer, "NumericArrowSensPB%d", i );

           n = 0;
           XtSetArg( args[n], XmNlabelString, string ); n++;
           ArrowSensPB[i] = 
           XmCreatePushButton( ArrowSensPulldown, buffer, args, n );
           XmStringFree( string );

           if ( child_type == XmSTRING )
           {
              string_arrow_sens_cd[i].textfield = client_widget; 
              string_arrow_sens_cd[i].sensitivity = arrow_sens[i];
              XtAddCallback( ArrowSensPB[i], XmNactivateCallback,
                             ArrowSensCB, &string_arrow_sens_cd[i]); 
           }
           else if ( child_type = XmNUMERIC )
           {
              numeric_arrow_sens_cd[i].textfield = client_widget; 
              numeric_arrow_sens_cd[i].sensitivity = arrow_sens[i];
              XtAddCallback( ArrowSensPB[i], XmNactivateCallback,
                             ArrowSensCB, &numeric_arrow_sens_cd[i]); 
           }
        }
        XtManageChildren( ArrowSensPB, NUM_ARROW_SENS_BTNS );

        if ( child_type == XmSTRING )
             sprintf( buffer, "StringArrowSensOptions", i );
        else if ( child_type == XmNUMERIC )
             sprintf( buffer, "NumericArrowSensOptions", i );

        n = 0;
        XtSetArg( args[n], XmNmenuHistory, 
                           ArrowSensPB[NUM_ARROW_SENS_BTNS - 1] ); n++;
        XtSetArg( args[n], XmNsubMenuId, ArrowSensPulldown ); n++;
        ArrowSensOptions =
        XmCreateOptionMenu( RowColumn, buffer, args, n );
        XtManageChild( ArrowSensOptions );

        string = XmStringCreateLtoR("Decimal Points",
                   XmFONTLIST_DEFAULT_TAG );
        n = 0;
        XtSetArg( args[n], XmNlabelString, string ); n++;
        DecimalPtsLabel =
        XmCreateLabel( RowColumn, "DecimalPtsLabel", args, n );
        XtManageChild( DecimalPtsLabel );
        XmStringFree( string );

        n = 0;
        XtSetArg( args[n], XmNvalue, "0" ); n++;
        if ( child_type == XmSTRING )
           sprintf( buffer, "%s", "StringDecimalPtsTF" );
        else if ( child_type == XmNUMERIC )
           sprintf( buffer, "%s", "NumericDecimalPtsTF" );
        DecimalPtsTF =
        XmCreateTextField( RowColumn, buffer, args, n );
        XtManageChild( DecimalPtsTF );

        XtAddCallback( DecimalPtsTF, XmNactivateCallback,
                       DecimalPtsCB, (XtPointer)client_widget );

        string = XmStringCreateLtoR("Increment Value",
                   XmFONTLIST_DEFAULT_TAG );
        n = 0;
        XtSetArg( args[n], XmNlabelString, string ); n++;
        IncrValueLabel =
        XmCreateLabel( RowColumn, "IncrValueLabel", args, n );
        XtManageChild( IncrValueLabel );
        XmStringFree( string );

        n = 0;
        XtSetArg( args[n], XmNvalue, "1" ); n++;
        if ( child_type == XmSTRING )
           sprintf( buffer, "%s", "StringIncrValueTF" );
        else if ( child_type == XmNUMERIC )
           sprintf( buffer, "%s", "NumericIncrValueTF" );
        IncrValueTF =
        XmCreateTextField( RowColumn, buffer, args, n );
        XtManageChild( IncrValueTF );

        XtAddCallback( IncrValueTF, XmNactivateCallback,
                       IncrValueCB, (XtPointer)client_widget );

        string = XmStringCreateLtoR("Maximum Value",
                   XmFONTLIST_DEFAULT_TAG );
        n = 0;
        XtSetArg( args[n], XmNlabelString, string ); n++;
        MaxValueLabel =
        XmCreateLabel( RowColumn, "MaxValueLabel", args, n );
        XtManageChild( MaxValueLabel );
        XmStringFree( string );

        n = 0;
        XtSetArg( args[n], XmNvalue, "10" ); n++;
        if ( child_type == XmSTRING )
           sprintf( buffer, "%s", "StringMaxValueTF" );
        else if ( child_type == XmNUMERIC )
           sprintf( buffer, "%s", "NumericMaxValueTF" );
        MaxValueTF =
        XmCreateTextField( RowColumn, buffer, args, n );
        XtManageChild( MaxValueTF );

        XtAddCallback( MaxValueTF, XmNactivateCallback,
                       MaxValueCB, (XtPointer)client_widget );

        string = XmStringCreateLtoR("Minimum Value",
                   XmFONTLIST_DEFAULT_TAG );
        n = 0;
        XtSetArg( args[n], XmNlabelString, string ); n++;
        MinValueLabel =
        XmCreateLabel( RowColumn, "MinValueLabel", args, n );
        XtManageChild( MinValueLabel );
        XmStringFree( string );

        n = 0;
        XtSetArg( args[n], XmNvalue, "0" ); n++;
        if ( child_type == XmSTRING )
           sprintf( buffer, "%s", "StringMinValueTF" );
        else if ( child_type == XmNUMERIC )
           sprintf( buffer, "%s", "NumericMinValueTF" );
        MinValueTF =
        XmCreateTextField( RowColumn, buffer, args, n );
        XtManageChild( MinValueTF );

        XtAddCallback( MinValueTF, XmNactivateCallback,
                       MinValueCB, (XtPointer)client_widget );

        string = XmStringCreateLtoR("Num Values",
                   XmFONTLIST_DEFAULT_TAG );
        n = 0;
        XtSetArg( args[n], XmNlabelString, string ); n++;
        NumValuesLabel =
        XmCreateLabel( RowColumn, "NumValuesLabel", args, n );
        XtManageChild( NumValuesLabel );
        XmStringFree( string );

        client_widget = ( child_type == XmSTRING ) ? StringTextF :
                        NumericTextF;

      /*
       *  Get current value of XmNnumValues resource.
       */
        n = 0;
        XtSetArg( args[n], XmNnumValues, &j ); n++;
        XtGetValues( client_widget, args, n );

        sprintf( buffer, "%d", j );

        n = 0;
        XtSetArg( args[n], XmNvalue, buffer ); n++;
        if ( child_type == XmSTRING )
           sprintf( buffer2, "%s", "StringNumValuesTF" );
        else if ( child_type == XmNUMERIC )
           sprintf( buffer2, "%s", "NumericNumValuesTF" );
        NumValuesTF =
        XmCreateTextField( RowColumn, buffer2, args, n );
        XtManageChild( NumValuesTF );

        XtAddCallback( NumValuesTF, XmNactivateCallback,
                       NumValuesCB, (XtPointer)client_widget );

        string = XmStringCreateLtoR("Position",
                   XmFONTLIST_DEFAULT_TAG );
        n = 0;
        XtSetArg( args[n], XmNlabelString, string ); n++;
        PositionLabel =
        XmCreateLabel( RowColumn, "PositionLabel", args, n );
        XtManageChild( PositionLabel );
        XmStringFree( string );

        n = 0;
        XtSetArg( args[n], XmNvalue, "0" ); n++;
        if ( child_type == XmSTRING )
        {
           sprintf( buffer, "%s", "StringPositionTF" );
           StringPositionTF =
           XmCreateTextField( RowColumn, buffer, args, n );
           XtManageChild( StringPositionTF );
           XtAddCallback( StringPositionTF, XmNactivateCallback,
                          PositionCB, (XtPointer)client_widget );
           XtAddCallback( SpinBox1, XmNvalueChangedCallback,
                          UpdatePositionCB, (XtPointer)StringPositionTF );
        }
        else if ( child_type == XmNUMERIC )
        {
           sprintf( buffer, "%s", "NumericPositionTF" );
           NumericPositionTF =
           XmCreateTextField( RowColumn, buffer, args, n );
           XtManageChild( NumericPositionTF );
           XtAddCallback( NumericPositionTF, XmNactivateCallback,
                          PositionCB, (XtPointer)client_widget );
           XtAddCallback( SpinBox2, XmNvalueChangedCallback,
                          UpdatePositionCB, (XtPointer)NumericPositionTF );
        }

        string = XmStringCreateLtoR("SpinBox Child Type",
                   XmFONTLIST_DEFAULT_TAG );
        n = 0;
        XtSetArg( args[n], XmNlabelString, string ); n++;
        ChildTypeLabel =
        XmCreateLabel( RowColumn, "ChildTypeLabel", args, n );
        XtManageChild( ChildTypeLabel );
        XmStringFree( string );

        n = 0;
        ChildTypePulldown = XmCreatePulldownMenu(RowColumn,
                                                 "ChildTypePulldown",
                                                 args, n);

        for ( i = 0; i < NUM_CHILD_TYPE_BTNS; i++ )
        {
           string = XmStringCreateLtoR( child_type_strings[i],
                      XmFONTLIST_DEFAULT_TAG );
           if ( child_type == XmSTRING )
              sprintf( buffer, "StringChildTypePB%d", i );
           else if ( child_type == XmNUMERIC )
              sprintf( buffer, "NumericChildTypePB%d", i );
           n = 0;
           XtSetArg( args[n], XmNlabelString, string ); n++;
           ChildTypePB[i] =
           XmCreatePushButton( ChildTypePulldown, buffer, args, n );
           XmStringFree( string );

           if ( child_type == XmSTRING )
           {
              string_child_type_cd[i].textfield = client_widget;
              string_child_type_cd[i].child_type = child_types[i];
              XtAddCallback( ChildTypePB[i], XmNactivateCallback,
                             ChildTypeCB, &string_child_type_cd[i] );
           }
           else if ( child_type == XmNUMERIC )
           {
              numeric_child_type_cd[i].textfield = client_widget;
              numeric_child_type_cd[i].child_type = child_types[i];
              XtAddCallback( ChildTypePB[i], XmNactivateCallback,
                             ChildTypeCB, &numeric_child_type_cd[i] );
           }
        }
        XtManageChildren( ChildTypePB, NUM_CHILD_TYPE_BTNS );

        n = 0;
        if ( child_type == XmSTRING )
        {
           XtSetArg( args[n], XmNmenuHistory, ChildTypePB[0] ); n++;
        }
        else if ( child_type == XmNUMERIC )
        {
           XtSetArg( args[n], XmNmenuHistory, ChildTypePB[1] ); n++;
        }
        XtSetArg( args[n], XmNsubMenuId, ChildTypePulldown ); n++;
        ChildTypeOptions =
        XmCreateOptionMenu( RowColumn, "ChildTypeOptions", args, n );
        XtManageChild( ChildTypeOptions );

        string = XmStringCreateLtoR( "Values",
                      XmFONTLIST_DEFAULT_TAG );

        n = 0;
        XtSetArg( args[n], XmNlabelString, string ); n++;
        ValuesLabel =
        XmCreateLabel( RowColumn, "ValuesLabel", args, n );
        XtManageChild( ValuesLabel );
        XmStringFree( string );

       /*
        *  Get current values for XmNvalues resource.
        */
        n = 0;
        XtSetArg( args[n], XmNnumValues, &j ); n++;
        XtSetArg( args[n], XmNvalues, &stringTable ); n++;
        XtGetValues( client_widget, args, n );

       /*
        *  Assign current string values to List for display.
        */
        if ( child_type == XmSTRING )
           sprintf( buffer, "%s", "StringValuesList" );
        else if ( child_type == XmNUMERIC )
           sprintf( buffer, "%s", "NumericValuesList" );
        n = 0;
        XtSetArg( args[n], XmNitemCount, j ); n++;
        XtSetArg( args[n], XmNitems, stringTable ); n++;
        XtSetArg( args[n], XmNvisibleItemCount, 1 ); n++;
        ValuesList = XmCreateScrolledList( RowColumn, buffer,
                     args, n );
        XtManageChild( ValuesList );

     return( RowColumn );
}
Example #23
0
Widget
CreateSpinBoxResourceControls( Widget parent, Widget top_widget, 
                               Widget left_widget, Widget right_widget )
                               
                
{
	XmString 	string;
	Widget  	SBResLabel, RowColumn;
	Widget  	ArrowLayoutLabel, ArrowLayoutPulldown, 
                        ArrowLayoutOptions, 
                	ArrowLayoutPB[NUM_ARROW_LAYOUT_BTNS]; 
	Widget  	ArrowSizeLabel, ArrowSizePulldown, ArrowSizeOptions, 
                	ArrowSizePB[NUM_ARROW_SIZE_BTNS]; 
	Widget  	DefArrowSensitiveLabel, DefArrowSensitivePulldown, 
                	DefArrowSensitiveOptions, 
                	DefArrowSensitivePB[NUM_DEF_ARROW_SENS_BTNS];
        Widget  	InitialDelayLabel, InitialDelayTF;
        Widget  	RepeatDelayLabel, RepeatDelayTF;
	int		i;
	char		buffer[30];

        n = 0;
        XtSetArg( args[n], XmNtopAttachment, XmATTACH_WIDGET ); n++;
        XtSetArg( args[n], XmNtopWidget, top_widget ); n++;
        XtSetArg( args[n], XmNleftAttachment, XmATTACH_WIDGET ); n++;
        XtSetArg( args[n], XmNleftWidget, left_widget ); n++;
        XtSetArg( args[n], XmNrightAttachment, XmATTACH_WIDGET ); n++;
        XtSetArg( args[n], XmNrightWidget, right_widget ); n++;
   	XtSetArg(args[n], XmNnumColumns, 5); n++;
   	XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
   	XtSetArg(args[n], XmNpacking, XmPACK_COLUMN); n++;
        RowColumn = XmCreateRowColumn( parent, "RowColumn", args, n );
        XtManageChild( RowColumn );

      /*
       *  Create label and option menu for XmNarrowLayout resource.
       */
        string = XmStringCreateLtoR("Arrow Layout",
                   XmFONTLIST_DEFAULT_TAG );
        n = 0;
        XtSetArg( args[n], XmNlabelString, string ); n++;
        ArrowLayoutLabel = XmCreateLabel( RowColumn, "ArrowLayoutLabel",
                             args, n );
        XtManageChild( ArrowLayoutLabel );
        XmStringFree( string );

        n = 0;
        ArrowLayoutPulldown = XmCreatePulldownMenu(RowColumn,
                                                   "ArrowLayoutPulldown",
                                                   args, n);

        for ( i = 0; i < NUM_ARROW_LAYOUT_BTNS; i++ )
        {
           string = XmStringCreateLtoR( arrow_layout_strings[i],
                      XmFONTLIST_DEFAULT_TAG );
           sprintf( buffer, "ArrowLayoutPB%d", i );
           n = 0;
           XtSetArg( args[n], XmNlabelString, string ); n++;
           ArrowLayoutPB[i] = 
           XmCreatePushButton( ArrowLayoutPulldown, buffer, args, n );
           XmStringFree( string );

           XtAddCallback( ArrowLayoutPB[i], XmNactivateCallback,
                          ArrowLayoutCB, (XtPointer)&arrow_layout[i] ); 
        }
        XtManageChildren( ArrowLayoutPB, NUM_ARROW_LAYOUT_BTNS );


        n = 0;
        XtSetArg( args[n], XmNmenuHistory, 
                  ArrowLayoutPB[NUM_ARROW_LAYOUT_BTNS - 1] ); n++;
        XtSetArg( args[n], XmNsubMenuId, ArrowLayoutPulldown ); n++;
        ArrowLayoutOptions =
        XmCreateOptionMenu( RowColumn, "ArrowLayoutOptions", args, n );
        XtManageChild( ArrowLayoutOptions );
        
      /*
       *  Create label and option menu for XmNarrowSize resource.
       */
        string = XmStringCreateLtoR("Arrow Size",
                   XmFONTLIST_DEFAULT_TAG );
        n = 0;
        XtSetArg( args[n], XmNlabelString, string ); n++;
        ArrowSizeLabel = XmCreateLabel( RowColumn, "ArrowSizeLabel",
                             args, n );
        XtManageChild( ArrowSizeLabel );
        XmStringFree( string );

        n = 0;
        ArrowSizePulldown = XmCreatePulldownMenu(RowColumn,
                                                 "ArrowSizePulldown",
                                                 args, n);

        for ( i = 0; i < NUM_ARROW_SIZE_BTNS; i++ )
        {
           string = XmStringCreateLtoR( arrow_size_strings[i],
                      XmFONTLIST_DEFAULT_TAG );
           sprintf( buffer, "ArrowSizePB%d", i );
           n = 0;
           XtSetArg( args[n], XmNlabelString, string ); n++;
           ArrowSizePB[i] =
           XmCreatePushButton( ArrowSizePulldown, buffer, args, n );
           XmStringFree( string );

           XtAddCallback( ArrowSizePB[i], XmNactivateCallback,
                          ArrowSizeCB, (XtPointer)arrow_size_strings[i] );
        }
        XtManageChildren( ArrowSizePB, NUM_ARROW_SIZE_BTNS );

        n = 0;
        XtSetArg( args[n], XmNmenuHistory, ArrowSizePB[0] ); n++;
        XtSetArg( args[n], XmNsubMenuId, ArrowSizePulldown ); n++;
        ArrowSizeOptions =
        XmCreateOptionMenu( RowColumn, "ArrowSizeOptions", args, n );
        XtManageChild( ArrowSizeOptions );

      /*
       *  Create label and option menu for XmNdefaultArrowSensitivity resource.
       */
        string = XmStringCreateLtoR("Default Arrow Sensitivity",
                   XmFONTLIST_DEFAULT_TAG );
                   
        n = 0;
        XtSetArg( args[n], XmNlabelString, string ); n++;
        DefArrowSensitiveLabel = 
        XmCreateLabel( RowColumn, "DefArrowSensitiveLabel", args, n );
        XtManageChild( DefArrowSensitiveLabel );
        XmStringFree( string );

        n = 0;
        DefArrowSensitivePulldown = 
        XmCreatePulldownMenu(RowColumn, "DefArrowSensitivePulldown",
                             args, n);

        for ( i = 0; i < NUM_DEF_ARROW_SENS_BTNS; i++ )
        {
           string = XmStringCreateLtoR( def_arrow_sens_strings[i],
                      XmFONTLIST_DEFAULT_TAG );
           sprintf( buffer, "DefArrowSensitivePB%d", i );
           n = 0;
           XtSetArg( args[n], XmNlabelString, string ); n++;
           DefArrowSensitivePB[i] =
           XmCreatePushButton( DefArrowSensitivePulldown, buffer, args, n );
           XmStringFree( string );

           XtAddCallback( DefArrowSensitivePB[i], XmNactivateCallback,
                          DefArrowSensitiveCB, (XtPointer)&def_arrow_sens[i] );
        }
        XtManageChildren( DefArrowSensitivePB, NUM_DEF_ARROW_SENS_BTNS );

        n = 0;
        XtSetArg( args[n], XmNmenuHistory, DefArrowSensitivePB[0] ); n++;
        XtSetArg( args[n], XmNsubMenuId, DefArrowSensitivePulldown ); n++;
        DefArrowSensitiveOptions =
        XmCreateOptionMenu( RowColumn, "DefArrowSensitiveOptions", args, n );
        XtManageChild( DefArrowSensitiveOptions );

      /*
       *  Create label and text field for XmNinitialDelay resource.
       */
        string = XmStringCreateLtoR("Initial Delay",
                   XmFONTLIST_DEFAULT_TAG );
        n = 0;
        XtSetArg( args[n], XmNlabelString, string ); n++;
        InitialDelayLabel =
        XmCreateLabel( RowColumn, "InitialDelayLabel", args, n );
        XtManageChild( InitialDelayLabel );
        XmStringFree( string );

        n = 0;
        XtSetArg( args[n], XmNvalue, "250" ); n++;
        InitialDelayTF = 
        XmCreateTextField( RowColumn, "InitialDelayTF", args, n );  
        XtManageChild( InitialDelayTF );

        XtAddCallback( InitialDelayTF, XmNactivateCallback,
                       InitialDelayCB, (XtPointer)0 );

      /*
       *  Create label and text field for XmNinitialDelay resource.
       */
        string = XmStringCreateLtoR("Repeat Delay",
                   XmFONTLIST_DEFAULT_TAG );
        n = 0;
        XtSetArg( args[n], XmNlabelString, string ); n++;
        RepeatDelayLabel =
        XmCreateLabel( RowColumn, "RepeatDelayLabel", args, n );
        XtManageChild( RepeatDelayLabel );
        XmStringFree( string );

        n = 0;
        XtSetArg( args[n], XmNvalue, "200" ); n++;
        RepeatDelayTF =
        XmCreateTextField( RowColumn, "RepeatDelayTF", args, n );
        XtManageChild( RepeatDelayTF );

        XtAddCallback( RepeatDelayTF, XmNactivateCallback,
                       RepeatDelayCB, (XtPointer)0 );
     
     return( RowColumn );
}
Example #24
0
void
main(int argc, char **argv)
{
	Widget	  MainForm, ControlPanel, Separator1, Separator2,
                  Label1, Label2;
	XmString  string;

	CommonTestInit( argc, argv );

        n = 0;
        XtSetArg( args[n], XmNx, 0 ); n++;
        XtSetArg( args[n], XmNy, 0 ); n++;
        XtSetValues( Shell1, args, n );

        XtRealizeWidget( Shell1 );

        n = 0;
        MainForm = XmCreateForm( Shell1, "MainForm", args, n );
        XtManageChild( MainForm );

        string = XmStringCreateLtoR("XmSTRING:", XmFONTLIST_DEFAULT_TAG );
        n = 0;
        XtSetArg( args[n], XmNtopAttachment, XmATTACH_FORM ); n++;
        XtSetArg( args[n], XmNleftAttachment, XmATTACH_FORM ); n++;
        XtSetArg( args[n], XmNwidth, SPIN_BOX_WIDTH ); n++;
        XtSetArg( args[n], XmNlabelString, string ); n++;
        XtSetArg( args[n], XmNalignment, XmALIGNMENT_CENTER ); n++;
        Label1 = XmCreateLabel( MainForm, "Label1", args, n );
        XtManageChild( Label1 );

        XmStringFree( string );
        n = 0;
        XtSetArg( args[n], XmNtopAttachment, XmATTACH_WIDGET ); n++;
        XtSetArg( args[n], XmNtopWidget, Label1 ); n++;
        XtSetArg( args[n], XmNleftAttachment, XmATTACH_FORM ); n++;
        XtSetArg( args[n], XmNwidth, SPIN_BOX_WIDTH ); n++;
        XtSetArg( args[n], XmNheight, SPIN_BOX_HEIGHT ); n++;
	XtSetArg( args[n], XmNarrowLayout, XmARROWS_FLAT_END ); n++;
	XtSetArg( args[n], XmNarrowOrientation, XmARROWS_HORIZONTAL ); n++;
        SpinBox1 = XmCreateSpinBox( MainForm, "SpinBox1", args, n );
        XtManageChild( SpinBox1 );

        n = 0;
        StringTextF = XmCreateTextField( SpinBox1, "StringTextF", args, n );
        XtManageChild( StringTextF );



        string = XmStringCreateLtoR("XmNUMERIC:", XmFONTLIST_DEFAULT_TAG );
        n = 0;
        XtSetArg( args[n], XmNtopAttachment, XmATTACH_FORM ); n++;
        XtSetArg( args[n], XmNleftAttachment, XmATTACH_WIDGET ); n++;
        XtSetArg( args[n], XmNleftWidget, Label1 ); n++;
        XtSetArg( args[n], XmNwidth, SPIN_BOX_WIDTH ); n++;
        XtSetArg( args[n], XmNlabelString, string ); n++;
        XtSetArg( args[n], XmNalignment, XmALIGNMENT_CENTER ); n++;
        Label2 = XmCreateLabel( MainForm, "Label2", args, n );
        XtManageChild( Label2 );
        XmStringFree( string );

        n = 0;
        XtSetArg( args[n], XmNtopAttachment, XmATTACH_WIDGET ); n++;
        XtSetArg( args[n], XmNtopWidget, Label2 ); n++;
        XtSetArg( args[n], XmNleftAttachment, XmATTACH_WIDGET ); n++;
        XtSetArg( args[n], XmNleftWidget, SpinBox1 ); n++;
        XtSetArg( args[n], XmNwidth, SPIN_BOX_WIDTH ); n++;
        XtSetArg( args[n], XmNheight, SPIN_BOX_HEIGHT ); n++;
	XtSetArg( args[n], XmNarrowLayout, XmARROWS_FLAT_END ); n++;
	XtSetArg( args[n], XmNarrowOrientation, XmARROWS_HORIZONTAL ); n++;
        SpinBox2 = XmCreateSpinBox( MainForm, "SpinBox2", args, n );
        XtManageChild( SpinBox2 );

        n = 0;
        NumericTextF = XmCreateTextField( SpinBox2, "NumericTextF", args, n );
        XtManageChild( NumericTextF );

	CreateControlPanel();

        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();
        CommonPause();

	MotifConvergeTP3();
	MotifConvergeTP4();
	MotifConvergeTP5();
	MotifConvergeTP6();
	MotifConvergeTP7();

        XtAppMainLoop( app_context );
}
Example #25
0
void gdbLookupSourceCB(Widget w, XtPointer client_data, XtPointer call_data)
{
    if (gdb->type() != GDB)
    {
	gdbOpenSourceCB(w, client_data, call_data);
	return;
    }

    static Widget dialog  = 0;

    if (dialog == 0)
    {
	Arg args[10];
	int arg = 0;
    
	XtSetArg(args[arg], XmNautoUnmanage, False); arg++;
#if XmVersion >= 1002
	XtSetArg(args[arg], XmNchildPlacement, XmPLACE_TOP); arg++;
#endif
	dialog = verify(XmCreateSelectionDialog(find_shell(w), 
						XMST("sources"), args, arg));

	Delay::register_shell(dialog);

	XtUnmanageChild(XmSelectionBoxGetChild(dialog, 
					       XmDIALOG_SELECTION_LABEL));
	XtUnmanageChild(XmSelectionBoxGetChild(dialog, 
					       XmDIALOG_TEXT));

	arg = 0;
	XtSetArg(args[arg], XmNmarginWidth,     0);     arg++;
	XtSetArg(args[arg], XmNmarginHeight,    0);     arg++;
	XtSetArg(args[arg], XmNborderWidth,     0);     arg++;
	XtSetArg(args[arg], XmNadjustMargin,    False); arg++;
	XtSetArg(args[arg], XmNshadowThickness, 0);     arg++;
	XtSetArg(args[arg], XmNspacing,         0);     arg++;
	Widget bigbox = XmCreateRowColumn(dialog, XMST("bigbox"), args, arg);
	XtManageChild(bigbox);

	arg = 0;
	XtSetArg(args[arg], XmNmarginWidth,     0);     arg++;
	XtSetArg(args[arg], XmNmarginHeight,    0);     arg++;
	XtSetArg(args[arg], XmNborderWidth,     0);     arg++;
	XtSetArg(args[arg], XmNadjustMargin,    False); arg++;
	XtSetArg(args[arg], XmNshadowThickness, 0);     arg++;
	XtSetArg(args[arg], XmNspacing,         0);     arg++;
	Widget box = XmCreateRowColumn(bigbox, XMST("box"), args, arg);
	XtManageChild(box);

	arg = 0;
	Widget label = XmCreateLabel(box, XMST("label"), args, arg);
	XtManageChild(label);

	arg = 0;
	source_filter = XmCreateTextField(box, XMST("filter"), args, arg);
	XtManageChild(source_filter);

	arg = 0;
	Widget sharedlibrary = 
	    XmCreatePushButton(bigbox, XMST("sharedlibrary"), args, arg);
	XtManageChild(sharedlibrary);

#if XmVersion >= 1002
	arg = 0;
	Widget lookup = XmCreatePushButton(dialog, 
					   XMST("lookup"), args, arg);
	XtManageChild(lookup);
#endif

	source_list = XmSelectionBoxGetChild(dialog, XmDIALOG_LIST);

	XtAddCallback(source_list, XmNsingleSelectionCallback,
		      SelectSourceCB, XtPointer(source_list));
	XtAddCallback(source_list, XmNmultipleSelectionCallback,
		      SelectSourceCB, XtPointer(source_list));
	XtAddCallback(source_list, XmNextendedSelectionCallback,
		      SelectSourceCB, XtPointer(source_list));
	XtAddCallback(source_list, XmNbrowseSelectionCallback,
		      SelectSourceCB, XtPointer(source_list));

	XtAddCallback(dialog, XmNokCallback, 
		      lookupSourceDone, XtPointer(source_list));
	XtAddCallback(dialog, XmNapplyCallback, FilterSourcesCB, 0);
	XtAddCallback(dialog, XmNcancelCallback, 
		      UnmanageThisCB, XtPointer(dialog));
	XtAddCallback(dialog, XmNunmapCallback, ClearStatusCB, 0);
	XtAddCallback(dialog, XmNhelpCallback, ImmediateHelpCB, 0);

	XtAddCallback(source_filter, XmNactivateCallback, 
		      FilterSourcesCB, 0);
	XtAddCallback(sharedlibrary, XmNactivateCallback, 
		      LoadSharedLibrariesCB, 0);

#if XmVersion >= 1002
	XtAddCallback(lookup, XmNactivateCallback, 
		      lookupSourceDone, XtPointer(source_list));
#endif
    }

    update_sources(source_list, source_filter);

    open_source_msg();
    manage_and_raise(dialog);
    warn_if_no_program(dialog);
}
Example #26
0
static Widget
h_create_fonts_frame(Widget top, struct topic_info *info)
{
    Widget darkness_form, darkness_label;

    UNUSED(info);
    
    darkness_form = XmCreateForm(top, "darkness_form", NULL, 0);
    XtVaSetValues(darkness_form,
		  XmNverticalSpacing, 10,
		  XmNhorizontalSpacing, 10,
		  NULL);

    
    darkness_label = XmCreateLabelGadget(darkness_form, "Font Darkness: ", NULL, 0);
    XtVaSetValues(darkness_label,
		  XmNtopAttachment, XmATTACH_FORM,
		  XmNleftAttachment, XmATTACH_FORM,
		  XmNbottomAttachment, XmATTACH_FORM,
		  NULL);
    XtManageChild(darkness_label);
    {
	Widget darkness_text;
#if USE_SPINBOX
	Widget darkness_spinbox = XmCreateSpinBox(darkness_form, Xdvi_DARKNESS_SPINBOX, NULL, 0);
	darkness_text = XmCreateTextField(darkness_spinbox, Xdvi_DARKNESS_TEXT, NULL, 0);
	XtVaSetValues(darkness_spinbox,
		      XmNtopAttachment, XmATTACH_FORM,
		      XmNleftAttachment, XmATTACH_WIDGET,
		      XmNleftWidget, darkness_label,
		      XmNinitialDelay, 200,
		      XmNrepeatDelay, 50,
		      NULL);
	XtVaSetValues(darkness_text,
		      XmNspinBoxChildType, XmNUMERIC,
		      XmNminimumValue, 0,
		      XmNmaximumValue, 1000,
		      XmNeditable, True,
		      XmNcolumns, 4,
		      XmNincrementValue, 1,
		      XmNwrap, False, /* too confusing */
		      XmNposition, (int)(resource.gamma * 100.0 + 0.5),
		      NULL);
	XtAddCallback(darkness_text, XmNactivateCallback, darkness_text_cb, (XtPointer)info);
	XtAddCallback(darkness_text, XmNvalueChangedCallback, darkness_text_cb, (XtPointer)info);

	adjust_heights(darkness_spinbox, darkness_text, darkness_label, NULL);
	
	XtManageChild(darkness_text);
	XtManageChild(darkness_spinbox);
#else
	char buf[LENGTH_OF_INT];
	Widget darkness_button;
	darkness_text = XmCreateTextField(darkness_form, Xdvi_DARKNESS_TEXT, NULL, 0);
	SNPRINTF(buf, LENGTH_OF_INT, "%d", (int)(resource.gamma * 100.0 + 0.5));
	XtVaSetValues(darkness_text,
		      XmNtopAttachment, XmATTACH_FORM,
		      XmNleftAttachment, XmATTACH_WIDGET,
		      XmNleftWidget, darkness_label,
		      XmNcolumns, 4,
		      XmNvalue, buf,
		      XmNuserData, darkness_text,
		      NULL);
	XtOverrideTranslations(darkness_text, XtParseTranslationTable("<Key>Return:activate()"));
	XtAddCallback(darkness_text, XmNactivateCallback, darkness_text_cb, (XtPointer)info);

	darkness_button = XmCreatePushButton(darkness_form, Xdvi_APPLY_STR, NULL, 0);
	XtVaSetValues(darkness_button,
		      XmNtopAttachment, XmATTACH_FORM,
		      XmNleftAttachment, XmATTACH_WIDGET,
		      XmNleftWidget, darkness_text,
		      XmNuserData, darkness_text,
		      NULL);
	XtAddCallback(darkness_button, XmNactivateCallback, darkness_text_cb, (XtPointer)info);
	
	adjust_heights(darkness_label, darkness_text, darkness_button, NULL);
	XtManageChild(darkness_text);
	XtManageChild(darkness_button);
#endif
    }
    
    /*     XtManageChild(darkness_form); */

    return darkness_form;
}
Example #27
0
Widget
_DtTermViewCreateGlobalOptionsDialog
(
    Widget		  parent
)
{
    OptionsDialogType	 *options;
    Widget		  cursorFrame;
    Widget		  cursorForm;
    Widget		  backgroundFrame;
    Widget		  backgroundForm;
    Widget		  scrollFrame;
    Widget		  scrollForm;
    Widget		  bellFrame;
    Widget		  bellForm;
    Widget		  label;
    Widget		  pulldown;
    Widget		  tmp;
    Widget		  separator;
    Widget		  button;
    Widget		  cancel;
    Widget		  reset;
    XmString		  string;
    XmString		  helpString;
    XmString		  okString;
    XmString		  cancelString;
    XmString		  resetString;
    Arg			  al[20];
    int			  ac;
    _DtTermViewLineupList *lineupList;
    DtTermViewWidget      tw = (DtTermViewWidget) parent;
    
    options = (OptionsDialogType *) XtMalloc(sizeof(OptionsDialogType));
    (void) memset(options, '\0', sizeof(*options));

    options->dtterm = tw->termview.term;

    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,34, "Terminal - Global Options")));
    okString = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,2, "OK")));
    cancelString = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,3, "Cancel")));
    helpString = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,4, "Help")));
    resetString = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,33, "Reset")));
    (void) XtSetArg(al[ac], XmNdialogTitle, string);			ac++;
    (void) XtSetArg(al[ac], XmNokLabelString, okString);		ac++;
    (void) XtSetArg(al[ac], XmNcancelLabelString, cancelString);	ac++;
    (void) XtSetArg(al[ac], XmNhelpLabelString, helpString);		ac++;
    (void) XtSetArg(al[ac], XmNautoUnmanage, False);			ac++;
    options->dialog = XmCreateTemplateDialog(parent, (GETMESSAGE(NL_SETN_ViewGlobalDialog,5, "global")), al, ac);
    (void) XmStringFree(okString);
    (void) XmStringFree(cancelString);
    (void) XmStringFree(helpString);
    (void) XtSetArg(al[0], XmNlabelString, resetString);
    reset = XmCreatePushButtonGadget(options->dialog, "ResetButton", al, 1);
    XtManageChild(reset);
    (void) XmStringFree(resetString);
    (void) XtAddCallback(reset, XmNactivateCallback,
	    MapGlobalOptionsDialogCallback, (XtPointer) options);
    (void) XtAddCallback(options->dialog, XmNokCallback,
	    OkGlobalOptionsDialogCallback, (XtPointer) options);
    (void) XtAddCallback(options->dialog, XmNcancelCallback,
	    CancelGlobalOptionsDialogCallback, (XtPointer) options);
    (void) XtAddCallback(options->dialog, XmNmapCallback,
	    MapGlobalOptionsDialogCallback, (XtPointer) options);
    (void) XtAddCallback(options->dialog, XmNhelpCallback,
	    HelpTerminalOptionsCallback, (XtPointer) tw);

    options->shell = XtParent(options->dialog);

    ac = 0;
    (void) XtSetArg(al[ac], XmNallowShellResize, False);		ac++;
    (void) XtSetValues(options->shell, al, ac);

    ac = 0;
    options->form = XmCreateForm(options->dialog, "form", al, ac);
    (void) XtManageChild(options->form);

    /****************************************************************
     ****************************************************************
     *** Cursor parameters...
     ***/
    ac = 0;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], DtNmarginWidth, 5);				ac++;
    (void) XtSetArg(al[ac], DtNmarginHeight, 5);			ac++;
    cursorFrame = XmCreateFrame(options->form, "cursorFrame", al, ac);
    (void) XtManageChild(cursorFrame);

    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,6, "Cursor Control")));
    (void) XtSetArg(al[ac], XmNlabelString, string);			ac++;
    (void) XtSetArg(al[ac], XmNchildType, XmFRAME_TITLE_CHILD);		ac++;
    (void) XtSetArg(al[ac], XmNtraversalOn, False);			ac++;
    label = XmCreateLabelGadget(cursorFrame, "cursorFrameLabel", al, ac);
    (void) XmStringFree(string);
    (void) XtManageChild(label);

    ac = 0;
    cursorForm = XmCreateForm(cursorFrame, "cursorForm", al, ac);

    /****************************************************************
     * option menu: type [ box | underline ]
     */
    pulldown =
	    _DtTermViewCreatePulldown(cursorForm, "cursorTypePulldown");
    options->cursor.type.box =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,7, "Box")), NoSymbol, NULL, NULL, NULL, NULL);
    options->cursor.type.underline =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,8, "Underline")), NoSymbol, NULL, NULL, NULL, NULL);
    options->cursor.type.invisible =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,14, "Invisible")), NoSymbol, NULL, NULL, NULL, NULL);

    ac = 0;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    tmp = _DtTermViewCreateOptionMenu(cursorForm, pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,9, "Cursor Style")), NoSymbol, al, ac);
    options->cursor.type.option = tmp;

    /* add to the lineup list... */
    lineupList = _DtTermViewLineupListCreate();
    (void) _DtTermViewLineupListAddItem(lineupList,
	    XmOptionLabelGadget(options->cursor.type.option),
	    options->cursor.type.option,
	    CORRECTION_OPTION_MENU);

    /****************************************************************
     * option menu: blink [ on | off ]
     */
    pulldown =
	    _DtTermViewCreatePulldown(cursorForm, "cursorBlinkPulldown");
    (void) XtAddCallback(pulldown, XmNentryCallback,
	    CursorBlinkCallback, (XtPointer) options);
    options->cursor.blink.on =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,10, "Enabled")), NoSymbol, NULL, NULL, NULL, NULL);
    options->cursor.blink.off =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,11, "Disabled")), NoSymbol, NULL, NULL, NULL, NULL);

    ac = 0;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, tmp);				ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    tmp = _DtTermViewCreateOptionMenu(cursorForm, pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,12, "Blinking Cursor")), NoSymbol, al, ac);
    options->cursor.blink.option = tmp;

    /* add to the lineup list... */
    (void) _DtTermViewLineupListAddItem(lineupList,
	    XmOptionLabelGadget(options->cursor.blink.option),
	    options->cursor.blink.option,
	    CORRECTION_OPTION_MENU);

    /****************************************************************
     * text field: blink rate _250_
     */

    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,13, "Blink Rate (milliseconds)")));
    (void) XtSetArg(al[ac], XmNlabelString, string);			ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, tmp);				ac++;
    (void) XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM);	ac++;
    (void) XtSetArg(al[ac], XmNtraversalOn, False);	ac++;
    options->cursor.blinkRate.label =
	    XmCreateLabelGadget(cursorForm, "blinkRateLabel", al, ac);
    (void) XmStringFree(string);
    (void) XtManageChild(options->cursor.blinkRate.label);

    ac = 0;
    (void) XtSetArg(al[ac], DtNcolumns, 4);				ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET);	ac++;
    (void) XtSetArg(al[ac], XmNleftWidget, options->cursor.blinkRate.label);
									ac++;
    (void) XtSetArg(al[ac], XmNleftOffset, CORRECTION_TEXT_OFFSET);	ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, tmp);				ac++;
    (void) XtSetArg(al[ac], XmNnavigationType, XmNONE);  		ac++;
    options->cursor.blinkRate.text =
	    XmCreateTextField(cursorForm, (GETMESSAGE(NL_SETN_ViewGlobalDialog,15, "blinkRate")), al, ac);
    (void) XtManageChild(options->cursor.blinkRate.text);
    options->cursor.blinkRate.oldBlinkRate = 0;

    /* make the label and textfield the same height... */
    _DtTermViewEqualizeHeights(options->cursor.blinkRate.label,
	    options->cursor.blinkRate.text);

    /* add to the lineup list... */
    (void) _DtTermViewLineupListAddItem(lineupList,
	    options->cursor.blinkRate.label,
	    options->cursor.blinkRate.text,
	    CORRECTION_LABEL);

    /* manage the cursor form... */
    (void) XtManageChild(cursorForm);


    /****************************************************************
     ****************************************************************
     **** Background parameters...
     ***/
    ac = 0;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, cursorFrame);		ac++;
    (void) XtSetArg(al[ac], XmNtopOffset, 5);				ac++;
    (void) XtSetArg(al[ac], DtNmarginWidth, 5);				ac++;
    (void) XtSetArg(al[ac], DtNmarginHeight, 5);			ac++;
    backgroundFrame = XmCreateFrame(options->form, "backgroundFrame",
	    al, ac);
    (void) XtManageChild(backgroundFrame);

    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,16, "Color Control")));
    (void) XtSetArg(al[ac], XmNlabelString, string);			ac++;
    (void) XtSetArg(al[ac], XmNchildType, XmFRAME_TITLE_CHILD);		ac++;
    (void) XtSetArg(al[ac], XmNtraversalOn, False);			ac++;
    label = XmCreateLabelGadget(backgroundFrame, "backgroundFrameLabel",
	    al, ac);
    (void) XmStringFree(string);
    (void) XtManageChild(label);

    ac = 0;
    backgroundForm = XmCreateForm(backgroundFrame, "backgroundForm", al, ac);

    /****************************************************************
     * option menu: inverse video [on | off ]
     */

    pulldown =
	    _DtTermViewCreatePulldown(backgroundForm, "inverseVideoPulldown");
    options->background.inverse.off =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,18, "Normal")), NoSymbol,
	    NULL, NULL, NULL, NULL);
    options->background.inverse.on =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,17, "Inverse")), NoSymbol,
	    NULL, NULL, NULL, NULL);
    
    ac = 0;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM);	ac++;
    tmp = _DtTermViewCreateOptionMenu(backgroundForm, pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,19, "Window Background")), NoSymbol, al, ac);
    options->background.inverse.option = tmp;

    /* add to the lineup list... */
    (void) _DtTermViewLineupListAddItem(lineupList,
	    XmOptionLabelGadget(options->background.inverse.option),
	    options->background.inverse.option,
	    CORRECTION_OPTION_MENU);

    /* manage the cursor form... */
    (void) XtManageChild(backgroundForm);

    
    /****************************************************************
     ****************************************************************
     **** Scroll parameters...
     ***/
    ac = 0;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, backgroundFrame);		ac++;
    (void) XtSetArg(al[ac], XmNtopOffset, 5);				ac++;
    (void) XtSetArg(al[ac], DtNmarginWidth, 5);				ac++;
    (void) XtSetArg(al[ac], DtNmarginHeight, 5);			ac++;
    scrollFrame = XmCreateFrame(options->form, "scrollFrame", al, ac);
    (void) XtManageChild(scrollFrame);

    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,20, "Scroll Behavior")));
    (void) XtSetArg(al[ac], XmNlabelString, string);			ac++;
    (void) XtSetArg(al[ac], XmNchildType, XmFRAME_TITLE_CHILD);		ac++;
    (void) XtSetArg(al[ac], XmNtraversalOn, False);			ac++;
    label = XmCreateLabelGadget(scrollFrame, "scrollFrameLabel", al, ac);
    (void) XmStringFree(string);
    (void) XtManageChild(label);

    ac = 0;
    scrollForm = XmCreateForm(scrollFrame, "scrollForm", al, ac);

    /****************************************************************
     * option menu: type [jump | smooth ]
     */
    pulldown =
	    _DtTermViewCreatePulldown(scrollForm, "ScrollTypePulldown");
    options->scroll.type.jump =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,21, "Disabled")), NoSymbol, NULL, NULL, NULL, NULL);
    options->scroll.type.smooth =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,22, "Enabled")), NoSymbol, NULL, NULL, NULL, NULL);
    
    ac = 0;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM);	ac++;
    tmp = _DtTermViewCreateOptionMenu(scrollForm, pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,23, "Smooth Scrolling")), NoSymbol, al, ac);
    options->scroll.type.option = tmp;

    /* add to the lineup list... */
    (void) _DtTermViewLineupListAddItem(lineupList,
	    XmOptionLabelGadget(options->scroll.type.option),
	    options->scroll.type.option,
	    CORRECTION_OPTION_MENU);

    /* manage the cursor form... */
    (void) XtManageChild(scrollForm);


    /****************************************************************
     ****************************************************************
     *** Bell parameters...
     ***/
    ac = 0;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, scrollFrame);			ac++;
    (void) XtSetArg(al[ac], XmNtopOffset, 5);				ac++;
    (void) XtSetArg(al[ac], DtNmarginWidth, 5);				ac++;
    (void) XtSetArg(al[ac], DtNmarginHeight, 5);			ac++;
    bellFrame = XmCreateFrame(options->form, "bellFrame",
	    al, ac);
    (void) XtManageChild(bellFrame);

    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,24, "Bell Control")));
    (void) XtSetArg(al[ac], XmNlabelString, string);			ac++;
    (void) XtSetArg(al[ac], XmNchildType, XmFRAME_TITLE_CHILD);		ac++;
    (void) XtSetArg(al[ac], XmNtraversalOn, False);			ac++;
    label = XmCreateLabelGadget(bellFrame, "bellFrameLabel", al, ac);
    (void) XmStringFree(string);
    (void) XtManageChild(label);

    ac = 0;
    bellForm = XmCreateForm(bellFrame, "bellForm", al, ac);

    /****************************************************************
     * option menu: Type [audible | visible ]
     */
    pulldown =
	    _DtTermViewCreatePulldown(bellForm, "typePulldown");
    options->bell.type.audible =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,25, "Audible")), NoSymbol, NULL, NULL, NULL, NULL);
    options->bell.type.visual =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,26, "Visible")), NoSymbol, NULL, NULL, NULL, NULL);
    
    ac = 0;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    tmp = _DtTermViewCreateOptionMenu(bellForm, pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,27, "Bell Type")), NoSymbol, al, ac);
    options->bell.type.option = tmp;

    /* add to the lineup list... */
    (void) _DtTermViewLineupListAddItem(lineupList,
	    XmOptionLabelGadget(options->bell.type.option),
	    options->bell.type.option,
	    CORRECTION_OPTION_MENU);


    /****************************************************************
     * option menu: Margin Bell [on | off ]
     */
    pulldown =
	    _DtTermViewCreatePulldown(bellForm, "bellMarginPulldown");
    (void) XtAddCallback(pulldown, XmNentryCallback,
	    BellMarginCallback, (XtPointer) options);
    options->bell.bellMargin.on =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,28, "Enabled")), NoSymbol, NULL, NULL, NULL, NULL);
    options->bell.bellMargin.off =
	    _DtTermViewCreatePushButton(pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,29, "Disabled")), NoSymbol, NULL, NULL, NULL, NULL);
    
    ac = 0;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, tmp);				ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);		ac++;
    tmp = _DtTermViewCreateOptionMenu(bellForm, pulldown,
	    (GETMESSAGE(NL_SETN_ViewGlobalDialog,30, "Margin Warning")), NoSymbol, al, ac);
    options->bell.bellMargin.option = tmp;

    /* add to the lineup list... */
    (void) _DtTermViewLineupListAddItem(lineupList,
	    XmOptionLabelGadget(options->bell.bellMargin.option),
	    options->bell.bellMargin.option,
	    CORRECTION_OPTION_MENU);

    /****************************************************************
     * text field: Margin _8_
     */
    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,31, "Margin Distance")));
    (void) XtSetArg(al[ac], XmNlabelString, string);			ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM);		ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, tmp);				ac++;
    (void) XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM);	ac++;
    (void) XtSetArg(al[ac], XmNtraversalOn, False);	ac++;
    options->bell.bellMarginDistance.label =
	    XmCreateLabelGadget(bellForm, "bellMarginDistanceLabel", al, ac);
    (void) XmStringFree(string);
    (void) XtManageChild(options->bell.bellMarginDistance.label);

    ac = 0;
    (void) XtSetArg(al[ac], DtNcolumns, 3);				ac++;
    (void) XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET);	ac++;
    (void) XtSetArg(al[ac], XmNleftWidget,
	    options->bell.bellMarginDistance.label);			ac++;
    (void) XtSetArg(al[ac], XmNleftOffset, CORRECTION_TEXT_OFFSET);	ac++;
    (void) XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET);		ac++;
    (void) XtSetArg(al[ac], XmNtopWidget, tmp);				ac++;
    (void) XtSetArg(al[ac], XmNnavigationType, XmNONE);  		ac++;
    options->bell.bellMarginDistance.text =
	    XmCreateTextField(bellForm, "margin", al, ac);
    (void) XtManageChild(options->bell.bellMarginDistance.text);

    /* make the label and textfield the same height... */
    _DtTermViewEqualizeHeights(options->bell.bellMarginDistance.label,
	    options->bell.bellMarginDistance.text);

    /* add to the lineup list... */
    (void) _DtTermViewLineupListAddItem(lineupList,
	    options->bell.bellMarginDistance.label,
	    options->bell.bellMarginDistance.text,
	    CORRECTION_LABEL);

    /* manage the margin form... */
    (void) XtManageChild(bellForm);

    /* lineup all the labels... */
    (void) _DtTermViewLineupListLineup(lineupList);
    (void) _DtTermViewLineupListFree(lineupList);
    lineupList = (_DtTermViewLineupList *) 0;

    /* create the apply button... */
    ac = 0;
    string = XmStringCreateLocalized((GETMESSAGE(NL_SETN_ViewGlobalDialog,32, "Apply")));
    (void) XtSetArg(al[ac], XmNlabelString, string);			ac++;
    button = XmCreatePushButtonGadget(options->dialog, "apply", al, ac);
    (void) XmStringFree(string);
    (void) XtAddCallback(button, XmNactivateCallback,
	    ApplyGlobalOptionsDialogCallback, (XtPointer) options);
    (void) XtManageChild(button);

    ac = 0;
    (void) XtSetArg(al[ac], XmNmwmFunctions, MWM_FUNC_MOVE);		ac++;
    (void) XtSetArg(al[ac], XmNmwmDecorations,
	    MWM_DECOR_MENU | MWM_DECOR_BORDER | MWM_DECOR_TITLE);	ac++;
    (void) XtSetValues(options->shell, al, ac);

    (void) XtManageChild(options->dialog);


    return(options->dialog);
}
Example #28
0
void 
  create_appShell (Display *display, char *app_name, int app_argc, char **app_argv)
{
	Widget children[12];      /* Children to manage */
	Arg al[64];           /* Arg List */
	register int ac = 0;      /* Arg Count */
	char from_s [256];    /* For font list conversion */
	XrmValue from_value, to_value; /* ditto */
	int fg, bg;           /* colour values for pixmaps */ 
	XmString *list_items; /* For list items */
	int list_item;        /* Index for list_items */
	XmString xmstrings[15];    /* temporary storage for XmStrings */
	Widget widget1 = (Widget)NULL;
	Widget widget2 = (Widget)NULL;
	Widget widget3 = (Widget)NULL;
	Widget widget7 = (Widget)NULL;
	Widget widget8 = (Widget)NULL;
	Widget widget9 = (Widget)NULL;
	Widget widget10 = (Widget)NULL;
	Widget widget11 = (Widget)NULL;
	Widget widget12 = (Widget)NULL;
	Widget generateButton = (Widget)NULL;
	Widget deleteButton = (Widget)NULL;
	Widget browseButton = (Widget)NULL;
	Widget widget13 = (Widget)NULL;
	Widget widget14 = (Widget)NULL;
	Widget widget15 = (Widget)NULL;
	Widget widget16 = (Widget)NULL;
	Widget widget17 = (Widget)NULL;
	Widget nameLabel = (Widget)NULL;
	Widget textLabel = (Widget)NULL;
	Widget severityLabel = (Widget)NULL;
	Widget widget25 = (Widget)NULL;
	Widget widget27 = (Widget)NULL;
	Widget widget28 = (Widget)NULL;
	Widget widget29 = (Widget)NULL;
	Widget widget30 = (Widget)NULL;
	Widget widget31 = (Widget)NULL;
	Widget widget32 = (Widget)NULL;
	Widget widget33 = (Widget)NULL;
	Widget moduleLabel = (Widget)NULL;
	Widget widget37 = (Widget)NULL;
	Widget *modbutton;	/* replaces 38-49 */
	Widget categoryLabel = (Widget)NULL;
	Widget descriptionLabel = (Widget)NULL;
	Widget toolMenu = (Widget)NULL;
	Widget toolCascade = (Widget)NULL;
	Widget lockMenu = (Widget)NULL;
	Widget lockCascade = (Widget)NULL;
	Widget unlockButton = (Widget)NULL;
	Widget lockButton = (Widget)NULL;
	int imod;
	XtSetArg(al[ac], XmNallowShellResize, TRUE); ac++;
	XtSetArg(al[ac], XmNargc, app_argc); ac++;
	XtSetArg(al[ac], XmNargv, app_argv); ac++;
	appShell = XtAppCreateShell ( app_name, "EditMessage", applicationShellWidgetClass, display, al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNscrollingPolicy, XmAUTOMATIC); ac++;
	widget1 = XmCreateMainWindow ( appShell, "mainWindow", al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNhorizontalScrollBar, &widget2 ); ac++;
	XtSetArg(al[ac], XmNverticalScrollBar, &widget3 ); ac++;
	XtGetValues(widget1, al, ac );
	ac = 0;
	widget7 = XmCreateMenuBar ( widget1, "widget7", al, ac );
	widget9 = XmCreatePulldownMenu ( widget7, "fileMenu", al, ac );
	/*
	XtAddCallback(widget9, XmNunmapCallback, grab_input, NULL);
	*/
	widget10 = XmCreatePushButton ( widget9, "openButton", al, ac );
	widget11 = XmCreatePushButton ( widget9, "newButton", al, ac );
	ac = 0; XtSetArg(al[ac], XmNsensitive, False); ac++;
	widget12 = XmCreatePushButton ( widget9, "saveButton", al, ac );
	ac = 0; XtSetArg(al[ac], XmNsensitive, False); ac++;
	deleteButton = XmCreatePushButton ( widget9, "deleteButton", al, ac );
	ac = 0;
	widget13 = XmCreateSeparator ( widget9, "widget13", al, ac );
	widget14 = XmCreatePushButton ( widget9, "exitButton", al, ac );
	XtSetArg(al[ac], XmNsubMenuId, widget9); ac++;
	widget8 = XmCreateCascadeButton ( widget7, "fileCascade", al, ac );
	ac = 0;
	toolMenu =  XmCreatePulldownMenu ( widget7, "toolMenu", al, ac );
	/*
	XtAddCallback(toolMenu, XmNunmapCallback, grab_input, NULL);
	*/
	generateButton = XmCreatePushButton ( toolMenu, "generateButton", al, ac );
	browseButton = XmCreatePushButton ( toolMenu, "browseButton", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNsubMenuId, toolMenu); ac++;
	toolCascade = XmCreateCascadeButton ( widget7, "toolCascade", al, ac );

	lockMenu = XmCreatePulldownMenu ( widget7, "lockMenu", al, ac );
	/*
	XtAddCallback(widget9, XmNunmapCallback, grab_input, NULL);
	*/
	lockButton = XmCreatePushButton ( lockMenu, "lockButton", al, ac );
	ac = 0; XtSetArg(al[ac], XmNsensitive, False); ac++;
	unlockButton = XmCreatePushButton ( lockMenu, "unlockButton", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNsubMenuId, lockMenu); ac++;
	lockCascade = XmCreateCascadeButton ( widget7, "lockCascade", al, ac );

	ac = 0;
	widget16 = XmCreatePulldownMenu ( widget7, "widget16", al, ac );
	/*
	XtAddCallback(widget16, XmNunmapCallback, grab_input, NULL);
	*/
	XtSetArg(al[ac], XmNsubMenuId, widget16); ac++;
	widget15 = XmCreateCascadeButton ( widget7, "helpCascade", al, ac );

	/* Hand-added */
	XtVaSetValues(widget7, XmNmenuHelpWidget, widget15, NULL);

	ac = 0; 
	widget17 = XmCreateForm ( widget1, "editMsgForm", al, ac );
	XtSetArg(al[ac], XmNwidth, 100); ac++;
	XtSetArg(al[ac], XmNalignment, XmALIGNMENT_END); ac++;
	nameLabel = XmCreateLabel ( widget17, "nameLabel", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNalignment, XmALIGNMENT_END); ac++;
	textLabel = XmCreateLabel ( widget17, "textLabel", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNmaxLength, 20); ac++;
	nameTextField = XmCreateTextField( widget17, "nameTextField", al, ac );
	XtAddCallback(nameTextField, XmNvalueChangedCallback, message_modified,
		      NULL);
	ac = 0;
	XtSetArg(al[ac], XmNmaxLength, 50); ac++;
	msgTextField = XmCreateTextField ( widget17, "msgTextField", al, ac );
	XtAddCallback(msgTextField, XmNvalueChangedCallback, message_modified,
		      NULL);
	ac = 0;
	XtSetArg(al[ac], XmNalignment, XmALIGNMENT_END); ac++;
	severityLabel = XmCreateLabel ( widget17, "severityLabel", al, ac );
	ac = 0;
	severityMenu = XmCreatePulldownMenu ( widget17, "severityPulldown", al, ac );
	/*
	XtAddCallback(severityMenu, XmNunmapCallback, grab_input, NULL);
	*/
	XtSetArg(al[0], XmNuserData, (caddr_t)SEV_DEBUG);
	widget27 = XmCreatePushButton ( severityMenu, "debugButton", al, 1);
	XtSetArg(al[0], XmNuserData, (caddr_t)SEV_INFORM);
	widget28 = XmCreatePushButton ( severityMenu, "informButton", al, 1 );
	XtSetArg(al[0], XmNuserData, (caddr_t)SEV_WARN);
	widget29 = XmCreatePushButton ( severityMenu, "warnButton", al, 1 );
	XtSetArg(al[0], XmNuserData, (caddr_t)SEV_ERROR);
	widget30 = XmCreatePushButton ( severityMenu, "errorButton", al, 1 );
	XtSetArg(al[0], XmNuserData, (caddr_t)SEV_ALARM);
	widget31 = XmCreatePushButton ( severityMenu, "alarmButton", al, 1 );
	XtSetArg(al[0], XmNuserData, (caddr_t)SEV_FATAL);
	widget32 = XmCreatePushButton ( severityMenu, "fatalButton", al, 1 );
	ac = 0;
	XtSetArg(al[ac], XmNuserData, (caddr_t)SEV_UNKNOWN); ac++;
	/* "Unknown" is only allowed if it is found in the DB */
	XtSetArg(al[ac], XmNsensitive, FALSE); ac++;
	widget33 = XmCreatePushButton (severityMenu, "unknownButton", al, ac );

	ac = 0;
	XtSetArg(al[ac], XmNsubMenuId, severityMenu); ac++;
	severityOptionMenu = XmCreateOptionMenu ( widget17, "severityOptionMenu", al, ac );
	ac = 0;
	widget25 = XmOptionButtonGadget ( severityOptionMenu );
	XtSetArg(al[ac], XmNalignment, XmALIGNMENT_END); ac++;
	moduleLabel = XmCreateLabel ( widget17, "moduleLabel", al, ac );
	ac = 0;
	moduleMenu = XmCreatePulldownMenu ( widget17, "moduleMenu", al, ac );
	/*
	XtAddCallback(moduleMenu, XmNunmapCallback, grab_input, NULL);
	*/
	
	/* Create the button for the chosen module as the default.
	   */
	if (strcmp(module_names[0], g_module)) {
	  for (imod=0; imod<nmodule_names; imod++) 
	    if (!strcmp(module_names[imod], g_module)) break;
	  strcpy(module_names[imod], module_names[0]);
	  strcpy(module_names[0], g_module);
	}
	modbutton = (Widget *)XtMalloc(nmodule_names * sizeof(Widget));
	for (imod = 0; imod < nmodule_names; imod++) {
	  XtSetArg(al[0], XmNuserData, module_names[imod]);
	  modbutton[imod] = XmCreatePushButton(moduleMenu, module_names[imod], 
					       al, 1 );
	}
	XtSetArg(al[ac], XmNsubMenuId, moduleMenu); ac++;
	moduleOptionMenu = XmCreateOptionMenu ( widget17, "moduleOptionMenu", al, ac );
	ac = 0;
	widget37 = XmOptionButtonGadget ( moduleOptionMenu );
	XtSetArg(al[ac], XmNalignment, XmALIGNMENT_END); ac++;
	categoryLabel = XmCreateLabel ( widget17, "categoryLabel", al, ac );
	ac = 0;
	categoryTextField = XmCreateTextField ( widget17, "categoryTextField", al, ac );
	XtAddCallback(categoryTextField, XmNvalueChangedCallback, 
		      message_modified, NULL);
	XtSetArg(al[ac], XmNwidth, 101); ac++;
	XtSetArg(al[ac], XmNalignment, XmALIGNMENT_END); ac++;
	descriptionLabel = XmCreateLabel ( widget17, "descriptionLabel", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNmaxLength, 255); ac++;
	descriptionText = XmCreateText ( widget17, "descriptionText", al, ac );
	XtAddCallback(descriptionText, XmNvalueChangedCallback, 
		      message_modified, NULL);
	ac = 0;
	children[ac++] = widget10;
	children[ac++] = widget11;
	children[ac++] = widget12;
	children[ac++] = deleteButton;
	children[ac++] = widget13;
	children[ac++] = widget14;
	XtManageChildren(children, ac);

	ac = 0;
	children[ac++] = generateButton;
	children[ac++] = browseButton;
	XtManageChildren(children, ac);

	ac = 0;
	children[ac++] = unlockButton;
	children[ac++] = lockButton;
	XtManageChildren(children, ac);

	ac = 0;
	children[ac++] = widget8;
	children[ac++] = widget15;
	children[ac++] = toolCascade;
	children[ac++] = lockCascade;
	XtManageChildren(children, ac);

	ac = 0;
	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopWidget, nameTextField); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
	XtSetArg(al[ac], XmNbottomWidget, nameTextField); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNrightWidget, nameTextField); ac++;
        XtSetValues ( nameLabel,al, ac );

	ac = 0;
	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopWidget, msgTextField); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
	XtSetArg(al[ac], XmNbottomWidget, msgTextField); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNrightWidget, msgTextField); ac++;
        XtSetValues ( textLabel,al, ac );

	ac = 0;
	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_POSITION); ac++;

        XtSetValues ( nameTextField,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopWidget, nameTextField); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
	XtSetArg(al[ac], XmNleftWidget, nameTextField); ac++;
        XtSetValues ( msgTextField,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopWidget, severityOptionMenu); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
	XtSetArg(al[ac], XmNbottomWidget, severityOptionMenu); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNrightWidget, severityOptionMenu); ac++;
        XtSetValues ( severityLabel,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopWidget, msgTextField); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
	XtSetArg(al[ac], XmNleftWidget, msgTextField); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
        XtSetValues ( severityOptionMenu,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopWidget, moduleOptionMenu); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
	XtSetArg(al[ac], XmNbottomWidget, moduleOptionMenu); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftOffset, 0); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNrightWidget, moduleOptionMenu); ac++;
        XtSetValues ( moduleLabel,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopWidget, severityOptionMenu); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
	XtSetArg(al[ac], XmNleftWidget, severityOptionMenu); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
        XtSetValues ( moduleOptionMenu,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopWidget, categoryTextField); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
	XtSetArg(al[ac], XmNbottomWidget, categoryTextField); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNrightWidget, categoryTextField); ac++;
        XtSetValues ( categoryLabel,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopWidget, moduleOptionMenu); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
	XtSetArg(al[ac], XmNleftWidget, moduleOptionMenu); ac++;
        XtSetValues ( categoryTextField,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopWidget, descriptionText); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
	XtSetArg(al[ac], XmNbottomWidget, descriptionText); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNrightAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNrightWidget, descriptionText); ac++;
        XtSetValues ( descriptionLabel,al, ac );
	ac = 0;

	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
	XtSetArg(al[ac], XmNtopWidget, categoryTextField); ac++;
	XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); ac++;
	XtSetArg(al[ac], XmNleftWidget, categoryTextField); ac++;
        XtSetValues ( descriptionText,al, ac );

	XtAddCallback(widget10, XmNactivateCallback, open_message, NULL);
	XtAddCallback(browseButton, XmNactivateCallback, browse_messages, 
		      g_module);
	XtAddCallback(widget11, XmNactivateCallback, new_message, NULL);
	XtAddCallback(widget12, XmNactivateCallback, save_message, NULL);
	XtAddCallback(deleteButton, XmNactivateCallback, delete_message, NULL);
	XtAddCallback(generateButton, XmNactivateCallback, generate_header, NULL);
	XtAddCallback(lockButton, XmNactivateCallback, set_lock, widget9);
	XtAddCallback(unlockButton, XmNactivateCallback, unset_lock, widget9);
	XtAddCallback(widget14, XmNactivateCallback, exit_app, NULL);
	XtAddCallback(widget27, XmNactivateCallback, set_severity, NULL);
	XtAddCallback(widget28, XmNactivateCallback, set_severity, NULL);
	XtAddCallback(widget29, XmNactivateCallback, set_severity, NULL);
	XtAddCallback(widget30, XmNactivateCallback, set_severity, NULL);
	XtAddCallback(widget31, XmNactivateCallback, set_severity, NULL);
	XtAddCallback(widget32, XmNactivateCallback, set_severity, NULL);
	XtAddCallback(widget33, XmNactivateCallback, set_severity, NULL);
	for (imod = 0; imod < nmodule_names; imod++)
	  XtAddCallback(modbutton[imod], XmNactivateCallback, set_module, 
			NULL);
	ac = 0;
	children[ac++] = widget27;
	children[ac++] = widget28;
	children[ac++] = widget29;
	children[ac++] = widget30;
	children[ac++] = widget31;
	children[ac++] = widget32;
	children[ac++] = widget33;
	XtManageChildren(children, ac);
	XtManageChildren(modbutton, nmodule_names);
	ac = 0;
	children[ac++] = nameLabel;
	children[ac++] = textLabel;
	children[ac++] = nameTextField;
	children[ac++] = msgTextField;
	children[ac++] = severityLabel;
	children[ac++] = severityOptionMenu;
	children[ac++] = moduleLabel;
	children[ac++] = moduleOptionMenu;
	children[ac++] = categoryLabel;
	children[ac++] = categoryTextField;
	children[ac++] = descriptionLabel;
	children[ac++] = descriptionText;
	XtManageChildren(children, ac);
	ac = 0;
	XtManageChild ( widget7 );
	XtManageChild ( widget17 );
	XmMainWindowSetAreas(widget1, widget7, (Widget) NULL, widget2, widget3, widget17 );
	XtManageChild ( widget1);
}
Example #29
0
File: gwgtext.c Project: oeli/yafra
/*F--------------------------------------------------------------------------
 *  Function:	xGRwidget_textfeld ()
 *					-create a labelled frame and a form as child
 *					-insert a pushbutton, a text and an input field 
 *  In:			-the parent
 *  out:			-
 *  Return:		-the form of the labelled frame
 *---------------------------------------------------------------------------
 */
Widget xGRwidget_textfeld( Widget parent)
{
	extern char			*xgrLabelTable[][XGRLABMAXTEXTS];
	extern GRAWIDGETS grawidgets;

	static ACTCALLBACK antwort = {BUTTONTEXTFELDANTWORT, 0};
	static ACTCALLBACK quit    = {BUTTONTEXTFELDQUIT,    0};

	Widget	textfeld, autoform, labelledFrame;   
	Arg		args[8];
	int		n;

	/*--- Labelled Frame and child ------*/
	labelledFrame = xUIframelabel( parent, &autoform, GRAPHIKTEXTFELD, LABEL_GRAPHIKTEXTFELD );
	textfeld = XmCreateForm( labelledFrame, GRAPHIKFORM, 0, 0);
	XtManageChild( textfeld);

	/*--- Button End ---------*/
	n=0;
	XtSetArg(args[n], XmNlabelString,
	XmStringCreateSimple(LABEL_GRAPHIKTEXTFELDQUIT));  n++;
	grawidgets.textfeldquit =
							XmCreatePushButton(textfeld, GRAPHIKTEXTFELDQUIT, args, n);
	XtManageChild(grawidgets.textfeldquit);
	
	/*--- Text ---------------*/
	n=0;
	XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT);  n++;
	XtSetArg(args[n], XmNeditable, False);              n++;
	XtSetArg(args[n], XmNrows, MAXROWS);                n++;
	XtSetArg(args[n], XmNcolumns, _CHAR30);             n++;
	XtSetArg(args[n], XmNmaxLength, MAXROWS*_CHAR30);   n++;
	XtSetArg(args[n], XmNwordWrap, True);               n++;
	XtSetArg(args[n], XmNcursorPositionVisible, False); n++;
	grawidgets.frage = XmCreateText(textfeld, GRAPHIKFRAGE, args, n);
	XtManageChild(grawidgets.frage);

	/*--- Response field -----*/
	n=0;
	XtSetArg(args[n], XmNcolumns, _CHAR30);             n++;
	XtSetArg(args[n], XmNmaxLength, _CHAR30);           n++;
	grawidgets.antwort = (Widget)XmCreateTextField( textfeld, GRAPHIKANTWORT,
								args, (Cardinal)n);
	XtManageChild(grawidgets.antwort);

	/*--- Constraints for all widgets -------*/
	n=0;
	XtSetArg(args[n], XmNtopAttachment,    XmATTACH_NONE);    n++;
	XtSetArg(args[n], XmNleftAttachment,   XmATTACH_FORM);    n++;
	XtSetArg(args[n], XmNrightAttachment,  XmATTACH_FORM);    n++;
	XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM);    n++;
	XtSetValues(grawidgets.antwort, args, n);
	n=0;
	XtSetArg(args[n], XmNtopAttachment,    XmATTACH_NONE);    n++;
	XtSetArg(args[n], XmNleftAttachment,   XmATTACH_FORM);    n++;
	XtSetArg(args[n], XmNrightAttachment,  XmATTACH_FORM);    n++;
	XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);  n++;
	XtSetArg(args[n], XmNbottomWidget, grawidgets.antwort);   n++;
	XtSetValues(grawidgets.frage, args, n);
	n=0;
	XtSetArg(args[n], XmNtopAttachment,    XmATTACH_FORM);    n++;
	XtSetArg(args[n], XmNleftAttachment,   XmATTACH_FORM);    n++;
	XtSetArg(args[n], XmNrightAttachment,  XmATTACH_FORM);    n++;
	XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET);  n++;
	XtSetArg(args[n], XmNbottomWidget, grawidgets.frage);     n++;
	XtSetValues(grawidgets.textfeldquit, args, n);

	/*--- Callbacks -------*/
	XtAddCallback( grawidgets.antwort, XmNactivateCallback,
										(XtCallbackProc)xGRaction, (XtPointer)&antwort);
	XtAddCallback( grawidgets.textfeldquit, XmNactivateCallback,
										(XtCallbackProc)xGRaction, (XtPointer)&quit);

	return( autoform);
}
Example #30
0
/* -------------------------------------------------------------------- */
static void CreateSpectrumWindow()
{
  Widget	optRC, frame, plRC, rc, RC[8], b[8], pb;
  Cardinal	n;
  Arg		args[8];


  if (SpectrumWindow)
    return;

  n = 0;
  SpecShell = XtCreatePopupShell("specShell", topLevelShellWidgetClass,
              AppShell, args, n);

  n = 0;
  SpectrumWindow = XmCreateForm(SpecShell, "specForm", args, n);


  /* RC for Options.
   */
  n = 0;
  XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
  XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
  XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
  optRC = XmCreateRowColumn(SpectrumWindow, "specOptForm", args, n);
  XtManageChild(optRC);


  /* Command buttons.
   */
  n = 0;
  XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
  XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
  XtSetArg(args[n], XmNrightWidget, optRC); n++;
  frame = XmCreateFrame(SpectrumWindow, "buttonFrame", args, n);
  XtManageChild(frame);

  n = 0;
  rc = XmCreateRowColumn(frame, "buttonRC", args, n);
  XtManageChild(rc);

  n = 0;
  b[0] = XmCreatePushButton(rc, "dismissButton", args, n);
  b[1] = XmCreatePushButton(rc, "printButton", args, n);
  b[2] = XmCreatePushButton(rc, "parmsButton", args, n);
  b[3] = XmCreatePushButton(rc, "savepngButton", args, n);
  XtManageChildren(b, 4);
  XtAddCallback(b[0], XmNactivateCallback, SpecWinDown, NULL);
  XtAddCallback(b[1], XmNactivateCallback, specPostScript, NULL);
  XtAddCallback(b[2], XmNactivateCallback, EditSpecParms, NULL);
#ifdef PNG
  XtAddCallback(b[3], XmNactivateCallback, SavePNGspec, NULL);
#endif



  /* Create Graphics Canvas
  */
  n = 0;
  XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
  XtSetArg(args[n], XmNtopWidget, frame); n++;
  XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
  XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
  XtSetArg(args[n], XmNrightWidget, optRC); n++;
  specPlot.canvas = XmCreateDrawingArea(SpectrumWindow, "specCanvas", args,n);
  XtManageChild(specPlot.canvas);



  n = 0;
  frame = XmCreateFrame(optRC, "specDefsFrame", args, 0);
  XtManageChild(frame);

  n = 0;
  RC[0] = XmCreateRadioBox(frame, "specTypeRB", args, n);

  n = 0;
  typeButts[0] = XmCreateToggleButton(RC[0], "Spectrum", args, n);
  typeButts[1] = XmCreateToggleButton(RC[0], "Co-Spectrum", args, n);
  typeButts[2] = XmCreateToggleButton(RC[0], "Quadrature", args, n);
  typeButts[3] = XmCreateToggleButton(RC[0], "Coherence", args, n);
  typeButts[4] = XmCreateToggleButton(RC[0], "Phase", args, n);
  typeButts[5] = XmCreateToggleButton(RC[0], "Spectral ratio", args, n);
  XtManageChildren(typeButts, 6);

  XtAddCallback(typeButts[0],XmNvalueChangedCallback,SpecWinUp,(XtPointer)SPECTRA);
  XtAddCallback(typeButts[1],XmNvalueChangedCallback,SpecWinUp,(XtPointer)COSPECTRA);
  XtAddCallback(typeButts[2],XmNvalueChangedCallback,SpecWinUp,(XtPointer)QUADRATURE);
  XtAddCallback(typeButts[3],XmNvalueChangedCallback,SpecWinUp,(XtPointer)COHERENCE);
  XtAddCallback(typeButts[4],XmNvalueChangedCallback,SpecWinUp,(XtPointer)PHASE);
  XtAddCallback(typeButts[5],XmNvalueChangedCallback,SpecWinUp,(XtPointer)RATIO);


  /* Optional stuff.  PreFilter, SegLen, Window, Detrend menus.
   */
  n = 0;
  frame = XmCreateFrame(optRC, "specDefsFrame", args, 0);
  XtManageChild(frame);

  n = 0;
  RC[1] = XmCreateRowColumn(frame, "specDefsRC", args, n);

  dtOpMenu = CreateDropDownMenu(RC[1], "dtOpMenu", detrendInfo);
  slOpMenu = CreateDropDownMenu(RC[1], "slOpMenu", segLenInfo);
  winOpMenu = CreateDropDownMenu(RC[1], "winOpMenu", windowInfo);

  n = 0;
  XtSetArg(args[n], XmNalignment, XmALIGNMENT_CENTER); n++;
  pb = XmCreatePushButton(RC[1], "Recompute", args, n);
  XtManageChild(pb);
  XtAddCallback(pb, XmNactivateCallback, SpecWinUp, NULL);



  /* Variance widgets.
   */
  n = 0;
  frame = XmCreateFrame(optRC, "specDefsFrame", args, 0);
  XtManageChild(frame);

  XtManageChild(XmCreateLabel(frame, "fluxLabel", args, n));

  n = 0;
  RC[2] = XmCreateRowColumn(frame, "plRCv", args, n);

  plRC = XmCreateRowColumn(RC[2], "plRC", args, n);
  XtManageChild(XmCreateLabel(plRC, "Start freq", args, n));
  sFreq = XmCreateTextField(plRC, "fluxFreq", args, n);
  XtManageChild(XmCreateLabel(plRC, "Hz", args, n));
  XtManageChild(plRC);
  XtManageChild(sFreq);
  XtAddCallback(sFreq, XmNlosingFocusCallback, ValidateFloat, (XtPointer)"%g");
  XtAddCallback(sFreq, XmNlosingFocusCallback, ComputeBandLimitedVariance,NULL);
  XtAddCallback(sFreq, XmNlosingFocusCallback, (XtCallbackProc)PlotSpectrum, NULL);

  plRC = XmCreateRowColumn(RC[2], "plRC", args, n);
  XtManageChild(XmCreateLabel(plRC, "End freq", args, n));
  eFreq = XmCreateTextField(plRC, "fluxFreq", args, n);
  XtManageChild(XmCreateLabel(plRC, "Hz", args, n));
  XtManageChild(plRC);
  XtManageChild(eFreq);
  XtAddCallback(eFreq, XmNlosingFocusCallback, ValidateFloat, (XtPointer)"%g");
  XtAddCallback(eFreq, XmNlosingFocusCallback, ComputeBandLimitedVariance,NULL);
  XtAddCallback(eFreq, XmNlosingFocusCallback, (XtCallbackProc)PlotSpectrum, NULL);

  XmTextFieldSetString(sFreq, "0.0");
  XmTextFieldSetString(eFreq, "5000.0");


  /* Plot Methods.
   */
  n = 0;
  frame = XmCreateFrame(optRC, "specDefsFrame", args, 0);
  XtManageChild(frame);

  XtManageChild(XmCreateLabel(frame, "plotMethodLabel", args, n));

  n = 0;
  RC[3] = XmCreateRowColumn(frame, "plRCv", args, n);

  n = 0;
  pmOptButt[0] = XmCreateToggleButton(RC[3], "Grid", args,n);
  pmOptButt[1] = XmCreateToggleButton(RC[3], "-5/3 (-2/3 x f) slope line", args,n);
  pmOptButt[2] = XmCreateToggleButton(RC[3], "Multiply output by frequency", args,n);
  pmOptButt[3] = XmCreateToggleButton(RC[3], "Multiply output by freq^(5/3)", args,n);
  pmOptButt[4] = XmCreateToggleButton(RC[3], "Wave number scale", args,n);
  pmOptButt[5] = XmCreateToggleButton(RC[3], "Wave length scale", args,n);
  XtManageChildren(pmOptButt, 6);

  XtAddCallback(pmOptButt[0], XmNvalueChangedCallback, ToggleSpecGrid, NULL);
  XtAddCallback(pmOptButt[0], XmNvalueChangedCallback, (XtCallbackProc)PlotSpectrum, NULL);
  XtAddCallback(pmOptButt[1], XmNvalueChangedCallback, (XtCallbackProc)PlotSpectrum, NULL);
  XtAddCallback(pmOptButt[2], XmNvalueChangedCallback, ToggleMultByFreq, NULL);
  XtAddCallback(pmOptButt[2], XmNvalueChangedCallback, (XtCallbackProc)PlotSpectrum, NULL);
  XtAddCallback(pmOptButt[3], XmNvalueChangedCallback, ToggleMultByFreq, NULL);
  XtAddCallback(pmOptButt[3], XmNvalueChangedCallback, (XtCallbackProc)PlotSpectrum, NULL);
  XtAddCallback(pmOptButt[4], XmNvalueChangedCallback, ToggleWaveNumberScale, NULL);
  XtAddCallback(pmOptButt[4], XmNvalueChangedCallback, (XtCallbackProc)PlotSpectrum, NULL);
  XtAddCallback(pmOptButt[5], XmNvalueChangedCallback, ToggleWaveLengthScale, NULL);
  XtAddCallback(pmOptButt[5], XmNvalueChangedCallback, (XtCallbackProc)PlotSpectrum, NULL);

  XmToggleButtonSetState(pmOptButt[1], true, false);



  /* Equal-log interval averaging
   */
  n = 0;
  frame = XmCreateFrame(optRC, "eliaFrame", args, 0);
  XtManageChild(frame);

  n = 0;
  RC[4] = XmCreateRowColumn(frame, "plRCv", args, n);

  n = 0;
  pmOptButt[6] = XmCreateToggleButton(RC[4], "Equal-log interval averaging", args,n);
  XtManageChild(pmOptButt[6]);
  XtAddCallback(pmOptButt[6], XmNvalueChangedCallback, (XtCallbackProc)PlotSpectrum, NULL);

  n = 0;
  plRC = XmCreateRowColumn(RC[4], "plRC", args, n);
  XtManageChild(plRC);

  XtManageChild(XmCreateLabel(plRC, "Total number points", args, n));
  eliaText = XmCreateTextField(plRC, "eliaText", args, n);
  XtManageChild(eliaText);
  XmTextFieldSetString(eliaText, "30");

  XtAddCallback(eliaText, XmNlosingFocusCallback, ValidateInteger, NULL);
  XtAddCallback(eliaText, XmNlosingFocusCallback, (XtCallbackProc)PlotSpectrum, NULL);


  /* Time shift.
   */
  n = 0;
  frame = XmCreateFrame(optRC, "specDefsFrame", args, 0);
  XtManageChild(frame);

  n = 0;
  RC[5] = XmCreateRowColumn(frame, "plRC", args, n);

  XtManageChild(XmCreateLabel(RC[5], "Time shift", args, n));
  tShift = XmCreateTextField(RC[5], "timeShift", args, n);
  XtManageChild(tShift);

  XtAddCallback(tShift, XmNlosingFocusCallback, ValidateInteger, NULL);
  XtAddCallback(tShift, XmNlosingFocusCallback, SpecWinUp, NULL);

  XtManageChild(XmCreateLabel(RC[5], "milliseconds", args, n));


  XtManageChild(RC[0]); XtManageChild(RC[1]);
  XtManageChild(RC[2]); XtManageChild(RC[3]);
  XtManageChild(RC[4]); XtManageChild(RC[5]);

}	/* END CREATESPECTRUMWINDOW */