/* $Id: Separator.c,v 1.1 1997/04/15 10:09:47 archer Exp $
 *	SEPARATOR.C - Handle line separators objects
 *
 * Separators are used in Column manages and Menu managers.
 */
#include <Widget/SeparatorP.h>
#include <Widget/drawP.h>


/**
 ** Internal: SUNKEN_SEPARATOR
 **	Separator appears as a sunken area
 **/
static void sunken_separator(X11_widget wdg, XEvent *dummy)
{
GC	gc, gc2;
int	t;
/*
 * Start drawing
 */
	x11__draw_start(wdg);
/*
 * Standard sunken separator
 */
	x11__shadows_gc();
	t  = wdg->shadow_thickness;
/*
 * Differing style in color-poor environment
 */
	if (x11__is_monochrome) {
		gc  = x11__default_gc;
		gc2 = gc;
		XSetForeground(x11__screen, gc, wdg->border_color);
	} else {
		gc  = x11__bottomright_gc;
		gc2 = x11__topleft_gc;
	}
	XFillRectangle(x11__screen, x11__cur_id, gc, 0, 0, wdg->w, t);
	XFillRectangle(x11__screen, x11__cur_id, gc2, 0, wdg->h - t, wdg->w, t);
}


/**
 ** X11_SEPARATOR
 **	Create a separator window
 **/
X11_widget X11_Separator(X11_widget parent)
{
x11__separator	*object;
/*
 * Get resource
 */
	object = allocator(x11__separator);
	x11__core_setup(&object->core, parent, "Separator", "separator");
/*
 * Initialize fields
 */
	object->core.event_mask = ExposureMask;
	object->core.on_expose  = sunken_separator;
/*
 * Defaults
 */
	object->core.shadow_thickness = 1;
/*
 * Properties as specified by resources
 */
	x11__resource_basic(&object->core);
	object->core.h_min = 2 * (object->core.shadow_thickness +
				  object->core.margin_inside);
/*
 * Common values
 */
	object->core.w       = 0;
	object->core.w_min   = 1;
	object->core.h       = object->core.h_min;
	object->core.fixed_w = False;
	object->core.fixed_h = True;
	object->core.border2 = 0;
/*
 * Ok
 */
	return (X11_widget)object;
}
