/*ARGSUSED*/
static void
XawScrollbarRedisplay(Widget gw, XEvent *event, Region region)
{
    ScrollbarWidget w = (ScrollbarWidget)gw;
    int x, y;
    unsigned int width, height;

    if (Superclass->core_class.expose)
	(*Superclass->core_class.expose)(gw, event, region);

    if (w->scrollbar.orientation == XtorientHorizontal) {
	x = w->scrollbar.topLoc;
	y = 1;
	width = w->scrollbar.shownLength;
	height = XtHeight(w) - 2;
    }
    else {
	x = 1;
	y = w->scrollbar.topLoc;
	width = XtWidth(w) - 2;
	height = w->scrollbar.shownLength;
    }

    if (region == NULL ||
	XRectInRegion(region, x, y, width, height) != RectangleOut) {
	/* Forces entire thumb to be painted */
	w->scrollbar.topLoc = -(w->scrollbar.length + 1);
	PaintThumb(w);
    }
}
示例#2
0
	void CScrollBarUI::DoPaint(HDC hDC, const RECT& rcPaint)
	{
		if( !::IntersectRect(&m_rcPaint, &rcPaint, &m_rcItem) ) return;
		PaintBk(hDC);
		PaintButton1(hDC);
		PaintButton2(hDC);
		PaintThumb(hDC);
		PaintRail(hDC);
	}
/* Set the scroll bar to the given location. */
void
XawScrollbarSetThumb(Widget gw,
#if NeedWidePrototypes
		     double top, double shown
#else
		     float top, float shown
#endif
		     )
{
    ScrollbarWidget w = (ScrollbarWidget)gw;

    if (w->scrollbar.direction == 'c')	/* if still thumbing */
	return;

    w->scrollbar.top = top > 1.0 ? 1.0 : top >= 0.0 ? top : w->scrollbar.top;

    w->scrollbar.shown = shown > 1.0 ? 1.0 : shown >= 0.0 ?
				shown : w->scrollbar.shown;
    PaintThumb(w);
}
/*ARGSUSED*/
static void
NotifyThumb(Widget gw, XEvent *event, String *params, Cardinal *num_params)
{
    ScrollbarWidget w = (ScrollbarWidget)gw;
    union {
	XtPointer xtp;
	float xtf;
    } xtpf;

    if (w->scrollbar.direction == 0)	/* if no StartScroll */
	return;

    if (LookAhead(gw, event))
	return;

    /* thumbProc is not pretty, but is necessary for backwards
       compatibility on those architectures for which it work{s,ed};
       the intent is to pass a (truncated) float by value. */
    xtpf.xtf = w->scrollbar.top;
    XtCallCallbacks(gw, XtNthumbProc, xtpf.xtp);
    XtCallCallbacks(gw, XtNjumpProc, (XtPointer)&w->scrollbar.top);

    PaintThumb(w);
}