
Xv_Window window;
Canvas canvas;
CANVAS_EACH_PAINT_WINDOW(canvas, window)
draw_into_window(window);
CANVAS_END_EACH
Because the paint windows are different from the view windows, a slightly different method
is used for getting view windows:
Xv_Window view;
Canvas canvas;
int i = 0;
while (window = (Xv_Window)xv_get(canvas, OPENWIN_NTH_VIEW, i)) {
/* process
window
*/
i++;
}
There is also a macro that loops through all the views in the canvas:
Xv_Window view;
Canvas canvas;
OPENWIN_EACH_VIEW(canvas, view)
...
OPENWIN_END_EACH
You can get the paint window associated with a view by using the attribute CANVAS_
VIEW_PAINT_WINDOW
:
Xv_Window view;
Xv_Window paint_window;
paint_window = (Xv_Window)xv_get(view, CANVAS_VIEW_PAINT_WINDOW);
This is useful in situations where you are given the view window and need to get the paint
window associated with it. For example, the routines called when views are split or joined
are passed handles to view windows. When a view is split, you will need to get the paint
window associated with the new view to install event or repaint callbacks.
5.7 Handling Input in the Canvas Package
This section discusses, to a limited degree, the method for handling and specifying events in
a canvas. For a detailed discussion of the types of events used and the proper method for
handling them, see Chapter 6, Handling Input.
Canvases and
Openwin
Canvases and Openwin 105