Skip to Main Content
Volume 6A: Motif Programming Manual
book

Volume 6A: Motif Programming Manual

by David Brennan, Dan Heller, Paula Ferguson
September 1993
Intermediate to advanced content levelIntermediate to advanced
1014 pages
28h 26m
English
O'Reilly Media, Inc.
Content preview from Volume 6A: Motif Programming Manual
cell_height += Resrcs.grid + 6 +
Resrcs.label_bitmap * (font−>ascent + font−>descent);
cell_width += Resrcs.grid + 6;
/* if user didn't specify row/column layout figure it out ourselves.
* optimize layout by making it "square".
*/
if (!Resrcs.rows && !Resrcs.cols) {
Resrcs.cols = int_sqrt (total);
Resrcs.rows = (total + Resrcs.cols − 1) / Resrcs.cols;
}
else if (Resrcs.rows)
/* user specified rows −− figure out columns */
Resrcs.cols = (total + Resrcs.rows − 1) / Resrcs.rows;
else
/* user specified cols −− figure out rows */
Resrcs.rows = (total + Resrcs.cols − 1) / Resrcs.cols;
printf ("Creating pixmap area of size %dx%d (%d rows, %d cols)0,
Resrcs.cols * cell_width, Resrcs.rows * cell_height,
Resrcs.rows, Resrcs.cols);
if (!(pixmap = XCreatePixmap (dpy, DefaultRootWindow(dpy),
Resrcs.cols * cell_width, Resrcs.rows * cell_height,
DefaultDepthOfScreen (XtScreen (toplevel)))))
XtError ("Can't Create pixmap.");
if (!(gc = XCreateGC (dpy, pixmap, NULL, 0)))
XtError ("Can't create gc.");
XSetForeground (dpy, gc, Resrcs.bg); /* init GC's foreground to bg */
XFillRectangle (dpy, pixmap, gc, 0, 0,
Resrcs.cols * cell_width, Resrcs.rows * cell_height);
XSetForeground (dpy, gc, Resrcs.fg);
XSetBackground (dpy, gc, Resrcs.bg);
XSetFont (dpy, gc, font−>fid);
if (Resrcs.grid) {
if (Resrcs.grid != 1)
/* Line weight of 1 is faster when left as 0 (the default) */
XSetLineAttributes (dpy, gc, Resrcs.grid, 0, 0, 0);
for (j = 0; j <= Resrcs.rows * cell_height; j += cell_height)
XDrawLine (dpy, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Volume 7A: XView Programming Manual

Volume 7A: XView Programming Manual

Dan Heller

Publisher Resources

ISBN: 9780596000431