|  |     The following will go through the various fonts on the system.
    Example is from Advanced Decwindows cours.
    
    bernie
    csc/cs
    
    ================================================================
#include <stdio.h>
#ifdef VMS
#include <decw$include/DwtAppl.h>
#include <decw$cursor.h>
#else
#include <X11/DwtAppl.h>
#include <X11/decwcursor.h>
#endif
static char *font_name[27] =
{
	"decw$c_select_cursor",
	"decw$c_help_select_cursor",
	"decw$c_wait_cursor",
	"decw$c_inactive_cursor",
	"decw$c_resize_cursor",
	"decw$c_vpane_cursor",
	"decw$c_hpane_cursor",
	"decw$c_text_insertion_cursor",
	"decw$c_text_insertion_bl_cursor",
	"decw$c_cross_hair_cursor",
	"decw$c_draw_cursor",
	"decw$c_pencil_cursor",
	"decw$c_center_cursor",	        
	"decw$c_rightselect_cursor",
	"decw$c_wselect_cursor",
	"decw$c_eselect_cursor",
	"decw$c_x_cursor",
	"decw$c_circle_cursor",
	"decw$c_mouse_cursor",
	"decw$c_lpencil_cursor",
	"decw$c_leftgrab_cursor",
	"decw$c_grabhand_cursor",
	"decw$c_rightgrab_cursor",
	"decw$c_leftpointing_cursor",
	"decw$c_uppointing_cursor",
	"decw$c_rightpointing_cursor",
	"decw$c_check_cursor" };
#define MAXARGS           4
static XtCallbackProc LabelCreated();
static XtCallbackProc ButtonArmed(), ButtonActivated();
/* DECwindows Resource Manager (DRM) data structures */
static DRMHierarchy hierarchy;          /* DRM hierarchy id */
/***
   Make sure the UID file has the proper name 
***/
static char *namvec[] = {"dwcursor.uid"};
                                        /* DRM file list */
static DRMCode class;
/*** 
   Register any new callbacks 
***/
static DRMRegisterArg regvec[] = {
    {"ButtonArmed", (caddr_t) ButtonArmed}, 
    {"ButtonActivated", (caddr_t) ButtonActivated},
    {"LabelCreated", (caddr_t) LabelCreated}
};
/* macros for counting things in file and name lists */
#define nFiles(x)         (sizeof(x)/sizeof(char *))
#define nRegs(x)          (sizeof(x)/sizeof(DRMRegisterArg))
Widget label;
    Widget top_level, main_widget;
Display *display;
Window window;
Colormap cmap;
XColor red, white, dummy;
int screen;
int cursor_num;
Font cursorfont;
Cursor mycursor;
main(argc, argv)
    unsigned int argc;
    char *argv[];
{
    int status, n;
    Arg args[MAXARGS];
    /* Initialize the DECwindows Resource Manager */
    DwtInitializeDRM();
    /* Initialize the toolkit, and create the top-level widget */
    top_level = XtInitialize("Lab6 Solution", "Example", NULL, 0, &argc, argv);
    n = 0;
    XtSetArg(args[n], DwtNx, 340);
    ++n;
    XtSetArg(args[n], DwtNy, 288);
    ++n;
    XtSetArg(args[n], XtNallowShellResize, True);
    ++n;
    XtSetValues(top_level, args, n);
    /* Define the DRM hierarchy */
    status = DwtOpenHierarchy(nFiles(namvec), 
                                        /* number of files */
      namvec,                           /* file names */
      NULL,                             /* no extensions */
      &hierarchy);                      /* pointer to hierarchy id */
    if (status != DRMSuccess) {
        fprintf(stderr, "Can't open DRM hierarchy\n");
        exit(0);
    }
    /* Register callback routines */
    DwtRegisterDRMNames(regvec, nRegs(regvec));
/***
   Make sure you're fetching the top widget in the .uil widget tree
***/
    /* Ask DRM to create the pushbutton widget */
    status = DwtFetchWidget(hierarchy,  /* DRM hierarchy id */
      "mainWidget",                     /* index of widget to fetch */
      top_level,                        /* parent widget */
      &main_widget,                     /* returned widget id */
      &class);                          /* returned widget class */
    if (status != DRMSuccess) {
        fprintf(stderr, "Can't fetch widget\n");
        exit(0);
    }
/***
   Modify XtManageChild so you are managing the widget you fetched 
***/
    /* Include fetched widget in its parent's managed set */
    XtManageChild(main_widget);
    XtRealizeWidget(top_level);
    load_font();
    XtMainLoop();                       /* Never returns */
}
static XtCallbackProc LabelCreated(widget, tag, reason)
    Widget widget;
    char *tag;
    DwtAnyCallbackStruct *reason;
{
    label = widget;
}
static XtCallbackProc ButtonArmed(widget, tag, reason)
    Widget widget;
    char *tag;
    DwtAnyCallbackStruct *reason;
{
    Arg arg;
    /* change string in label to reflect new cursor */
    XtSetArg(arg, DwtNlabel, DwtLatin1String(font_name[cursor_num/2]));
    XtSetValues(label, &arg, 1);
}
static XtCallbackProc ButtonActivated(widget, tag, reason)
    Widget widget;
    char *tag;
    DwtAnyCallbackStruct *reason;
{
	mycursor = XCreateGlyphCursor(display, cursorfont, cursorfont,
		cursor_num, cursor_num + 1, &red,
		&white);
	XDefineCursor(display, window, mycursor);
	cursor_num = cursor_num + 2;
	/* don't do pencil cursor, because it blows up the server */
	if (cursor_num == 22) cursor_num = cursor_num + 2;
	if (cursor_num == 38) cursor_num = cursor_num + 2;
	/* nothing between 46 and 52 seems to work */
	if (cursor_num >= 46) exit();
}
load_font()
{
display = XtDisplay(top_level);
window = XtWindow(top_level);
screen = DefaultScreen(display);
cmap = DefaultColormap(display, screen);
XAllocNamedColor(display, cmap, "white", &white, &dummy);
XAllocNamedColor(display, cmap, "red", &red, &dummy);
cursorfont = XLoadFont(display, "DECW$CURSOR");
}
    
    
 |