summaryrefslogtreecommitdiffstats
path: root/generic/tkPanedWindow.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tkPanedWindow.c')
-rw-r--r--generic/tkPanedWindow.c60
1 files changed, 33 insertions, 27 deletions
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c
index b5ca3b2..0a2c6f8 100644
--- a/generic/tkPanedWindow.c
+++ b/generic/tkPanedWindow.c
@@ -80,11 +80,11 @@ typedef struct {
typedef struct Pane {
Tk_Window tkwin; /* Window being managed. */
- int minSize; /* Minimum size of this pane, on the relevant
+ Tcl_Obj *minSizeObj; /* Minimum size of this pane, on the relevant
* axis, in pixels. */
- int padx; /* Additional padding requested for pane, in
+ Tcl_Obj *padXObj; /* Additional padding requested for pane, in
* the x dimension. */
- int pady; /* Additional padding requested for pane, in
+ Tcl_Obj *padYObj; /* Additional padding requested for pane, in
* the y dimension. */
Tcl_Obj *widthObj, *heightObj;
/* Tcl_Obj rep's of pane width/height, to
@@ -106,6 +106,10 @@ typedef struct Pane {
/* Paned window managing the window. */
Tk_Window after; /* Placeholder for parsing options. */
Tk_Window before; /* Placeholder for parsing options. */
+#ifdef BUILD_tk
+ int padX, padY;
+ int minSize;
+#endif
} Pane;
/*
@@ -155,6 +159,8 @@ typedef struct PanedWindow {
int numPanes; /* Number of panes. */
int sizeofPanes; /* Number of elements in the panes array. */
int flags; /* Flags for widget; see below. */
+ Tcl_Obj *borderWidthObj;
+ Tcl_Obj *handlePadPtr;
} PanedWindow;
/*
@@ -279,13 +285,13 @@ static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_SYNONYM, "-bg", NULL, NULL,
NULL, 0, TCL_INDEX_NONE, 0, "-background", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_PANEDWINDOW_BORDERWIDTH, TCL_INDEX_NONE, offsetof(PanedWindow, borderWidth),
+ DEF_PANEDWINDOW_BORDERWIDTH, offsetof(PanedWindow, borderWidthObj), offsetof(PanedWindow, borderWidth),
0, 0, GEOMETRY},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_PANEDWINDOW_CURSOR, TCL_INDEX_NONE, offsetof(PanedWindow, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-handlepad", "handlePad", "HandlePad",
- DEF_PANEDWINDOW_HANDLEPAD, TCL_INDEX_NONE, offsetof(PanedWindow, handlePad),
+ DEF_PANEDWINDOW_HANDLEPAD, offsetof(PanedWindow, handlePadPtr), offsetof(PanedWindow, handlePad),
0, 0, GEOMETRY},
{TK_OPTION_PIXELS, "-handlesize", "handleSize", "HandleSize",
DEF_PANEDWINDOW_HANDLESIZE, offsetof(PanedWindow, handleSizePtr),
@@ -314,7 +320,7 @@ static const Tk_OptionSpec optionSpecs[] = {
DEF_PANEDWINDOW_SASHCURSOR, TCL_INDEX_NONE, offsetof(PanedWindow, sashCursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-sashpad", "sashPad", "SashPad",
- DEF_PANEDWINDOW_SASHPAD, TCL_INDEX_NONE, offsetof(PanedWindow, sashPad),
+ DEF_PANEDWINDOW_SASHPAD, offsetof(PanedWindow, sashPadPtr), offsetof(PanedWindow, sashPad),
0, 0, GEOMETRY},
{TK_OPTION_RELIEF, "-sashrelief", "sashRelief", "Relief",
DEF_PANEDWINDOW_SASHRELIEF, TCL_INDEX_NONE, offsetof(PanedWindow, sashRelief),
@@ -344,11 +350,11 @@ static const Tk_OptionSpec paneOptionSpecs[] = {
{TK_OPTION_BOOLEAN, "-hide", "hide", "Hide",
DEF_PANEDWINDOW_PANE_HIDE, TCL_INDEX_NONE, offsetof(Pane, hide), 0,0,GEOMETRY},
{TK_OPTION_PIXELS, "-minsize", NULL, NULL,
- DEF_PANEDWINDOW_PANE_MINSIZE, TCL_INDEX_NONE, offsetof(Pane, minSize), 0, 0, 0},
+ DEF_PANEDWINDOW_PANE_MINSIZE, offsetof(Pane, minSizeObj), offsetof(Pane, minSize), 0, 0, 0},
{TK_OPTION_PIXELS, "-padx", NULL, NULL,
- DEF_PANEDWINDOW_PANE_PADX, TCL_INDEX_NONE, offsetof(Pane, padx), 0, 0, 0},
+ DEF_PANEDWINDOW_PANE_PADX, offsetof(Pane, padXObj), offsetof(Pane, padX), 0, 0, 0},
{TK_OPTION_PIXELS, "-pady", NULL, NULL,
- DEF_PANEDWINDOW_PANE_PADY, TCL_INDEX_NONE, offsetof(Pane, pady), 0, 0, 0},
+ DEF_PANEDWINDOW_PANE_PADY, offsetof(Pane, padYObj), offsetof(Pane, padY), 0, 0, 0},
{TK_OPTION_CUSTOM, "-sticky", NULL, NULL,
DEF_PANEDWINDOW_PANE_STICKY, TCL_INDEX_NONE, offsetof(Pane, sticky),
0, &stickyOption, 0},
@@ -799,7 +805,7 @@ ConfigurePanes(
*/
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't add %s to itself", arg));
+ "cannot add %s to itself", arg));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", (char *)NULL);
return TCL_ERROR;
} else if (Tk_IsTopLevel(tkwin)) {
@@ -808,7 +814,7 @@ ConfigurePanes(
*/
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't add toplevel %s to %s", arg,
+ "cannot add toplevel %s to %s", arg,
Tk_PathName(pwPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", (char *)NULL);
return TCL_ERROR;
@@ -825,7 +831,7 @@ ConfigurePanes(
}
if (Tk_IsTopLevel(ancestor)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't add %s to %s", arg,
+ "cannot add %s to %s", arg,
Tk_PathName(pwPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY",
"HIERARCHY", (char *)NULL);
@@ -950,7 +956,7 @@ ConfigurePanes(
/*
* Make sure this pane wasn't already put into the inserts array,
* i.e., when the user specifies the same window multiple times in a
- * single add commaned.
+ * single add command.
*/
for (j = 0; j < insertIndex; j++) {
if (inserts[j]->tkwin == tkwin) {
@@ -1795,14 +1801,14 @@ ArrangePanes(
} else {
paneSize = panePtr->paneWidth;
}
- stretchReserve -= paneSize + (2 * panePtr->padx);
+ stretchReserve -= paneSize + (2 * panePtr->padX);
} else {
if (panePtr->height > 0) {
paneSize = panePtr->height;
} else {
paneSize = panePtr->paneHeight;
}
- stretchReserve -= paneSize + (2 * panePtr->pady);
+ stretchReserve -= paneSize + (2 * panePtr->padY);
}
if (IsStretchable(panePtr->stretch,i,first,last)
&& Tk_IsMapped(pwPtr->tkwin)) {
@@ -1900,9 +1906,9 @@ ArrangePanes(
}
if (horizontal) {
paneWidth = paneSize;
- paneHeight = pwHeight - (2 * panePtr->pady);
+ paneHeight = pwHeight - (2 * panePtr->padY);
} else {
- paneWidth = pwWidth - (2 * panePtr->padx);
+ paneWidth = pwWidth - (2 * panePtr->padX);
paneHeight = paneSize;
}
@@ -1946,7 +1952,7 @@ ArrangePanes(
*/
if (horizontal) {
- x += paneWidth + (2 * panePtr->padx);
+ x += paneWidth + (2 * panePtr->padX);
if (x < internalBW) {
x = internalBW;
}
@@ -1956,7 +1962,7 @@ ArrangePanes(
panePtr->handley = y + pwPtr->handlePad;
x += sashWidth;
} else {
- y += paneHeight + (2 * panePtr->pady);
+ y += paneHeight + (2 * panePtr->padY);
if (y < internalBW) {
y = internalBW;
}
@@ -1976,8 +1982,8 @@ ArrangePanes(
AdjustForSticky(panePtr->sticky, paneWidth, paneHeight,
&paneX, &paneY, &newPaneWidth, &newPaneHeight);
- paneX += panePtr->padx;
- paneY += panePtr->pady;
+ paneX += panePtr->padX;
+ paneY += panePtr->padY;
/*
* Now put the window in the proper spot.
@@ -2259,14 +2265,14 @@ ComputeGeometry(
*/
if (horizontal) {
- x += panePtr->paneWidth + (2 * panePtr->padx);
+ x += panePtr->paneWidth + (2 * panePtr->padX);
panePtr->sashx = x + sashOffset;
panePtr->sashy = y;
panePtr->handlex = x + handleOffset;
panePtr->handley = y + pwPtr->handlePad;
x += sashWidth;
} else {
- y += panePtr->paneHeight + (2 * panePtr->pady);
+ y += panePtr->paneHeight + (2 * panePtr->padY);
panePtr->sashx = x;
panePtr->sashy = y + sashOffset;
panePtr->handlex = x + pwPtr->handlePad;
@@ -2291,7 +2297,7 @@ ComputeGeometry(
doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width;
dim = Tk_ReqHeight(panePtr->tkwin) + doubleBw;
}
- dim += 2 * panePtr->pady;
+ dim += 2 * panePtr->padY;
if (dim > reqHeight) {
reqHeight = dim;
}
@@ -2307,7 +2313,7 @@ ComputeGeometry(
doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width;
dim = Tk_ReqWidth(panePtr->tkwin) + doubleBw;
}
- dim += 2 * panePtr->padx;
+ dim += 2 * panePtr->padX;
if (dim > reqWidth) {
reqWidth = dim;
}
@@ -2636,10 +2642,10 @@ MoveSash(
}
if (horizontal) {
panePtr->paneWidth = panePtr->width = panePtr->sashx
- - sashOffset - panePtr->x - (2 * panePtr->padx);
+ - sashOffset - panePtr->x - (2 * panePtr->padX);
} else {
panePtr->paneHeight = panePtr->height = panePtr->sashy
- - sashOffset - panePtr->y - (2 * panePtr->pady);
+ - sashOffset - panePtr->y - (2 * panePtr->padY);
}
}