summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXScrlbr.c
diff options
context:
space:
mode:
Diffstat (limited to 'macosx/tkMacOSXScrlbr.c')
-rw-r--r--macosx/tkMacOSXScrlbr.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c
index 7dde501..91cf112 100644
--- a/macosx/tkMacOSXScrlbr.c
+++ b/macosx/tkMacOSXScrlbr.c
@@ -1,5 +1,5 @@
/*
- * tkMacOSXScrollbar.c --
+ * tkMacOSXScrollbar.c --
*
* This file implements the Macintosh specific portion of the scrollbar
* widget.
@@ -35,7 +35,7 @@
typedef struct MacScrollbar {
TkScrollbar information; /* Generic scrollbar info. */
GC troughGC; /* For drawing trough. */
- GC copyGC; /* Used for copying from pixmap onto screen. */
+ GC copyGC; /* Used for copying from pixmap onto screen. */
} MacScrollbar;
/*
@@ -44,7 +44,7 @@ typedef struct MacScrollbar {
* variable is declared at this scope.
*/
-Tk_ClassProcs tkpScrollbarProcs = {
+const Tk_ClassProcs tkpScrollbarProcs = {
sizeof(Tk_ClassProcs), /* size */
NULL, /* worldChangedProc */
NULL, /* createProc */
@@ -108,7 +108,7 @@ TkpCreateScrollbar(
scrollPtr->copyGC = None;
Tk_CreateEventHandler(tkwin,ExposureMask|StructureNotifyMask|FocusChangeMask|ButtonPressMask|VisibilityChangeMask, ScrollbarEventProc, scrollPtr);
-
+
return (TkScrollbar *) scrollPtr;
}
@@ -138,9 +138,9 @@ TkpDisplayScrollbar(
register Tk_Window tkwin = scrollPtr->tkwin;
TkWindow *winPtr = (TkWindow *) tkwin;
TkMacOSXDrawingContext dc;
-
+
scrollPtr->flags &= ~REDRAW_PENDING;
-
+
if (tkwin == NULL || !Tk_IsMapped(tkwin)) {
return;
}
@@ -182,7 +182,7 @@ TkpDisplayScrollbar(
Tk_Width(tkwin) - 2*scrollPtr->inset,
Tk_Height(tkwin) - 2*scrollPtr->inset, 0, TK_RELIEF_FLAT);
- /*Update values and draw in native rect.*/
+ /*Update values and draw in native rect.*/
UpdateControlValues(scrollPtr);
if (MOUNTAIN_LION_STYLE) {
HIThemeDrawTrack (&info, 0, dc.context, kHIThemeOrientationInverted);
@@ -190,7 +190,7 @@ TkpDisplayScrollbar(
HIThemeDrawTrack (&info, 0, dc.context, kHIThemeOrientationNormal);
}
TkMacOSXRestoreDrawingContext(&dc);
-
+
scrollPtr->flags &= ~REDRAW_PENDING;
}
@@ -278,7 +278,7 @@ TkpComputeScrollbarGeometry(
Tk_GeometryRequest(scrollPtr->tkwin, 2 * (scrollPtr->arrowLength + scrollPtr->borderWidth + scrollPtr->inset) + metrics[variant].minThumbHeight, scrollPtr->width + 2 * scrollPtr->inset);
}
Tk_SetInternalBorder(scrollPtr->tkwin, scrollPtr->inset);
-
+
}
/*
@@ -384,7 +384,7 @@ TkpScrollbarPosition(
x = y;
y = tmp;
length = Tk_Width(scrollPtr->tkwin);
- fieldlength = length - 2 * arrowSize;
+ fieldlength = length - 2 * arrowSize;
width = Tk_Height(scrollPtr->tkwin);
}
fieldlength = fieldlength < 0 ? 0 : fieldlength;
@@ -437,12 +437,11 @@ static void
UpdateControlValues(
TkScrollbar *scrollPtr) /* Scrollbar data struct. */
{
-
Tk_Window tkwin = scrollPtr->tkwin;
MacDrawable *macWin = (MacDrawable *) Tk_WindowId(scrollPtr->tkwin);
double dViewSize;
HIRect contrlRect;
- int variant;
+ int variant;
short width, height;
NSView *view = TkMacOSXDrawableView(macWin);
@@ -455,16 +454,16 @@ UpdateControlValues(
contrlRect = NSRectToCGRect(frame);
info.bounds = contrlRect;
-
+
width = contrlRect.size.width;
height = contrlRect.size.height;
variant = contrlRect.size.width < metrics[0].width ? 1 : 0;
-
+
/*
* Ensure we set scrollbar control bounds only once all size adjustments
* have been computed.
- */
+ */
info.bounds = contrlRect;
if (scrollPtr->vertical) {
@@ -472,7 +471,7 @@ UpdateControlValues(
} else {
info.attributes |= kThemeTrackHorizontal;
}
-
+
/*
* Given the Tk parameters for the fractions of the start and end of the
* thumb, the following calculation determines the location for the
@@ -499,7 +498,7 @@ UpdateControlValues(
} else {
info.value = MIN_SCROLLBAR_VALUE + factor * scrollPtr->firstFraction;
}
-
+
if((scrollPtr->firstFraction <= 0.0 && scrollPtr->lastFraction >= 1.0)
|| height <= metrics[variant].minHeight) {
info.enableState = kThemeTrackHideTrack;
@@ -526,7 +525,7 @@ ScrollbarPress(TkScrollbar *scrollPtr, XEvent *eventPtr)
{
if (eventPtr->type == ButtonPress) {
- UpdateControlValues(scrollPtr);
+ UpdateControlValues(scrollPtr);
}
return TCL_OK;
}
@@ -573,4 +572,3 @@ ScrollbarEventProc(
TkScrollbarEventProc(clientData, eventPtr);
}
}
-