SunView tricks needed: background to a panel

Neil Hunt neil at teleos.com
Fri May 12 13:32:09 AEST 1989


This seems to work for me;  get the panel items painted
before you paint your own custom background by calling
notify_next_event_func from your event func handler;

The example below simply puts a box around a number of items
in the panel to group them together visually.

Notify_value
bg_paint(panel, event, arg, type)
Panel panel;
Event *event;
Notify_arg arg;
Notify_event type;
{
	Pixwin *pw;
	Notify_value value;

	/*
	 * Call the normal notify_event handler.
	 */
	value = notify_next_event_func(panel, event, arg, type);

	if(event_id(event) != WIN_REPAINT)
		return value;

	/*
	 * Add additional repainting actions.
	 */
	pw = (Pixwin *)window_get(panel, WIN_PIXWIN);
	pw_rect(pw, S_X, S_Y, S_W, S_H, 1, PIX_SRC, -1);

	return value;
}

Frame
create_frame()
{
	Frame frame;
	Panel panel;

	frame = window_create(
	  ...
	  WIN_WIDTH, E_W+10+10,
	  WIN_HEIGHT, E_Y+E_H+5+20,
	  0);
	if(frame == NILFRAME)
		return NILFRAME;

	panel = panel_create(frame,
	  ...
	  WIN_WIDTH, E_W+10,
	  WIN_HEIGHT, E_Y+E_H+5,
	  0);

	notify_interpose_event_func(panel, bg_paint, NOTIFY_SAFE);

	return frame;
}

Neil/.



More information about the Comp.sys.sun mailing list