(mbPtr)
| 970 | * Results: |
| 971 | * None. |
| 972 | * |
| 973 | * Side effects: |
| 974 | * The menu button's window may change size. |
| 975 | * |
| 976 | *---------------------------------------------------------------------- |
| 977 | */ |
| 978 | |
| 979 | static void |
| 980 | ComputeMenuButtonGeometry(mbPtr) |
| 981 | register MenuButton *mbPtr; /* Widget record for menu button. */ |
| 982 | { |
| 983 | XCharStruct bbox; |
| 984 | int dummy; |
| 985 | unsigned int width, height; |
| 986 | |
| 987 | if (mbPtr->bitmap != None) { |
| 988 | #if defined(USE_XPM3) |
| 989 | Tk_SizeOfPixmap(mbPtr->bitmap, &width, &height); |
| 990 | #else |
| 991 | Tk_SizeOfBitmap(mbPtr->bitmap, &width, &height); |
| 992 | #endif |
| 993 | if (mbPtr->width > 0) { |
| 994 | width = mbPtr->width; |
| 995 | } |
| 996 | if (mbPtr->height > 0) { |
| 997 | height = mbPtr->height; |
| 998 | } |
| 999 | } else { |
| 1000 | mbPtr->textLength = strlen(mbPtr->text); |
| 1001 | XTextExtents(mbPtr->fontPtr, mbPtr->text, mbPtr->textLength, |
| 1002 | &dummy, &dummy, &dummy, &bbox); |
| 1003 | mbPtr->leftBearing = bbox.lbearing; |
| 1004 | mbPtr->rightBearing = bbox.rbearing; |
| 1005 | width = bbox.lbearing + bbox.rbearing; |
| 1006 | height = mbPtr->fontPtr->ascent + mbPtr->fontPtr->descent; |
| 1007 | if (mbPtr->width > 0) { |
| 1008 | width = mbPtr->width * XTextWidth(mbPtr->fontPtr, "0", 1); |
| 1009 | } |
| 1010 | if (mbPtr->height > 0) { |
| 1011 | height *= mbPtr->height; |
| 1012 | } |
| 1013 | } |
| 1014 | |
| 1015 | width += 2*mbPtr->padX; |
| 1016 | height += 2*mbPtr->padY; |
no test coverage detected