Skip to Main Content
Volume 7A: XView Programming Manual
book

Volume 7A: XView Programming Manual

by Dan Heller
October 1994
Intermediate to advanced content levelIntermediate to advanced
770 pages
22h 58m
English
O'Reilly Media, Inc.
Content preview from Volume 7A: XView Programming Manual
Example 6-1. The canvas_input.c program (continued)
} else if (view == newview) {
xv_set(xv_get(canvas, OPENWIN_VERTICAL_SCROLLBAR, view),
SCROLLBAR_VIEW_START, 0,
NULL);
xv_set(xv_get(canvas, OPENWIN_HORIZONTAL_SCROLLBAR, view),
SCROLLBAR_VIEW_START, 0,
NULL);
}
i++;
OPENWIN_END_EACH
sprintf(msg, "Total views: %d", i);
xv_set(frame, FRAME_RIGHT_FOOTER, msg, NULL);
}
/*
* Called when an event is received in an arbitrary paint window.
*/
void
my_event_proc(window, event, arg)
Xv_Window window;
Event *event;
Notify_arg arg;
{
register char *p = msg;
*p = 0;
/* test to see if a function key has been hit */
if (event_is_key_left(event))
sprintf(p, "(L%d) ", event_id(event) KEY_LEFTFIRST + 1);
else if (event_is_key_top(event))
sprintf(p, "(T%d) ", event_id(event) KEY_TOPFIRST + 1);
else if (event_is_key_right(event))
sprintf(p, "(R%d) ", event_id(event) KEY_RIGHTFIRST + 1);
else if (event_id(event) == KEY_BOTTOMLEFT)
strcpy(p, "bottom left ");
else if (event_id(event) == KEY_BOTTOMRIGHT)
strcpy(p, "bottom right ");
p += strlen(p);
if (event_is_ascii(event)) {
/*
* note that shift modifier is reflected in the event code by
* virtue of the char printed is upper/lower case.
*/
sprintf(p, "Keyboard: key ’%c’ (%d) %s at %d,%d",
event_action(event), event_action(event),
event_is_down(event)? "pressed" : "released",
event_x(event), event_y(event));
} else switch (event_action(event)) {
case ACTION_CLOSE :
xv_set(frame, FRAME_CLO ...
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 6A: Motif Programming Manual

Volume 6A: Motif Programming Manual

David Brennan, Dan Heller, Paula Ferguson
Java™ Media APIs: Cross-Platform Imaging, Media, and Visualization

Java™ Media APIs: Cross-Platform Imaging, Media, and Visualization

Alejandro Terrazas, John Ostuni, Michael Barlow

Publisher Resources

ISBN: 9780937175873