示例#1
0
static void 
Help(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
static Widget Dialog = NULL;
char HelpText[] =
   "Generic help for XltFilePicker\n"
   "Type in a file name, or click on Browse\n"
   "to search for one."
   ;

    if (Dialog == NULL)
    {
    Widget ParentShell;
    XmString string;

    	ParentShell = w;
    	while (!XtIsApplicationShell(ParentShell)) ParentShell = XtParent(ParentShell);
    	Dialog = XmCreateInformationDialog(ParentShell, "HelpText", NULL, 0);
    	XtUnmanageChild(XmMessageBoxGetChild(Dialog, XmDIALOG_HELP_BUTTON));
    	string = XmStringCreateLtoR(HelpText,XmFONTLIST_DEFAULT_TAG);
    	XtVaSetValues(Dialog,
    		XmNmessageString, string,
    		NULL);
    }
    XtManageChild(Dialog);
}
示例#2
0
Widget
XmPrintSetup(
             Widget           video_widget,
             Screen           *print_screen,
             String            print_shell_name,
             ArgList           args,
             Cardinal          num_args)
{
    String video_name, video_class ;
    Widget pappshell ;
    Widget print_shell;
    Display  *print_display = DisplayOfScreen(print_screen);

    /* get to the video app root shell */
    while(!XtIsApplicationShell(video_widget))
	video_widget = XtParent(video_widget);

    if (!video_widget) return NULL;

    XtGetApplicationNameAndClass(XtDisplay(video_widget),
                                 &video_name, &video_class);

    /* we want to be able to specify things like:
       dtpad.print*textFontList: somefont
       dtpad.print*background:white
       so we create a first shell unrealized and them a popup
       named "print".
       */
    pappshell = XtVaAppCreateShell(video_name, video_class,
                                   applicationShellWidgetClass, 
                                   print_display, 
                                   XmNscreen, print_screen, 
                                   NULL);

    /* then create the XmPrintShell */
    print_shell = XtCreatePopupShell(print_shell_name, 
				     xmPrintShellWidgetClass, 
				     pappshell, args, num_args);

    /* Add callback to destroy application Shell parent. */
    XtAddCallback(print_shell, XmNdestroyCallback, 
                  _XmDestroyParentCallback, (XtPointer) NULL) ;

    /* we're mapping/unmapping at start/end page time */
    XtSetMappedWhenManaged(print_shell, False);

    /* realize the shell now, so that XmPrintPopupPDM works dy default */
    XtRealizeWidget(print_shell);

    return print_shell ;
}
示例#3
0
static void
Help(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
    static Widget Dialog = NULL;
    char HelpText[] =
    "BASIC-style expression evaluator which understands the following\n"
    "operators (all trigonometrical functions use degrees):\n\n"
    "+,-,*,/,^   Addition, subtraction, multiplication, division and power.\n"
    "()          Brackets (overrides operator precedence).\n"
    "ACS expr    Arccosine.\n"
    "ASN expr    Arcsine.\n"
    "ATN expr    Arctangent.\n"
    "COS expr    Cosine.\n"
    "EXP expr    Exponential power.\n"
    "FACT expr   Factorial (expr must be between 0 and 147).\n"
    "LN expr     Natural log (expr must be positive).\n"
    "LOG expr    Log to base 10 (expr must be positive).\n"
    "RND expr    Random number generator.\n"
    "            If expr<0, then expr is used to seed the random number generator.\n"
    "            If 0<=expr<=1, then returns a real number between 0 and 1.\n"
    "            If expr>1, then returns an integer between 1 and expr.\n"
    "SIN expr    Sine.\n"
    "SQRT expr   Square root.\n"
    "TAN expr    Tangent.\n"
    "TIME        Returns the number of seconds since 1st January 1970.\n"
    "\nderived from:\n"
    "calc.c - Floating-point calculator V1.00 (C) Richard K. Lloyd 1992\n"
    "*****@*****.**"
     ;

    if (Dialog == NULL)
    {
	Widget ParentShell;
	XmString string;

	ParentShell = w;
	while (!XtIsApplicationShell(ParentShell))
	    ParentShell = XtParent(ParentShell);
	Dialog = XmCreateInformationDialog(ParentShell, "HelpText", NULL, 0);
	string = XmStringCreateLtoR(HelpText, XmFONTLIST_DEFAULT_TAG);
	XtVaSetValues(Dialog,
		      XmNmessageString, string,
		      NULL);
	XmStringFree(string);
    }
    XtManageChild(Dialog);

}
示例#4
0
static Widget widget_to_dialog(Widget w)
{
  /* find dialog parent of w, if any */
  while (w)
    {
      w = XtParent(w);
      if (w)
	{
	  if ((XmIsFileSelectionBox(w)) ||     /* file selection dialog */
	      (XmIsMessageBox(w)))             /* includes template dialog */
	    return(w);
	  if ((XmIsDialogShell(w)) ||
	      (XtIsApplicationShell(w)))
	    return(NULL);
	}
    }
  return(NULL);
}
示例#5
0
文件: Resources.c 项目: aosm/X11libs
static void GetNamesAndClasses(
    register Widget	  w,
    register XrmNameList  names,
    register XrmClassList classes)
{
    register Cardinal length, j;
    register XrmQuark t;
    WidgetClass class;

    /* Return null-terminated quark arrays, with length the number of
       quarks (not including NULL) */

    LOCK_PROCESS;
    for (length = 0; w != NULL; w = (Widget) w->core.parent) {
	names[length] = w->core.xrm_name;
	class = XtClass(w);
	/* KLUDGE KLUDGE KLUDGE KLUDGE */
	if (w->core.parent == NULL && XtIsApplicationShell(w)) {
	    classes[length] =
		((ApplicationShellWidget) w)->application.xrm_class;
	} else classes[length] = class->core_class.xrm_class;
	length++;
     }
    UNLOCK_PROCESS;
    /* They're in backwards order, flop them around */
    for (j = 0; j < length/2; j++) {
	t = names[j];
	names[j] = names[length-j-1];
	names[length-j-1] = t;
        t = classes[j];
	classes[j] = classes[length-j-1];
	classes[length-j-1] = t;
    }
    names[length] = NULLQUARK;
    classes[length] = NULLQUARK;
} /* GetNamesAndClasses */