Go to the documentation of this file.00001
00025 #include <stdio.h>
00026 #include <Xm/Xm.h>
00027
00028 #include "util.h"
00029
00030
00036 Pixel
00037 get_pixel (Widget w, char *resource_value)
00038 {
00039 Colormap colormap;
00040 Boolean status;
00041 XColor exact, color;
00042
00043 colormap = DefaultColormapOfScreen (DefaultScreenOfDisplay (XtDisplay (w)));
00044 status = XAllocNamedColor (XtDisplay (w), colormap, resource_value, &color, &exact);
00045 if (status == 0)
00046 {
00047 fprintf (stderr, "Unknown color: %s", resource_value);
00048 color.pixel = BlackPixelOfScreen (DefaultScreenOfDisplay (XtDisplay (w)));
00049 };
00050 return (color.pixel);
00051 }
00052
00053
00059 XmFontList
00060 get_fontlist (Widget w, char *fontname)
00061 {
00062 XFontStruct *font;
00063 XmFontList fontlist;
00064
00065 font = XLoadQueryFont (XtDisplay (w), fontname);
00066 if (font == NULL)
00067 {
00068 fprintf (stderr, "\tCould not load font: %s\n\n", fontname);
00069 fprintf (stderr, "\tUsing this system's default font instead.\n\n");
00070 font = XLoadQueryFont (XtDisplay (w), XtDefaultFont);
00071 };
00072 fontlist = XmFontListCreate (font, XmSTRING_DEFAULT_CHARSET);
00073 return (fontlist);
00074 }
00075
00076
00077