summaryrefslogtreecommitdiffstats
path: root/generic/tkSquare.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tkSquare.c')
-rw-r--r--generic/tkSquare.c396
1 files changed, 200 insertions, 196 deletions
diff --git a/generic/tkSquare.c b/generic/tkSquare.c
index 435b841..e9b0081 100644
--- a/generic/tkSquare.c
+++ b/generic/tkSquare.c
@@ -1,32 +1,38 @@
-/*
+/*
* tkSquare.c --
*
- * This module implements "square" widgets that are object
- * based. A "square" is a widget that displays a single square that can
- * be moved around and resized. This file is intended as an example
- * of how to build a widget; it isn't included in the
- * normal wish, but it is included in "tktest".
+ * This module implements "square" widgets that are object based. A
+ * "square" is a widget that displays a single square that can be moved
+ * around and resized. This file is intended as an example of how to
+ * build a widget; it isn't included in the normal wish, but it is
+ * included in "tktest".
*
* Copyright (c) 1997 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.
*/
-#include "tkPort.h"
+#if 0
#define __NO_OLD_CONFIG
-#include "tk.h"
+#endif
+#ifndef USE_TCL_STUBS
+# define USE_TCL_STUBS
+#endif
+#ifndef USE_TK_STUBS
+# define USE_TK_STUBS
+#endif
#include "tkInt.h"
/*
- * A data structure of the following type is kept for each square
- * widget managed by this file:
+ * A data structure of the following type is kept for each square widget
+ * managed by this file:
*/
typedef struct {
- Tk_Window tkwin; /* Window that embodies the square. NULL
- * means window has been deleted but
- * widget record hasn't been cleaned up yet. */
+ Tk_Window tkwin; /* Window that embodies the square. NULL means
+ * window has been deleted but widget record
+ * hasn't been cleaned up yet. */
Display *display; /* X's token for the window's display. */
Tcl_Interp *interp; /* Interpreter associated with widget. */
Tcl_Command widgetCmd; /* Token for square's widget command. */
@@ -47,71 +53,66 @@ typedef struct {
Tcl_Obj *reliefPtr;
GC gc; /* Graphics context for copying from
* off-screen pixmap onto screen. */
- Tcl_Obj *doubleBufferPtr; /* Non-zero means double-buffer redisplay
- * with pixmap; zero means draw straight
- * onto the display. */
- int updatePending; /* Non-zero means a call to SquareDisplay
- * has already been scheduled. */
+ Tcl_Obj *doubleBufferPtr; /* Non-zero means double-buffer redisplay with
+ * pixmap; zero means draw straight onto the
+ * display. */
+ int updatePending; /* Non-zero means a call to SquareDisplay has
+ * already been scheduled. */
} Square;
/*
* Information used for argv parsing.
*/
-static Tk_OptionSpec optionSpecs[] = {
+static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_BORDER, "-background", "background", "Background",
"#d9d9d9", Tk_Offset(Square, bgBorderPtr), -1, 0,
- (ClientData) "white"},
- {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth"},
- {TK_OPTION_SYNONYM, "-bg", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-background"},
+ (ClientData) "white", 0},
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0,
+ (ClientData) "-borderwidth", 0},
+ {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0,
+ (ClientData) "-background", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- "2", Tk_Offset(Square, borderWidthPtr), -1},
+ "2", Tk_Offset(Square, borderWidthPtr), -1, 0, NULL, 0},
{TK_OPTION_BOOLEAN, "-dbl", "doubleBuffer", "DoubleBuffer",
- "1", Tk_Offset(Square, doubleBufferPtr), -1},
- {TK_OPTION_SYNONYM, "-fg", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-foreground"},
+ "1", Tk_Offset(Square, doubleBufferPtr), -1, 0 , NULL, 0},
+ {TK_OPTION_SYNONYM, "-fg", NULL, NULL, NULL, 0, -1, 0,
+ (ClientData) "-foreground", 0},
{TK_OPTION_BORDER, "-foreground", "foreground", "Foreground",
"#b03060", Tk_Offset(Square, fgBorderPtr), -1, 0,
- (ClientData) "black"},
+ (ClientData) "black", 0},
{TK_OPTION_PIXELS, "-posx", "posx", "PosX", "0",
- Tk_Offset(Square, xPtr), -1},
+ Tk_Offset(Square, xPtr), -1, 0, NULL, 0},
{TK_OPTION_PIXELS, "-posy", "posy", "PosY", "0",
- Tk_Offset(Square, yPtr), -1},
+ Tk_Offset(Square, yPtr), -1, 0, NULL, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- "raised", Tk_Offset(Square, reliefPtr), -1},
+ "raised", Tk_Offset(Square, reliefPtr), -1, 0, NULL, 0},
{TK_OPTION_PIXELS, "-size", "size", "Size", "20",
- Tk_Offset(Square, sizeObjPtr), -1},
- {TK_OPTION_END}
+ Tk_Offset(Square, sizeObjPtr), -1, 0, NULL, 0},
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
/*
* Forward declarations for procedures defined later in this file:
*/
-int SquareObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj * CONST objv[]));
-static void SquareDeletedProc _ANSI_ARGS_((
- ClientData clientData));
-static int SquareConfigure _ANSI_ARGS_((Tcl_Interp *interp,
- Square *squarePtr));
-static void SquareDestroy _ANSI_ARGS_((char *memPtr));
-static void SquareDisplay _ANSI_ARGS_((ClientData clientData));
-static void KeepInWindow _ANSI_ARGS_((Square *squarePtr));
-static void SquareObjEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static int SquareWidgetObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *, int objc, Tcl_Obj * CONST objv[]));
+static void SquareDeletedProc(ClientData clientData);
+static int SquareConfigure(Tcl_Interp *interp, Square *squarePtr);
+static void SquareDestroy(char *memPtr);
+static void SquareDisplay(ClientData clientData);
+static void KeepInWindow(Square *squarePtr);
+static void SquareObjEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static int SquareWidgetObjCmd(ClientData clientData,
+ Tcl_Interp *, int objc, Tcl_Obj * const objv[]);
/*
*--------------------------------------------------------------
*
* SquareCmd --
*
- * This procedure is invoked to process the "square" Tcl
- * command. It creates a new "square" widget.
+ * This procedure is invoked to process the "square" Tcl command. It
+ * creates a new "square" widget.
*
* Results:
* A standard Tcl result.
@@ -123,66 +124,65 @@ static int SquareWidgetObjCmd _ANSI_ARGS_((ClientData clientData,
*/
int
-SquareObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* NULL. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj * CONST objv[]; /* Argument objects. */
+SquareObjCmd(
+ ClientData clientData, /* NULL. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
{
Square *squarePtr;
Tk_Window tkwin;
Tk_OptionTable optionTable;
if (objc < 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "pathName ?options?");
+ Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?");
return TCL_ERROR;
}
- tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp),
- Tcl_GetStringFromObj(objv[1], NULL), (char *) NULL);
+ tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp),
+ Tcl_GetString(objv[1]), NULL);
if (tkwin == NULL) {
return TCL_ERROR;
}
Tk_SetClass(tkwin, "Square");
/*
- * Create the option table for this widget class. If it has
- * already been created, the refcount will get bumped and just
- * the pointer will be returned. The refcount getting bumped
- * does not concern us, because Tk will ensure the table is
- * deleted when the interpreter is destroyed.
+ * Create the option table for this widget class. If it has already been
+ * created, the refcount will get bumped and just the pointer will be
+ * returned. The refcount getting bumped does not concern us, because Tk
+ * will ensure the table is deleted when the interpreter is destroyed.
*/
optionTable = Tk_CreateOptionTable(interp, optionSpecs);
/*
- * Allocate and initialize the widget record. The memset allows
- * us to set just the non-NULL/0 items.
+ * Allocate and initialize the widget record. The memset allows us to set
+ * just the non-NULL/0 items.
*/
- squarePtr = (Square *) ckalloc(sizeof(Square));
- memset((void *) squarePtr, 0, (sizeof(Square)));
+ squarePtr = ckalloc(sizeof(Square));
+ memset(squarePtr, 0, sizeof(Square));
- squarePtr->tkwin = tkwin;
- squarePtr->display = Tk_Display(tkwin);
- squarePtr->interp = interp;
- squarePtr->widgetCmd = Tcl_CreateObjCommand(interp,
- Tk_PathName(squarePtr->tkwin), SquareWidgetObjCmd,
- (ClientData) squarePtr, SquareDeletedProc);
- squarePtr->gc = None;
- squarePtr->optionTable = optionTable;
+ squarePtr->tkwin = tkwin;
+ squarePtr->display = Tk_Display(tkwin);
+ squarePtr->interp = interp;
+ squarePtr->widgetCmd = Tcl_CreateObjCommand(interp,
+ Tk_PathName(squarePtr->tkwin), SquareWidgetObjCmd, squarePtr,
+ SquareDeletedProc);
+ squarePtr->gc = None;
+ squarePtr->optionTable = optionTable;
if (Tk_InitOptions(interp, (char *) squarePtr, optionTable, tkwin)
!= TCL_OK) {
Tk_DestroyWindow(squarePtr->tkwin);
- ckfree((char *) squarePtr);
+ ckfree(squarePtr);
return TCL_ERROR;
}
Tk_CreateEventHandler(squarePtr->tkwin, ExposureMask|StructureNotifyMask,
- SquareObjEventProc, (ClientData) squarePtr);
+ SquareObjEventProc, squarePtr);
if (Tk_SetOptions(interp, (char *) squarePtr, optionTable, objc - 2,
- objv + 2, tkwin, NULL, (int *) NULL) != TCL_OK) {
+ objv + 2, tkwin, NULL, NULL) != TCL_OK) {
goto error;
}
if (SquareConfigure(interp, squarePtr) != TCL_OK) {
@@ -193,7 +193,7 @@ SquareObjCmd(clientData, interp, objc, objv)
Tcl_NewStringObj(Tk_PathName(squarePtr->tkwin), -1));
return TCL_OK;
-error:
+ error:
Tk_DestroyWindow(squarePtr->tkwin);
return TCL_ERROR;
}
@@ -203,9 +203,9 @@ error:
*
* SquareWidgetObjCmd --
*
- * This procedure is invoked to process the Tcl command
- * that corresponds to a widget managed by this module.
- * See the user documentation for details on what it does.
+ * This procedure is invoked to process the Tcl command that corresponds
+ * to a widget managed by this module. See the user documentation for
+ * details on what it does.
*
* Results:
* A standard Tcl result.
@@ -217,15 +217,15 @@ error:
*/
static int
-SquareWidgetObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Information about square widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj * CONST objv[]; /* Argument objects. */
+SquareWidgetObjCmd(
+ ClientData clientData, /* Information about square widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj * const objv[]) /* Argument objects. */
{
- Square *squarePtr = (Square *) clientData;
+ Square *squarePtr = clientData;
int result = TCL_OK;
- static CONST char *squareOptions[] = {"cget", "configure", (char *) NULL};
+ static const char *const squareOptions[] = {"cget", "configure", NULL};
enum {
SQUARE_CGET, SQUARE_CONFIGURE
};
@@ -242,60 +242,57 @@ SquareWidgetObjCmd(clientData, interp, objc, objv)
return TCL_ERROR;
}
- Tcl_Preserve((ClientData) squarePtr);
-
+ Tcl_Preserve(squarePtr);
+
switch (index) {
- case SQUARE_CGET: {
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "option");
- goto error;
+ case SQUARE_CGET:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "option");
+ goto error;
+ }
+ resultObjPtr = Tk_GetOptionValue(interp, (char *) squarePtr,
+ squarePtr->optionTable, objv[2], squarePtr->tkwin);
+ if (resultObjPtr == NULL) {
+ result = TCL_ERROR;
+ } else {
+ Tcl_SetObjResult(interp, resultObjPtr);
+ }
+ break;
+ case SQUARE_CONFIGURE:
+ resultObjPtr = NULL;
+ if (objc == 2) {
+ resultObjPtr = Tk_GetOptionInfo(interp, (char *) squarePtr,
+ squarePtr->optionTable, NULL, squarePtr->tkwin);
+ if (resultObjPtr == NULL) {
+ result = TCL_ERROR;
}
- resultObjPtr = Tk_GetOptionValue(interp, (char *) squarePtr,
+ } else if (objc == 3) {
+ resultObjPtr = Tk_GetOptionInfo(interp, (char *) squarePtr,
squarePtr->optionTable, objv[2], squarePtr->tkwin);
if (resultObjPtr == NULL) {
result = TCL_ERROR;
- } else {
- Tcl_SetObjResult(interp, resultObjPtr);
}
- break;
- }
- case SQUARE_CONFIGURE: {
- resultObjPtr = NULL;
- if (objc == 2) {
- resultObjPtr = Tk_GetOptionInfo(interp, (char *) squarePtr,
- squarePtr->optionTable, (Tcl_Obj *) NULL,
- squarePtr->tkwin);
- if (resultObjPtr == NULL) {
- result = TCL_ERROR;
- }
- } else if (objc == 3) {
- resultObjPtr = Tk_GetOptionInfo(interp, (char *) squarePtr,
- squarePtr->optionTable, objv[2], squarePtr->tkwin);
- if (resultObjPtr == NULL) {
- result = TCL_ERROR;
- }
- } else {
- result = Tk_SetOptions(interp, (char *) squarePtr,
- squarePtr->optionTable, objc - 2, objv + 2,
- squarePtr->tkwin, NULL, (int *) NULL);
- if (result == TCL_OK) {
- result = SquareConfigure(interp, squarePtr);
- }
- if (!squarePtr->updatePending) {
- Tcl_DoWhenIdle(SquareDisplay, (ClientData) squarePtr);
- squarePtr->updatePending = 1;
- }
+ } else {
+ result = Tk_SetOptions(interp, (char *) squarePtr,
+ squarePtr->optionTable, objc - 2, objv + 2,
+ squarePtr->tkwin, NULL, NULL);
+ if (result == TCL_OK) {
+ result = SquareConfigure(interp, squarePtr);
}
- if (resultObjPtr != NULL) {
- Tcl_SetObjResult(interp, resultObjPtr);
+ if (!squarePtr->updatePending) {
+ Tcl_DoWhenIdle(SquareDisplay, squarePtr);
+ squarePtr->updatePending = 1;
}
}
+ if (resultObjPtr != NULL) {
+ Tcl_SetObjResult(interp, resultObjPtr);
+ }
}
- Tcl_Release((ClientData) squarePtr);
+ Tcl_Release(squarePtr);
return result;
- error:
- Tcl_Release((ClientData) squarePtr);
+ error:
+ Tcl_Release(squarePtr);
return TCL_ERROR;
}
@@ -304,37 +301,36 @@ SquareWidgetObjCmd(clientData, interp, objc, objv)
*
* SquareConfigure --
*
- * This procedure is called to process an argv/argc list in
- * conjunction with the Tk option database to configure (or
- * reconfigure) a square widget.
+ * This procedure is called to process an argv/argc list in conjunction
+ * with the Tk option database to configure (or reconfigure) a square
+ * widget.
*
* Results:
- * The return value is a standard Tcl result. If TCL_ERROR is
- * returned, then the interp's result contains an error message.
+ * The return value is a standard Tcl result. If TCL_ERROR is returned,
+ * then the interp's result contains an error message.
*
* Side effects:
- * Configuration information, such as colors, border width,
- * etc. get set for squarePtr; old resources get freed,
- * if there were any.
+ * Configuration information, such as colors, border width, etc. get set
+ * for squarePtr; old resources get freed, if there were any.
*
*----------------------------------------------------------------------
*/
static int
-SquareConfigure(interp, squarePtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- Square *squarePtr; /* Information about widget. */
+SquareConfigure(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Square *squarePtr) /* Information about widget. */
{
int borderWidth;
Tk_3DBorder bgBorder;
int doubleBuffer;
/*
- * Set the background for the window and create a graphics context
- * for use during redisplay.
+ * Set the background for the window and create a graphics context for use
+ * during redisplay.
*/
- bgBorder = Tk_Get3DBorderFromObj(squarePtr->tkwin,
+ bgBorder = Tk_Get3DBorderFromObj(squarePtr->tkwin,
squarePtr->bgBorderPtr);
Tk_SetWindowBackground(squarePtr->tkwin,
Tk_3DBorderColor(bgBorder)->pixel);
@@ -348,8 +344,8 @@ SquareConfigure(interp, squarePtr)
}
/*
- * Register the desired geometry for the window. Then arrange for
- * the window to be redisplayed.
+ * Register the desired geometry for the window. Then arrange for the
+ * window to be redisplayed.
*/
Tk_GeometryRequest(squarePtr->tkwin, 200, 150);
@@ -357,7 +353,7 @@ SquareConfigure(interp, squarePtr)
&borderWidth);
Tk_SetInternalBorder(squarePtr->tkwin, borderWidth);
if (!squarePtr->updatePending) {
- Tcl_DoWhenIdle(SquareDisplay, (ClientData) squarePtr);
+ Tcl_DoWhenIdle(SquareDisplay, squarePtr);
squarePtr->updatePending = 1;
}
KeepInWindow(squarePtr);
@@ -369,35 +365,35 @@ SquareConfigure(interp, squarePtr)
*
* SquareObjEventProc --
*
- * This procedure is invoked by the Tk dispatcher for various
- * events on squares.
+ * This procedure is invoked by the Tk dispatcher for various events on
+ * squares.
*
* Results:
* None.
*
* Side effects:
- * When the window gets deleted, internal structures get
- * cleaned up. When it gets exposed, it is redisplayed.
+ * When the window gets deleted, internal structures get cleaned up. When
+ * it gets exposed, it is redisplayed.
*
*--------------------------------------------------------------
*/
static void
-SquareObjEventProc(clientData, eventPtr)
- ClientData clientData; /* Information about window. */
- XEvent *eventPtr; /* Information about event. */
+SquareObjEventProc(
+ ClientData clientData, /* Information about window. */
+ XEvent *eventPtr) /* Information about event. */
{
- Square *squarePtr = (Square *) clientData;
+ Square *squarePtr = clientData;
if (eventPtr->type == Expose) {
if (!squarePtr->updatePending) {
- Tcl_DoWhenIdle(SquareDisplay, (ClientData) squarePtr);
+ Tcl_DoWhenIdle(SquareDisplay, squarePtr);
squarePtr->updatePending = 1;
}
} else if (eventPtr->type == ConfigureNotify) {
KeepInWindow(squarePtr);
if (!squarePtr->updatePending) {
- Tcl_DoWhenIdle(SquareDisplay, (ClientData) squarePtr);
+ Tcl_DoWhenIdle(SquareDisplay, squarePtr);
squarePtr->updatePending = 1;
}
} else if (eventPtr->type == DestroyNotify) {
@@ -412,9 +408,9 @@ SquareObjEventProc(clientData, eventPtr)
squarePtr->widgetCmd);
}
if (squarePtr->updatePending) {
- Tcl_CancelIdleCall(SquareDisplay, (ClientData) squarePtr);
+ Tcl_CancelIdleCall(SquareDisplay, squarePtr);
}
- Tcl_EventuallyFree((ClientData) squarePtr, SquareDestroy);
+ Tcl_EventuallyFree(squarePtr, SquareDestroy);
}
}
@@ -423,9 +419,9 @@ SquareObjEventProc(clientData, eventPtr)
*
* SquareDeletedProc --
*
- * This procedure is invoked when a widget command is deleted. If
- * the widget isn't already in the process of being destroyed,
- * this command destroys it.
+ * This procedure is invoked when a widget command is deleted. If the
+ * widget isn't already in the process of being destroyed, this command
+ * destroys it.
*
* Results:
* None.
@@ -437,17 +433,17 @@ SquareObjEventProc(clientData, eventPtr)
*/
static void
-SquareDeletedProc(clientData)
- ClientData clientData; /* Pointer to widget record for widget. */
+SquareDeletedProc(
+ ClientData clientData) /* Pointer to widget record for widget. */
{
- Square *squarePtr = (Square *) clientData;
+ Square *squarePtr = clientData;
Tk_Window tkwin = squarePtr->tkwin;
/*
- * This procedure could be invoked either because the window was
- * destroyed and the command was then deleted (in which case tkwin
- * is NULL) or because the command was deleted, and then this procedure
- * destroys the widget.
+ * This procedure could be invoked either because the window was destroyed
+ * and the command was then deleted (in which case tkwin is NULL) or
+ * because the command was deleted, and then this procedure destroys the
+ * widget.
*/
if (tkwin != NULL) {
@@ -460,9 +456,9 @@ SquareDeletedProc(clientData)
*
* SquareDisplay --
*
- * This procedure redraws the contents of a square 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 square 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.
@@ -474,10 +470,10 @@ SquareDeletedProc(clientData)
*/
static void
-SquareDisplay(clientData)
- ClientData clientData; /* Information about window. */
+SquareDisplay(
+ ClientData clientData) /* Information about window. */
{
- Square *squarePtr = (Square *) clientData;
+ Square *squarePtr = clientData;
Tk_Window tkwin = squarePtr->tkwin;
Pixmap pm = None;
Drawable d;
@@ -510,7 +506,7 @@ SquareDisplay(clientData)
Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->borderWidthPtr,
&borderWidth);
- bgBorder = Tk_Get3DBorderFromObj(squarePtr->tkwin,
+ bgBorder = Tk_Get3DBorderFromObj(squarePtr->tkwin,
squarePtr->bgBorderPtr);
Tk_GetReliefFromObj(NULL, squarePtr->reliefPtr, &relief);
Tk_Fill3DRectangle(tkwin, d, bgBorder, 0, 0, Tk_Width(tkwin),
@@ -521,9 +517,9 @@ SquareDisplay(clientData)
*/
Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->sizeObjPtr, &size);
- fgBorder = Tk_Get3DBorderFromObj(squarePtr->tkwin,
+ fgBorder = Tk_Get3DBorderFromObj(squarePtr->tkwin,
squarePtr->fgBorderPtr);
- Tk_Fill3DRectangle(tkwin, d, fgBorder, squarePtr->x, squarePtr->y, size,
+ Tk_Fill3DRectangle(tkwin, d, fgBorder, squarePtr->x, squarePtr->y, size,
size, borderWidth, TK_RELIEF_RAISED);
/*
@@ -543,9 +539,9 @@ SquareDisplay(clientData)
*
* SquareDestroy --
*
- * This procedure is invoked by Tcl_EventuallyFree or Tcl_Release
- * to clean up the internal structure of a square at a safe time
- * (when no-one is using it anymore).
+ * This procedure is invoked by Tcl_EventuallyFree or Tcl_Release to
+ * clean up the internal structure of a square at a safe time (when
+ * no-one is using it anymore).
*
* Results:
* None.
@@ -557,12 +553,12 @@ SquareDisplay(clientData)
*/
static void
-SquareDestroy(memPtr)
- char *memPtr; /* Info about square widget. */
+SquareDestroy(
+ char *memPtr) /* Info about square widget. */
{
Square *squarePtr = (Square *) memPtr;
-
- ckfree((char *) squarePtr);
+
+ ckfree(squarePtr);
}
/*
@@ -570,31 +566,31 @@ SquareDestroy(memPtr)
*
* KeepInWindow --
*
- * Adjust the position of the square if necessary to keep it in
- * the widget's window.
+ * Adjust the position of the square if necessary to keep it in the
+ * widget's window.
*
* Results:
* None.
*
* Side effects:
- * The x and y position of the square are adjusted if necessary
- * to keep the square in the window.
+ * The x and y position of the square are adjusted if necessary to keep
+ * the square in the window.
*
*----------------------------------------------------------------------
*/
static void
-KeepInWindow(squarePtr)
- register Square *squarePtr; /* Pointer to widget record. */
+KeepInWindow(
+ register Square *squarePtr) /* Pointer to widget record. */
{
int i, bd, relief;
int borderWidth, size;
Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->borderWidthPtr,
&borderWidth);
- Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->xPtr,
+ Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->xPtr,
&squarePtr->x);
- Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->yPtr,
+ Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->yPtr,
&squarePtr->y);
Tk_GetPixelsFromObj(NULL, squarePtr->tkwin, squarePtr->sizeObjPtr, &size);
Tk_GetReliefFromObj(NULL, squarePtr->reliefPtr, &relief);
@@ -617,3 +613,11 @@ KeepInWindow(squarePtr)
squarePtr->y = bd;
}
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */