#ifndef lint
static char Xrcsid[] =
"$XConsortium: Scrollbar.c,v 1.58 89/12/15 11:36:58 kit Exp $";
#endif /* lint */
/***********************************************************
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/* ScrollBar.c */
/* created by weissman, Mon Jul 7 13:20:03 1986 */
/* converted by swick, Thu Aug 27 1987 */
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <./Xaw3_1XawInit.h>
#include <./Xaw3_1ScrollbarP.h>
/* Private definitions. */
static char defaultTranslations[] =
"<Btn1Down>: StartScroll(Forward) \n\
<Btn2Down>: StartScroll(Continuous) MoveThumb() NotifyThumb() \n\
<Btn3Down>: StartScroll(Backward) \n\
<Btn2Motion>: MoveThumb() NotifyThumb() \n\
<BtnUp>: NotifyScroll(Proportional) EndScroll()";
#ifdef bogusScrollKeys
/* examples */
"<KeyPress>f: StartScroll(Forward) NotifyScroll(FullLength) EndScroll()"
"<KeyPress>b: StartScroll(Backward) NotifyScroll(FullLength) EndScroll()"
#endif
};
static void ClassInitialize();
static void Initialize();
static void Destroy();
static void Realize();
static void Resize();
static void Redisplay();
static void StartScroll();
static void MoveThumb();
static void NotifyThumb();
static void NotifyScroll();
static void EndScroll();
{"StartScroll", StartScroll},
{"MoveThumb", MoveThumb},
{"NotifyThumb", NotifyThumb},
{"NotifyScroll", NotifyScroll},
{"EndScroll", EndScroll},
};
/* core fields */
/* class_name */ "Scrollbar",
/* size */ sizeof(ScrollbarRec),
/* class_initialize */ ClassInitialize,
/* class_part_init */ NULL,
/* class_inited */ FALSE,
/* initialize */ Initialize,
/* initialize_hook */ NULL,
/* realize */ Realize,
/* actions */ actions,
/* resources */ resources,
/* xrm_class */ NULLQUARK,
/* compress_motion */ TRUE,
/* compress_exposure*/ TRUE,
/* compress_enterleave*/ TRUE,
/* visible_interest */ FALSE,
/* destroy */ Destroy,
/* resize */ Resize,
/* expose */ Redisplay,
/* set_values */ SetValues,
/* set_values_hook */ NULL,
/* set_values_almost */ XtInheritSetValuesAlmost,
/* get_values_hook */ NULL,
/* accept_focus */ NULL,
/* version */ XtVersion,
/* callback_private */ NULL,
/* tm_table */ defaultTranslations,
/* query_geometry */ XtInheritQueryGeometry,
/* display_accelerator*/ XtInheritDisplayAccelerator,
/* extension */ NULL
};
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
static void ClassInitialize()
{
sizeof(Screen *)}
};
}
/*
* Make sure the first number is within the range specified by the other
* two numbers.
*/
{
}
/*
* Same as above, but for floating numbers.
*/
{
}
/* Fill the area specified by top and bottom with the given pattern. */
static float FractionLoc(w, x, y)
int x, y;
{
float result;
}
int thumb;
{
if (bottom < 0) return;
switch(thumb) {
/* Fill the new Thumb location */
case 1:
break;
/* Clear the old Thumb location */
case 0:
}
}
/* Paint the thumb in the area specified by w->top and
w->shown. The old area is erased. The painting and
erasing is done cleverly so that no flickering will occur. */
static void PaintThumb( w )
{
if (XtIsRealized((Widget)w)) {
}
}
static void SetDimensions(w)
{
}
else {
}
}
/* Function Name: Destroy
* Description: Called as the scrollbar is going away...
* Arguments: w - the scrollbar.
* Returns: nonw
*/
static void
Destroy(w)
Widget w;
{
}
/* Function Name: CreateGC
* Description: Creates the GC.
* Arguments: w - the scrollbar widget.
* Returns: none.
*/
static void
CreateGC(w)
Widget w;
{
depth);
}
int x, y;
"Scrollbar Widget: Could not get geometry of thumb pixmap.");
}
}
if (depth == 1) {
}
else {
}
}
}
/* ARGSUSED */
{
SetDimensions( w );
}
{
w->scrollbar.inactiveCursor =
*valueMask, attributes );
}
/* ARGSUSED */
static Boolean
request, /* what he wants me to be */
desired; /* what I will become */
{
/*
* If these values are outside the acceptable range ignore them...
*/
/*
* Change colors and stuff...
*/
if ( XtIsRealized (desired) ) {
{
}
}
return( redraw );
}
{
/* ForgetGravity has taken care of background, but thumb may
* have to move as a result of the new size. */
}
/* ARGSUSED */
{
int x, y;
y = 1;
} else {
x = 1;
}
/* Forces entire thumb to be painted. */
PaintThumb( w );
}
}
/* ARGSUSED */
{
char direction;
else direction = 'C';
switch( direction ) {
case 'B':
? w->scrollbar.downCursor
: w->scrollbar.rightCursor; break;
case 'F':
: w->scrollbar.leftCursor; break;
case 'C':
? w->scrollbar.rightCursor
default: return; /* invalid invocation */
}
}
{
case MotionNotify:
case ButtonPress:
case ButtonRelease:
case KeyPress:
case KeyRelease:
case EnterNotify:
case LeaveNotify:
}
return True;
}
struct EventData {
int count;
};
char *args;
{
}
Widget w;
{
return True;
else
return False;
}
Position *x, *y; /* RETURN */
{
case MotionNotify:
case ButtonPress:
case ButtonRelease:
case KeyPress:
case KeyRelease:
case EnterNotify:
case LeaveNotify:
default:
*x = 0; *y = 0;
}
}
{
int call_data;
char style;
Position x, y;
else style = 'P';
switch( style ) {
case 'P': /* Proportional */
0,
case 'F': /* FullLength */
}
case 'B':
/* fall through */
case 'F':
break;
case 'C':
case 'c': /* NotifyThumb has already called the thumbProc(s) */
break;
}
}
/* ARGSUSED */
{
}
/* ARGSUSED */
{
Position x, y;
ExtractPosition( event, &x, &y );
PaintThumb(w);
}
/* ARGSUSED */
{
}
/************************************************************
*
* Public routines.
*
************************************************************/
/* Set the scroll bar to the given location. */
extern void
{
PaintThumb( w );
}