/* $XConsortium: Scrollbar.c,v 1.72 94/04/17 20:12:40 kaleb Exp $ */
/***********************************************************
Copyright (c) 1987, 1988, 1994 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, 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 name of Digital 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>
/* 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
},
{ /* simple fields */
/* change_sensitive */ XtInheritChangeSensitive
},
{ /* scrollbar fields */
/* ignore */ 0
}
};
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
static void ClassInitialize()
{
}
/*
* 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 =
/*
* The Simple widget actually stuffs the value in the valuemask.
*/
}
/* 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 */
{
/* 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. */
}
/************************************************************
*
* Public routines.
*
************************************************************/
/* Set the scroll bar to the given location. */
#else
#endif
#else
#endif
{
PaintThumb( w );
}