(clientData)
| 1337 | * |
| 1338 | * Side effects: |
| 1339 | * Fields of menu entries are changed to reflect their |
| 1340 | * current positions, and the size of the menu window |
| 1341 | * itself may be changed. |
| 1342 | * |
| 1343 | *-------------------------------------------------------------- |
| 1344 | */ |
| 1345 | |
| 1346 | static void |
| 1347 | ComputeMenuGeometry(clientData) |
| 1348 | ClientData clientData; /* Structure describing menu. */ |
| 1349 | { |
| 1350 | Menu *menuPtr = (Menu *) clientData; |
| 1351 | register MenuEntry *mePtr; |
| 1352 | XFontStruct *fontPtr; |
| 1353 | int maxLabelWidth, maxSelectorWidth, maxAccelWidth; |
| 1354 | int width, height, selectorSpace, horizMargin; |
| 1355 | int i, y; |
| 1356 | |
| 1357 | if (menuPtr->tkwin == NULL) { |
| 1358 | return; |
| 1359 | } |
| 1360 | |
| 1361 | maxLabelWidth = maxSelectorWidth = maxAccelWidth = 0; |
| 1362 | y = menuPtr->borderWidth; |
| 1363 | |
| 1364 | for (i = 0; i < menuPtr->numEntries; i++) { |
| 1365 | mePtr = menuPtr->entries[i]; |
| 1366 | selectorSpace = 0; |
| 1367 | fontPtr = mePtr->fontPtr; |
| 1368 | if (fontPtr == NULL) { |
| 1369 | fontPtr = menuPtr->fontPtr; |
| 1370 | } |
| 1371 | |
| 1372 | /* |
| 1373 | * For each entry, compute the height required by that |
| 1374 | * particular entry, plus three widths: the width of the |
| 1375 | * label, the width to allow for a selector to be displayed |
| 1376 | * to the left of the label (if any), and the width of the |
| 1377 | * accelerator to be displayed to the right of the label |
| 1378 | * (if any). These sizes depend, of course, on the type |
| 1379 | * of the entry. |
| 1380 | */ |
| 1381 | |
| 1382 | if (mePtr->bitmap != None) { |
| 1383 | unsigned int bitmapWidth, bitmapHeight; |
| 1384 | |
| 1385 | #if defined(USE_XPM3) |
| 1386 | Tk_SizeOfPixmap(mePtr->bitmap, &bitmapWidth, &bitmapHeight); |
| 1387 | #else |
| 1388 | Tk_SizeOfBitmap(mePtr->bitmap, &bitmapWidth, &bitmapHeight); |
| 1389 | #endif |
| 1390 | mePtr->height = bitmapHeight; |
| 1391 | width = bitmapWidth; |
| 1392 | if (mePtr->type == CHECK_BUTTON_ENTRY) { |
| 1393 | selectorSpace = (14*mePtr->height)/10; |
| 1394 | mePtr->selectorDiameter = (65*mePtr->height)/100; |
| 1395 | } else if (mePtr->type == RADIO_BUTTON_ENTRY) { |
| 1396 | selectorSpace = (14*mePtr->height)/10; |
nothing calls this directly
no test coverage detected