Import Tk 8.6.11
This commit is contained in:
@@ -145,7 +145,7 @@ TkpNewMenu(
|
||||
|
||||
void
|
||||
TkpDestroyMenu(
|
||||
TkMenu *menuPtr)
|
||||
TCL_UNUSED(TkMenu *))
|
||||
{
|
||||
/*
|
||||
* Nothing to do.
|
||||
@@ -171,7 +171,7 @@ TkpDestroyMenu(
|
||||
|
||||
void
|
||||
TkpDestroyMenuEntry(
|
||||
TkMenuEntry *mEntryPtr)
|
||||
TCL_UNUSED(TkMenuEntry *))
|
||||
{
|
||||
/*
|
||||
* Nothing to do.
|
||||
@@ -199,7 +199,7 @@ TkpDestroyMenuEntry(
|
||||
|
||||
int
|
||||
TkpConfigureMenuEntry(
|
||||
register TkMenuEntry *mePtr)/* Information about menu entry; may or may
|
||||
TkMenuEntry *mePtr)/* Information about menu entry; may or may
|
||||
* not already have values for some fields. */
|
||||
{
|
||||
/*
|
||||
@@ -239,7 +239,7 @@ TkpConfigureMenuEntry(
|
||||
|
||||
int
|
||||
TkpMenuNewEntry(
|
||||
TkMenuEntry *mePtr)
|
||||
TCL_UNUSED(TkMenuEntry *))
|
||||
{
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -292,9 +292,9 @@ TkpSetWindowMenuBar(
|
||||
|
||||
void
|
||||
TkpSetMainMenubar(
|
||||
Tcl_Interp *interp,
|
||||
Tk_Window tkwin,
|
||||
const char *menuName)
|
||||
TCL_UNUSED(Tcl_Interp *),
|
||||
TCL_UNUSED(Tk_Window),
|
||||
TCL_UNUSED(const char *))
|
||||
{
|
||||
/*
|
||||
* Nothing to do.
|
||||
@@ -323,8 +323,8 @@ static void
|
||||
GetMenuIndicatorGeometry(
|
||||
TkMenu *menuPtr, /* The menu we are drawing. */
|
||||
TkMenuEntry *mePtr, /* The entry we are interested in. */
|
||||
Tk_Font tkfont, /* The precalculated font */
|
||||
const Tk_FontMetrics *fmPtr,/* The precalculated metrics */
|
||||
TCL_UNUSED(Tk_Font), /* The precalculated font */
|
||||
TCL_UNUSED(const Tk_FontMetrics *),/* The precalculated metrics */
|
||||
int *widthPtr, /* The resulting width */
|
||||
int *heightPtr) /* The resulting height */
|
||||
{
|
||||
@@ -445,7 +445,6 @@ DrawMenuEntryBackground(
|
||||
} else {
|
||||
relief = TK_RELIEF_RAISED;
|
||||
}
|
||||
|
||||
Tk_GetPixelsFromObj(NULL, menuPtr->tkwin,
|
||||
menuPtr->activeBorderWidthPtr, &activeBorderWidth);
|
||||
Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height,
|
||||
@@ -524,7 +523,7 @@ DrawMenuEntryAccelerator(
|
||||
if (menuPtr->menuType == MENUBAR) {
|
||||
left += 5;
|
||||
}
|
||||
Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel,
|
||||
Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel,
|
||||
mePtr->accelLength, left,
|
||||
(y + (height + fmPtr->ascent - fmPtr->descent) / 2));
|
||||
}
|
||||
@@ -554,11 +553,11 @@ DrawMenuEntryIndicator(
|
||||
Tk_3DBorder border, /* The background color */
|
||||
XColor *indicatorColor, /* The color to draw indicators with */
|
||||
XColor *disableColor, /* The color use use when disabled */
|
||||
Tk_Font tkfont, /* The font to draw with */
|
||||
const Tk_FontMetrics *fmPtr,/* The font metrics of the font */
|
||||
TCL_UNUSED(Tk_Font), /* The font to draw with */
|
||||
TCL_UNUSED(const Tk_FontMetrics *),/* The font metrics of the font */
|
||||
int x, /* The left of the entry rect */
|
||||
int y, /* The top of the entry rect */
|
||||
int width, /* Width of menu entry */
|
||||
TCL_UNUSED(int), /* Width of menu entry */
|
||||
int height) /* Height of menu entry */
|
||||
{
|
||||
/*
|
||||
@@ -623,11 +622,11 @@ DrawMenuEntryIndicator(
|
||||
static void
|
||||
DrawMenuSeparator(
|
||||
TkMenu *menuPtr, /* The menu we are drawing */
|
||||
TkMenuEntry *mePtr, /* The entry we are drawing */
|
||||
TCL_UNUSED(TkMenuEntry *), /* The entry we are drawing */
|
||||
Drawable d, /* The drawable we are using */
|
||||
GC gc, /* The gc to draw into */
|
||||
Tk_Font tkfont, /* The font to draw with */
|
||||
const Tk_FontMetrics *fmPtr,/* The font metrics from the font */
|
||||
TCL_UNUSED(GC), /* The gc to draw into */
|
||||
TCL_UNUSED(Tk_Font), /* The font to draw with */
|
||||
TCL_UNUSED(const Tk_FontMetrics *),/* The font metrics from the font */
|
||||
int x, int y,
|
||||
int width, int height)
|
||||
{
|
||||
@@ -790,7 +789,7 @@ DrawMenuEntryLabel(
|
||||
imageHeight, d, leftEdge + imageXOffset,
|
||||
(int) (y + (mePtr->height-imageHeight)/2 + imageYOffset));
|
||||
}
|
||||
} else if (mePtr->bitmapPtr != None) {
|
||||
} else if (mePtr->bitmapPtr != NULL) {
|
||||
Pixmap bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin, mePtr->bitmapPtr);
|
||||
|
||||
XCopyPlane(menuPtr->display, bitmap, d, gc, 0, 0,
|
||||
@@ -818,7 +817,7 @@ DrawMenuEntryLabel(
|
||||
XFillRectangle(menuPtr->display, d, menuPtr->disabledGC, x, y,
|
||||
(unsigned) width, (unsigned) height);
|
||||
} else if ((mePtr->image != NULL)
|
||||
&& (menuPtr->disabledImageGC != None)) {
|
||||
&& (menuPtr->disabledImageGC != NULL)) {
|
||||
XFillRectangle(menuPtr->display, d, menuPtr->disabledImageGC,
|
||||
leftEdge + imageXOffset,
|
||||
(int) (y + (mePtr->height - imageHeight)/2 + imageYOffset),
|
||||
@@ -852,19 +851,19 @@ DrawMenuUnderline(
|
||||
Tk_Font tkfont, /* The precalculated font */
|
||||
const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
|
||||
int x, int y,
|
||||
int width, int height)
|
||||
TCL_UNUSED(int), int height)
|
||||
{
|
||||
if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) {
|
||||
int len;
|
||||
|
||||
len = Tcl_GetCharLength(mePtr->labelPtr);
|
||||
if (mePtr->underline < len) {
|
||||
int activeBorderWidth, leftEdge;
|
||||
int activeBorderWidth, leftEdge, ch;
|
||||
const char *label, *start, *end;
|
||||
|
||||
label = Tcl_GetString(mePtr->labelPtr);
|
||||
start = Tcl_UtfAtIndex(label, mePtr->underline);
|
||||
end = Tcl_UtfNext(start);
|
||||
start = TkUtfAtIndex(label, mePtr->underline);
|
||||
end = start + TkUtfToUniChar(start, &ch);
|
||||
|
||||
Tk_GetPixelsFromObj(NULL, menuPtr->tkwin,
|
||||
menuPtr->activeBorderWidthPtr, &activeBorderWidth);
|
||||
@@ -931,7 +930,7 @@ TkpPostMenu(
|
||||
|
||||
int
|
||||
TkpPostTearoffMenu(
|
||||
Tcl_Interp *interp, /* The interpreter of the menu */
|
||||
TCL_UNUSED(Tcl_Interp *), /* The interpreter of the menu */
|
||||
TkMenu *menuPtr, /* The menu we are posting */
|
||||
int x, int y, int index) /* The root X,Y coordinates where the
|
||||
* specified entry will be posted */
|
||||
@@ -1021,9 +1020,9 @@ TkpPostTearoffMenu(
|
||||
|
||||
static void
|
||||
GetMenuSeparatorGeometry(
|
||||
TkMenu *menuPtr, /* The menu we are measuring */
|
||||
TkMenuEntry *mePtr, /* The entry we are measuring */
|
||||
Tk_Font tkfont, /* The precalculated font */
|
||||
TCL_UNUSED(TkMenu *), /* The menu we are measuring */
|
||||
TCL_UNUSED(TkMenuEntry *), /* The entry we are measuring */
|
||||
TCL_UNUSED(Tk_Font), /* The precalculated font */
|
||||
const Tk_FontMetrics *fmPtr,/* The precalcualted font metrics */
|
||||
int *widthPtr, /* The resulting width */
|
||||
int *heightPtr) /* The resulting height */
|
||||
@@ -1051,13 +1050,13 @@ GetMenuSeparatorGeometry(
|
||||
static void
|
||||
GetTearoffEntryGeometry(
|
||||
TkMenu *menuPtr, /* The menu we are drawing */
|
||||
TkMenuEntry *mePtr, /* The entry we are measuring */
|
||||
TCL_UNUSED(TkMenuEntry *), /* The entry we are measuring */
|
||||
Tk_Font tkfont, /* The precalculated font */
|
||||
const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
|
||||
int *widthPtr, /* The resulting width */
|
||||
int *heightPtr) /* The resulting height */
|
||||
{
|
||||
if (menuPtr->menuType != MASTER_MENU) {
|
||||
if (menuPtr->menuType != MAIN_MENU) {
|
||||
*heightPtr = 0;
|
||||
*widthPtr = 0;
|
||||
} else {
|
||||
@@ -1092,15 +1091,13 @@ TkpComputeMenubarGeometry(
|
||||
Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr;
|
||||
int width, height, i, j, x, y, currentRowHeight, maxWidth;
|
||||
int maxWindowWidth, lastRowBreak, lastEntry;
|
||||
int borderWidth, activeBorderWidth, helpMenuIndex = -1;
|
||||
int activeBorderWidth, helpMenuIndex = -1;
|
||||
TkMenuEntry *mePtr;
|
||||
|
||||
if (menuPtr->tkwin == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr,
|
||||
&borderWidth);
|
||||
Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr,
|
||||
&activeBorderWidth);
|
||||
maxWidth = 0;
|
||||
@@ -1111,7 +1108,7 @@ TkpComputeMenubarGeometry(
|
||||
|
||||
maxWindowWidth = Tk_Width(menuPtr->tkwin);
|
||||
if (maxWindowWidth == 1) {
|
||||
maxWindowWidth = 0x7ffffff;
|
||||
maxWindowWidth = 0x7FFFFFF;
|
||||
}
|
||||
currentRowHeight = 0;
|
||||
Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr,
|
||||
@@ -1122,7 +1119,7 @@ TkpComputeMenubarGeometry(
|
||||
/*
|
||||
* On the Mac especially, getting font metrics can be quite slow, so
|
||||
* we want to do it intelligently. We are going to precalculate them
|
||||
* and pass them down to all of the measureing and drawing routines.
|
||||
* and pass them down to all of the measuring and drawing routines.
|
||||
* We will measure the font metrics of the menu once, and if an entry
|
||||
* has a font set, we will measure it as we come to it, and then we
|
||||
* decide which set to give the geometry routines.
|
||||
@@ -1269,11 +1266,11 @@ TkpComputeMenubarGeometry(
|
||||
static void
|
||||
DrawTearoffEntry(
|
||||
TkMenu *menuPtr, /* The menu we are drawing */
|
||||
TkMenuEntry *mePtr, /* The entry we are drawing */
|
||||
TCL_UNUSED(TkMenuEntry *), /* The entry we are drawing */
|
||||
Drawable d, /* The drawable we are drawing into */
|
||||
GC gc, /* The gc we are drawing with */
|
||||
Tk_Font tkfont, /* The font we are drawing with */
|
||||
const Tk_FontMetrics *fmPtr,/* The metrics we are drawing with */
|
||||
TCL_UNUSED(GC), /* The gc we are drawing with */
|
||||
TCL_UNUSED(Tk_Font), /* The font we are drawing with */
|
||||
TCL_UNUSED(const Tk_FontMetrics *),/* The metrics we are drawing with */
|
||||
int x, int y,
|
||||
int width, int height)
|
||||
{
|
||||
@@ -1281,7 +1278,7 @@ DrawTearoffEntry(
|
||||
int segmentWidth, maxX;
|
||||
Tk_3DBorder border;
|
||||
|
||||
if (menuPtr->menuType != MASTER_MENU) {
|
||||
if (menuPtr->menuType != MAIN_MENU) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1324,8 +1321,8 @@ DrawTearoffEntry(
|
||||
|
||||
void
|
||||
TkpInitializeMenuBindings(
|
||||
Tcl_Interp *interp, /* The interpreter to set. */
|
||||
Tk_BindingTable bindingTable)
|
||||
TCL_UNUSED(Tcl_Interp *), /* The interpreter to set. */
|
||||
TCL_UNUSED(Tk_BindingTable))
|
||||
/* The table to add to. */
|
||||
{
|
||||
/*
|
||||
@@ -1376,7 +1373,7 @@ SetHelpMenu(
|
||||
&& (cascadeEntryPtr->menuPtr->masterMenuPtr->tkwin != NULL)
|
||||
&& (menuPtr->masterMenuPtr->tkwin != NULL)) {
|
||||
TkMenu *masterMenuPtr = cascadeEntryPtr->menuPtr->masterMenuPtr;
|
||||
char *helpMenuName = ckalloc(strlen(Tk_PathName(
|
||||
char *helpMenuName = (char *)ckalloc(strlen(Tk_PathName(
|
||||
masterMenuPtr->tkwin)) + strlen(".help") + 1);
|
||||
|
||||
strcpy(helpMenuName, Tk_PathName(masterMenuPtr->tkwin));
|
||||
@@ -1852,8 +1849,8 @@ TkpComputeStandardMenuGeometry(
|
||||
|
||||
void
|
||||
TkpMenuNotifyToplevelCreate(
|
||||
Tcl_Interp *interp, /* The interp the menu lives in. */
|
||||
const char *menuName) /* The name of the menu to reconfigure. */
|
||||
TCL_UNUSED(Tcl_Interp *), /* The interp the menu lives in. */
|
||||
TCL_UNUSED(const char *)) /* The name of the menu to reconfigure. */
|
||||
{
|
||||
/*
|
||||
* Nothing to do.
|
||||
|
||||
Reference in New Issue
Block a user