summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXEntry.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2008-11-08 18:44:39 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2008-11-08 18:44:39 (GMT)
commit1411b2f26b3d46b402c4774770fb5356cd47ef95 (patch)
tree080187f8a151cf82a630512856d2315e712cedf9 /macosx/tkMacOSXEntry.c
parent4f2679372f637fcd2f0d997b9d97165a6b558f12 (diff)
downloadtk-1411b2f26b3d46b402c4774770fb5356cd47ef95.zip
tk-1411b2f26b3d46b402c4774770fb5356cd47ef95.tar.gz
tk-1411b2f26b3d46b402c4774770fb5356cd47ef95.tar.bz2
Lots of small changes to make code more pretty and C89-like.
Diffstat (limited to 'macosx/tkMacOSXEntry.c')
-rw-r--r--macosx/tkMacOSXEntry.c92
1 files changed, 49 insertions, 43 deletions
diff --git a/macosx/tkMacOSXEntry.c b/macosx/tkMacOSXEntry.c
index a0b458e..46c6a00 100644
--- a/macosx/tkMacOSXEntry.c
+++ b/macosx/tkMacOSXEntry.c
@@ -53,23 +53,22 @@
* software in accordance with the terms specified in this
* license.
*
- * RCS: @(#) $Id: tkMacOSXEntry.c,v 1.14 2007/12/13 15:27:09 dgp Exp $
+ * RCS: @(#) $Id: tkMacOSXEntry.c,v 1.15 2008/11/08 18:44:40 dkf Exp $
*/
#include "tkMacOSXPrivate.h"
#include "tkMacOSXDefault.h"
#include "tkEntry.h"
-static ThemeButtonKind ComputeIncDecParameters (int height, int *width);
-
+static ThemeButtonKind ComputeIncDecParameters(int height, int *width);
+
/*
*--------------------------------------------------------------
*
* ComputeIncDecParameters --
*
- * This procedure figures out which of the kThemeIncDec
- * buttons to use. It also sets width to the width of the
- * IncDec button.
+ * This procedure figures out which of the kThemeIncDec buttons to use.
+ * It also sets width to the width of the IncDec button.
*
* Results:
* The ThemeButtonKind of the button we should use.
@@ -79,8 +78,11 @@ static ThemeButtonKind ComputeIncDecParameters (int height, int *width);
*
*--------------------------------------------------------------
*/
+
static ThemeButtonKind
-ComputeIncDecParameters(int height, int *width)
+ComputeIncDecParameters(
+ int height,
+ int *width)
{
ThemeButtonKind kind;
@@ -112,18 +114,17 @@ ComputeIncDecParameters(int height, int *width)
return kind;
}
-
+
/*
*--------------------------------------------------------------
*
* TkpDrawEntryBorderAndFocus --
*
- * This procedure redraws the border of an entry window.
- * It overrides the generic border drawing code if the
- * entry widget parameters are such that the native widget
- * drawing is a good fit.
- * This version just returns 1, so platforms that don't
- * do special native drawing don't have to implement it.
+ * This procedure redraws the border of an entry window. It overrides the
+ * generic border drawing code if the entry widget parameters are such
+ * that the native widget drawing is a good fit. This version just
+ * returns 1, so platforms that don't do special native drawing don't
+ * have to implement it.
*
* Results:
* 1 if it has drawn the border, 0 if not.
@@ -133,8 +134,12 @@ ComputeIncDecParameters(int height, int *width)
*
*--------------------------------------------------------------
*/
+
int
-TkpDrawEntryBorderAndFocus(Entry *entryPtr, Drawable d, int isSpinbox)
+TkpDrawEntryBorderAndFocus(
+ Entry *entryPtr,
+ Drawable d,
+ int isSpinbox)
{
Rect bounds;
TkMacOSXDrawingContext dc;
@@ -145,9 +150,9 @@ TkpDrawEntryBorderAndFocus(Entry *entryPtr, Drawable d, int isSpinbox)
MacDrawable *macDraw = (MacDrawable *) d;
/*
- * I use 6 as the borderwidth. 2 of the 5 go into the actual frame the
- * 3 are because the Mac OS Entry widgets leave more space around the
- * Text than Tk does on X11.
+ * I use 6 as the borderwidth. 2 of the 5 go into the actual frame the 3
+ * are because the Mac OS Entry widgets leave more space around the Text
+ * than Tk does on X11.
*/
if (entryPtr->borderWidth != MAC_OSX_ENTRY_BORDER
@@ -157,9 +162,9 @@ TkpDrawEntryBorderAndFocus(Entry *entryPtr, Drawable d, int isSpinbox)
}
/*
- * For the spinbox, we have to make the entry part smaller by the size
- * of the buttons. We also leave 2 pixels to the left (as per the HIG)
- * and space for one pixel to the right, 'cause it makes the buttons look
+ * For the spinbox, we have to make the entry part smaller by the size of
+ * the buttons. We also leave 2 pixels to the left (as per the HIG) and
+ * space for one pixel to the right, 'cause it makes the buttons look
* nicer.
*/
@@ -175,17 +180,17 @@ TkpDrawEntryBorderAndFocus(Entry *entryPtr, Drawable d, int isSpinbox)
}
/*
- * The focus ring is drawn with an Alpha at the outside
- * part of the ring, so we have to draw over the edges of the
- * ring before drawing the focus or the text will peep through.
+ * The focus ring is drawn with an Alpha at the outside part of the ring,
+ * so we have to draw over the edges of the ring before drawing the focus
+ * or the text will peep through.
*/
bgGC = Tk_GCForColor(entryPtr->highlightBgColorPtr, d);
TkDrawInsetFocusHighlight(entryPtr->tkwin, bgGC, MAC_OSX_FOCUS_WIDTH, d, 0);
/*
- * Inset the entry Frame by the maximum width of the focus rect,
- * which is 3 according to the Carbon docs.
+ * Inset the entry Frame by the maximum width of the focus rect, which is
+ * 3 according to the Carbon docs.
*/
bounds.left = macDraw->xOff + MAC_OSX_FOCUS_WIDTH;
@@ -203,8 +208,8 @@ TkpDrawEntryBorderAndFocus(Entry *entryPtr, Drawable d, int isSpinbox)
DrawThemeEditTextFrame(&bounds, drawState);
if (entryPtr->flags & GOT_FOCUS) {
/*
- * Don't call this if we don't have the focus, because then it
- * erases the focus rect to white, but we've already drawn the
+ * Don't call this if we don't have the focus, because then it erases
+ * the focus rect to white, but we've already drawn the
* highlightbackground above.
*/
@@ -216,17 +221,17 @@ TkpDrawEntryBorderAndFocus(Entry *entryPtr, Drawable d, int isSpinbox)
TkMacOSXRestoreDrawingContext(&dc);
return 1;
}
+
/*
*--------------------------------------------------------------
*
* TkpDrawSpinboxButtons --
*
- * This procedure redraws the buttons of an spinbox widget.
- * It overrides the generic button drawing code if the
- * spinbox widget parameters are such that the native widget
- * drawing is a good fit.
- * This version just returns 0, so platforms that don't
- * do special native drawing don't have to implement it.
+ * This procedure redraws the buttons of an spinbox widget. It overrides
+ * the generic button drawing code if the spinbox widget parameters are
+ * such that the native widget drawing is a good fit. This version just
+ * returns 0, so platforms that don't do special native drawing don't
+ * have to implement it.
*
* Results:
* 1 if it has drawn the border, 0 if not.
@@ -238,7 +243,9 @@ TkpDrawEntryBorderAndFocus(Entry *entryPtr, Drawable d, int isSpinbox)
*/
int
-TkpDrawSpinboxButtons(Spinbox *sbPtr, Drawable d)
+TkpDrawSpinboxButtons(
+ Spinbox *sbPtr,
+ Drawable d)
{
Rect inBounds;
ThemeButtonKind inKind;
@@ -265,10 +272,9 @@ TkpDrawSpinboxButtons(Spinbox *sbPtr, Drawable d)
}
/*
- * The actual sizes of the IncDec button are 21 for the normal,
- * 18 for the small and 15 for the mini. But the spinbox still
- * looks okay if the entry is a little bigger than this, so we
- * give it a little slop.
+ * The actual sizes of the IncDec button are 21 for the normal, 18 for the
+ * small and 15 for the mini. But the spinbox still looks okay if the
+ * entry is a little bigger than this, so we give it a little slop.
*/
inKind = ComputeIncDecParameters(buttonHeight, &incDecWidth);
@@ -297,9 +303,10 @@ TkpDrawSpinboxButtons(Spinbox *sbPtr, Drawable d)
inBounds.top = macDraw->yOff + MAC_OSX_FOCUS_WIDTH;
inBounds.bottom = macDraw->yOff + Tk_Height(tkwin) - MAC_OSX_FOCUS_WIDTH;
- /* We had to make the entry part of the window smaller so that we
- * wouldn't overdraw the spin buttons with the focus highlight. So
- * now we have to draw the highlightbackground.
+ /*
+ * We had to make the entry part of the window smaller so that we wouldn't
+ * overdraw the spin buttons with the focus highlight. So now we have to
+ * draw the highlightbackground.
*/
bgGC = Tk_GCForColor(sbPtr->entry.highlightBgColorPtr, d);
@@ -317,4 +324,3 @@ TkpDrawSpinboxButtons(Spinbox *sbPtr, Drawable d)
TkMacOSXRestoreDrawingContext(&dc);
return 1;
}
-