diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2005-11-13 21:00:17 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2005-11-13 21:00:17 (GMT) |
commit | 73dbe3d8269035641d8ade47622376ebd3dd673d (patch) | |
tree | 2879d227ab09865277f9398506829d27b4299a7f /unix/tkUnixScrlbr.c | |
parent | 4557241d6c77454e3b74bff4343859949dbc7959 (diff) | |
download | tk-73dbe3d8269035641d8ade47622376ebd3dd673d.zip tk-73dbe3d8269035641d8ade47622376ebd3dd673d.tar.gz tk-73dbe3d8269035641d8ade47622376ebd3dd673d.tar.bz2 |
ANSIfy
Diffstat (limited to 'unix/tkUnixScrlbr.c')
-rw-r--r-- | unix/tkUnixScrlbr.c | 127 |
1 files changed, 66 insertions, 61 deletions
diff --git a/unix/tkUnixScrlbr.c b/unix/tkUnixScrlbr.c index fc3e7f8..074fff3 100644 --- a/unix/tkUnixScrlbr.c +++ b/unix/tkUnixScrlbr.c @@ -1,4 +1,4 @@ -/* +/* * tkUnixScrollbar.c -- * * This file implements the Unix specific portion of the scrollbar @@ -6,17 +6,17 @@ * * Copyright (c) 1996 by Sun Microsystems, Inc. * - * See the file "license.terms" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixScrlbr.c,v 1.3 2000/11/22 01:49:38 ericm Exp $ + * RCS: @(#) $Id: tkUnixScrlbr.c,v 1.4 2005/11/13 21:00:17 dkf Exp $ */ #include "tkScrollbar.h" /* - * Minimum slider length, in pixels (designed to make sure that the slider - * is always easy to grab with the mouse). + * Minimum slider length, in pixels (designed to make sure that the slider is + * always easy to grab with the mouse). */ #define MIN_SLIDER_LENGTH 5 @@ -32,15 +32,14 @@ typedef struct UnixScrollbar { } UnixScrollbar; /* - * The class procedure table for the scrollbar widget. All fields except - * size are left initialized to NULL, which should happen automatically - * since the variable is declared at this scope. + * The class procedure table for the scrollbar widget. All fields except size + * are left initialized to NULL, which should happen automatically since the + * variable is declared at this scope. */ Tk_ClassProcs tkpScrollbarProcs = { sizeof(Tk_ClassProcs) /* size */ }; - /* *---------------------------------------------------------------------- @@ -59,8 +58,8 @@ Tk_ClassProcs tkpScrollbarProcs = { */ TkScrollbar * -TkpCreateScrollbar(tkwin) - Tk_Window tkwin; +TkpCreateScrollbar( + Tk_Window tkwin) { UnixScrollbar *scrollPtr = (UnixScrollbar *)ckalloc(sizeof(UnixScrollbar)); scrollPtr->troughGC = None; @@ -78,9 +77,9 @@ TkpCreateScrollbar(tkwin) * * TkpDisplayScrollbar -- * - * This procedure redraws the contents of a scrollbar window. - * It is invoked as a do-when-idle handler, so it only runs - * when there's nothing else for the application to do. + * This procedure redraws the contents of a scrollbar window. It is + * invoked as a do-when-idle handler, so it only runs when there's + * nothing else for the application to do. * * Results: * None. @@ -92,8 +91,8 @@ TkpCreateScrollbar(tkwin) */ void -TkpDisplayScrollbar(clientData) - ClientData clientData; /* Information about window. */ +TkpDisplayScrollbar( + ClientData clientData) /* Information about window. */ { register TkScrollbar *scrollPtr = (TkScrollbar *) clientData; register Tk_Window tkwin = scrollPtr->tkwin; @@ -117,10 +116,10 @@ TkpDisplayScrollbar(clientData) } /* - * In order to avoid screen flashes, this procedure redraws - * the scrollbar in a pixmap, then copies the pixmap to the - * screen in a single operation. This means that there's no - * point in time where the on-sreen image has been cleared. + * In order to avoid screen flashes, this procedure redraws the scrollbar + * in a pixmap, then copies the pixmap to the screen in a single + * operation. This means that there's no point in time where the on-sreen + * image has been cleared. */ pixmap = Tk_GetPixmap(scrollPtr->display, Tk_WindowId(tkwin), @@ -148,11 +147,11 @@ TkpDisplayScrollbar(clientData) (unsigned) (Tk_Height(tkwin) - 2*scrollPtr->inset)); /* - * Draw the top or left arrow. The coordinates of the polygon - * points probably seem odd, but they were carefully chosen with - * respect to X's rules for filling polygons. These point choices - * cause the arrows to just fill the narrow dimension of the - * scrollbar and be properly centered. + * Draw the top or left arrow. The coordinates of the polygon points + * probably seem odd, but they were carefully chosen with respect to X's + * rules for filling polygons. These point choices cause the arrows to + * just fill the narrow dimension of the scrollbar and be properly + * centered. */ if (scrollPtr->activeField == TOP_ARROW) { @@ -242,8 +241,8 @@ TkpDisplayScrollbar(clientData) } /* - * Copy the information from the off-screen pixmap onto the screen, - * then delete the pixmap. + * Copy the information from the off-screen pixmap onto the screen, then + * delete the pixmap. */ XCopyArea(scrollPtr->display, pixmap, Tk_WindowId(tkwin), @@ -251,7 +250,7 @@ TkpDisplayScrollbar(clientData) (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin), 0, 0); Tk_FreePixmap(scrollPtr->display, pixmap); - done: + done: scrollPtr->flags &= ~REDRAW_PENDING; } @@ -260,9 +259,9 @@ TkpDisplayScrollbar(clientData) * * TkpComputeScrollbarGeometry -- * - * After changes in a scrollbar's size or configuration, this - * procedure recomputes various geometry information used in - * displaying the scrollbar. + * After changes in a scrollbar's size or configuration, this procedure + * recomputes various geometry information used in displaying the + * scrollbar. * * Results: * None. @@ -274,9 +273,10 @@ TkpDisplayScrollbar(clientData) */ extern void -TkpComputeScrollbarGeometry(scrollPtr) - register TkScrollbar *scrollPtr; /* Scrollbar whose geometry may - * have changed. */ +TkpComputeScrollbarGeometry( + register TkScrollbar *scrollPtr) + /* Scrollbar whose geometry may have + * changed. */ { int width, fieldLength; @@ -297,9 +297,9 @@ TkpComputeScrollbarGeometry(scrollPtr) scrollPtr->sliderLast = fieldLength*scrollPtr->lastFraction; /* - * Adjust the slider so that some piece of it is always - * displayed in the scrollbar and so that it has at least - * a minimal width (so it can be grabbed with the mouse). + * Adjust the slider so that some piece of it is always displayed in the + * scrollbar and so that it has at least a minimal width (so it can be + * grabbed with the mouse). */ if (scrollPtr->sliderFirst > (fieldLength - 2*scrollPtr->borderWidth)) { @@ -319,10 +319,9 @@ TkpComputeScrollbarGeometry(scrollPtr) scrollPtr->sliderLast += scrollPtr->arrowLength + scrollPtr->inset; /* - * Register the desired geometry for the window (leave enough space - * for the two arrows plus a minimum-size slider, plus border around - * the whole window, if any). Then arrange for the window to be - * redisplayed. + * Register the desired geometry for the window (leave enough space for + * the two arrows plus a minimum-size slider, plus border around the whole + * window, if any). Then arrange for the window to be redisplayed. */ if (scrollPtr->vertical) { @@ -355,8 +354,8 @@ TkpComputeScrollbarGeometry(scrollPtr) */ void -TkpDestroyScrollbar(scrollPtr) - TkScrollbar *scrollPtr; +TkpDestroyScrollbar( + TkScrollbar *scrollPtr) { UnixScrollbar *unixScrollPtr = (UnixScrollbar *)scrollPtr; @@ -374,8 +373,8 @@ TkpDestroyScrollbar(scrollPtr) * TkpConfigureScrollbar -- * * This procedure is called after the generic code has finished - * processing configuration options, in order to configure - * platform specific options. + * processing configuration options, in order to configure platform + * specific options. * * Results: * None. @@ -387,10 +386,10 @@ TkpDestroyScrollbar(scrollPtr) */ void -TkpConfigureScrollbar(scrollPtr) - register TkScrollbar *scrollPtr; /* Information about widget; may or - * may not already have values for - * some fields. */ +TkpConfigureScrollbar( + register TkScrollbar *scrollPtr) + /* Information about widget; may or may not + * already have values for some fields. */ { XGCValues gcValues; GC new; @@ -416,14 +415,12 @@ TkpConfigureScrollbar(scrollPtr) * * TkpScrollbarPosition -- * - * Determine the scrollbar element corresponding to a - * given position. + * Determine the scrollbar element corresponding to a given position. * * Results: - * One of TOP_ARROW, TOP_GAP, etc., indicating which element - * of the scrollbar covers the position given by (x, y). If - * (x,y) is outside the scrollbar entirely, then OUTSIDE is - * returned. + * One of TOP_ARROW, TOP_GAP, etc., indicating which element of the + * scrollbar covers the position given by (x, y). If (x,y) is outside the + * scrollbar entirely, then OUTSIDE is returned. * * Side effects: * None. @@ -432,10 +429,10 @@ TkpConfigureScrollbar(scrollPtr) */ int -TkpScrollbarPosition(scrollPtr, x, y) - register TkScrollbar *scrollPtr; /* Scrollbar widget record. */ - int x, y; /* Coordinates within scrollPtr's - * window. */ +TkpScrollbarPosition( + register TkScrollbar *scrollPtr, + /* Scrollbar widget record. */ + int x, int y) /* Coordinates within scrollPtr's window. */ { int length, width, tmp; @@ -457,7 +454,7 @@ TkpScrollbarPosition(scrollPtr, x, y) /* * All of the calculations in this procedure mirror those in - * TkpDisplayScrollbar. Be sure to keep the two consistent. + * TkpDisplayScrollbar. Be sure to keep the two consistent. */ if (y < (scrollPtr->inset + scrollPtr->arrowLength)) { @@ -474,3 +471,11 @@ TkpScrollbarPosition(scrollPtr, x, y) } return BOTTOM_GAP; } + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ |