Lines Matching defs:mePtr
425 Menu *menuPtr, MenuEntry *mePtr, int index,
431 MenuEntry *mePtr));
456 Menu *menuPtr, MenuEntry *mePtr));
588 register MenuEntry *mePtr;
718 mePtr = menuPtr->entries[index];
719 Tcl_Preserve((ClientData) mePtr);
721 (char *) mePtr, argv[3], COMMAND_MASK << mePtr->type);
722 Tcl_Release((ClientData) mePtr);
739 mePtr = menuPtr->entries[index];
740 Tcl_Preserve((ClientData) mePtr);
743 (char *) mePtr, (char *) NULL,
744 COMMAND_MASK << mePtr->type);
747 (char *) mePtr, argv[3], COMMAND_MASK << mePtr->type);
749 result = ConfigureMenuEntry(interp, menuPtr, mePtr, index, argc-3,
750 argv+3, TK_CONFIG_ARGV_ONLY | COMMAND_MASK << mePtr->type);
752 Tcl_Release((ClientData) mePtr);
796 mePtr = menuPtr->entries[index];
797 if (mePtr->state == tkDisabledUid) {
800 Tcl_Preserve((ClientData) mePtr);
801 if (mePtr->type == CHECK_BUTTON_ENTRY) {
802 if (mePtr->flags & ENTRY_SELECTED) {
803 if (Tcl_SetVar(interp, mePtr->name, mePtr->offValue,
808 if (Tcl_SetVar(interp, mePtr->name, mePtr->onValue,
813 } else if (mePtr->type == RADIO_BUTTON_ENTRY) {
814 if (Tcl_SetVar(interp, mePtr->name, mePtr->onValue,
819 if ((result == TCL_OK) && (mePtr->command != NULL)) {
820 result = TkCopyAndGlobalEval(interp, mePtr->command);
822 if ((result == TCL_OK) && (mePtr->type == CASCADE_ENTRY)) {
823 result = PostSubmenu(menuPtr->interp, menuPtr, mePtr);
825 Tcl_Release((ClientData) mePtr);
940 mePtr = menuPtr->entries[index];
941 switch (mePtr->type) {
1084 register MenuEntry *mePtr = (MenuEntry *) memPtr;
1085 Menu *menuPtr = mePtr->menuPtr;
1093 if (menuPtr->postedCascade == mePtr) {
1102 if (mePtr->image != NULL) {
1103 Tk_FreeImage(mePtr->image);
1105 if (mePtr->selectImage != NULL) {
1106 Tk_FreeImage(mePtr->image);
1108 if (mePtr->textGC != None) {
1109 Tk_FreeGC(menuPtr->display, mePtr->textGC);
1111 if (mePtr->activeGC != None) {
1112 Tk_FreeGC(menuPtr->display, mePtr->activeGC);
1114 if (mePtr->disabledGC != None) {
1115 Tk_FreeGC(menuPtr->display, mePtr->disabledGC);
1117 if (mePtr->indicatorGC != None) {
1118 Tk_FreeGC(menuPtr->display, mePtr->indicatorGC);
1120 if (mePtr->name != NULL) {
1121 Tcl_UntraceVar(menuPtr->interp, mePtr->name,
1123 MenuVarProc, (ClientData) mePtr);
1125 Tk_FreeOptions(entryConfigSpecs, (char *) mePtr, menuPtr->display,
1126 (COMMAND_MASK << mePtr->type));
1127 ckfree((char *) mePtr);
1254 MenuEntry *mePtr;
1256 mePtr = menuPtr->entries[i];
1257 ConfigureMenuEntry(interp, menuPtr, mePtr, i, 0, (char **) NULL,
1258 TK_CONFIG_ARGV_ONLY | COMMAND_MASK << mePtr->type);
1305 * set for mePtr; old resources get freed, if there were any.
1311 ConfigureMenuEntry(interp, menuPtr, mePtr, index, argc, argv, flags)
1314 register MenuEntry *mePtr; /* Information about menu entry; may
1317 int index; /* Index of mePtr within menuPtr's
1336 if (menuPtr->postedCascade == mePtr) {
1348 if ((mePtr->name != NULL) &&
1349 ((mePtr->type == CHECK_BUTTON_ENTRY)
1350 || (mePtr->type == RADIO_BUTTON_ENTRY))) {
1351 Tcl_UntraceVar(menuPtr->interp, mePtr->name,
1353 MenuVarProc, (ClientData) mePtr);
1357 argc, argv, (char *) mePtr,
1358 flags | (COMMAND_MASK << mePtr->type)) != TCL_OK) {
1368 if (mePtr->label == NULL) {
1369 mePtr->labelLength = 0;
1371 mePtr->labelLength = strlen(mePtr->label);
1373 if (mePtr->accel == NULL) {
1374 mePtr->accelLength = 0;
1376 mePtr->accelLength = strlen(mePtr->accel);
1379 if (mePtr->state == tkActiveUid) {
1387 if ((mePtr->state != tkNormalUid) && (mePtr->state != tkDisabledUid)) {
1388 Tcl_AppendResult(interp, "bad state value \"", mePtr->state,
1390 mePtr->state = tkNormalUid;
1395 if ((mePtr->fontPtr != NULL) || (mePtr->border != NULL)
1396 || (mePtr->fg != NULL) || (mePtr->activeBorder != NULL)
1397 || (mePtr->activeFg != NULL)) {
1398 gcValues.foreground = (mePtr->fg != NULL) ? mePtr->fg->pixel
1401 (mePtr->border != NULL) ? mePtr->border : menuPtr->border)
1403 gcValues.font = (mePtr->fontPtr != NULL) ? mePtr->fontPtr->fid
1428 gcValues.foreground = (mePtr->activeFg != NULL)
1429 ? mePtr->activeFg->pixel : menuPtr->activeFg->pixel;
1431 (mePtr->activeBorder != NULL) ? mePtr->activeBorder
1441 if (mePtr->textGC != None) {
1442 Tk_FreeGC(menuPtr->display, mePtr->textGC);
1444 mePtr->textGC = newGC;
1445 if (mePtr->activeGC != None) {
1446 Tk_FreeGC(menuPtr->display, mePtr->activeGC);
1448 mePtr->activeGC = newActiveGC;
1449 if (mePtr->disabledGC != None) {
1450 Tk_FreeGC(menuPtr->display, mePtr->disabledGC);
1452 mePtr->disabledGC = newDisabledGC;
1453 if (mePtr->indicatorFg != NULL) {
1454 gcValues.foreground = mePtr->indicatorFg->pixel;
1459 if (mePtr->indicatorGC != None) {
1460 Tk_FreeGC(menuPtr->display, mePtr->indicatorGC);
1462 mePtr->indicatorGC = newGC;
1464 if ((mePtr->type == CHECK_BUTTON_ENTRY)
1465 || (mePtr->type == RADIO_BUTTON_ENTRY)) {
1468 if (mePtr->name == NULL) {
1469 mePtr->name = (char *) ckalloc((unsigned) (mePtr->labelLength + 1));
1470 strcpy(mePtr->name, (mePtr->label == NULL) ? "" : mePtr->label);
1472 if (mePtr->onValue == NULL) {
1473 mePtr->onValue = (char *) ckalloc((unsigned)
1474 (mePtr->labelLength + 1));
1475 strcpy(mePtr->onValue, (mePtr->label == NULL) ? "" : mePtr->label);
1485 value = Tcl_GetVar(interp, mePtr->name, TCL_GLOBAL_ONLY);
1486 mePtr->flags &= ~ENTRY_SELECTED;
1488 if (strcmp(value, mePtr->onValue) == 0) {
1489 mePtr->flags |= ENTRY_SELECTED;
1492 Tcl_SetVar(interp, mePtr->name,
1493 (mePtr->type == CHECK_BUTTON_ENTRY) ? mePtr->offValue : "",
1496 Tcl_TraceVar(interp, mePtr->name,
1498 MenuVarProc, (ClientData) mePtr);
1507 if (mePtr->imageString != NULL) {
1508 image = Tk_GetImage(interp, menuPtr->tkwin, mePtr->imageString,
1509 MenuImageProc, (ClientData) mePtr);
1516 if (mePtr->image != NULL) {
1517 Tk_FreeImage(mePtr->image);
1519 mePtr->image = image;
1520 if (mePtr->selectImageString != NULL) {
1521 image = Tk_GetImage(interp, menuPtr->tkwin, mePtr->selectImageString,
1522 MenuSelectImageProc, (ClientData) mePtr);
1529 if (mePtr->selectImage != NULL) {
1530 Tk_FreeImage(mePtr->selectImage);
1532 mePtr->selectImage = image;
1568 register MenuEntry *mePtr;
1583 mePtr = menuPtr->entries[i];
1585 fontPtr = mePtr->fontPtr;
1600 if (mePtr->image != NULL) {
1601 Tk_SizeOfImage(mePtr->image, &imageWidth, &imageHeight);
1604 mePtr->height = imageHeight;
1606 if (mePtr->indicatorOn) {
1607 if (mePtr->type == CHECK_BUTTON_ENTRY) {
1608 indicatorSpace = (14*mePtr->height)/10;
1609 mePtr->indicatorDiameter = (65*mePtr->height)/100;
1610 } else if (mePtr->type == RADIO_BUTTON_ENTRY) {
1611 indicatorSpace = (14*mePtr->height)/10;
1612 mePtr->indicatorDiameter = (75*mePtr->height)/100;
1615 } else if (mePtr->bitmap != None) {
1616 Tk_SizeOfBitmap(menuPtr->display, mePtr->bitmap,
1620 mePtr->height = fontPtr->ascent + fontPtr->descent;
1621 if (mePtr->label != NULL) {
1622 (void) TkMeasureChars(fontPtr, mePtr->label,
1623 mePtr->labelLength, 0, (int) 100000, 0,
1628 if (mePtr->indicatorOn) {
1629 if (mePtr->type == CHECK_BUTTON_ENTRY) {
1630 indicatorSpace = mePtr->height;
1631 mePtr->indicatorDiameter = (80*mePtr->height)/100;
1632 } else if (mePtr->type == RADIO_BUTTON_ENTRY) {
1633 indicatorSpace = mePtr->height;
1634 mePtr->indicatorDiameter = mePtr->height;
1638 mePtr->height += 2*menuPtr->activeBorderWidth + 2;
1642 if (mePtr->type == CASCADE_ENTRY) {
1644 } else if (mePtr->accel != NULL) {
1645 (void) TkMeasureChars(fontPtr, mePtr->accel, mePtr->accelLength,
1653 if (mePtr->type == SEPARATOR_ENTRY) {
1654 mePtr->height = 8;
1656 if (mePtr->type == TEAROFF_ENTRY) {
1657 mePtr->height = 12;
1662 mePtr->y = y;
1663 y += mePtr->height;
1737 register MenuEntry *mePtr;
1758 mePtr = menuPtr->entries[index];
1759 if (!(mePtr->flags & ENTRY_NEEDS_REDISPLAY)) {
1762 mePtr->flags &= ~ENTRY_NEEDS_REDISPLAY;
1768 bgBorder = mePtr->border;
1775 activeBorder = mePtr->activeBorder;
1780 if (mePtr->state == tkActiveUid) {
1783 bgBorder, menuPtr->borderWidth, mePtr->y,
1784 Tk_Width(tkwin) - 2*menuPtr->borderWidth, mePtr->height,
1788 bgBorder, menuPtr->borderWidth, mePtr->y,
1789 Tk_Width(tkwin) - 2*menuPtr->borderWidth, mePtr->height,
1797 if ((mePtr->state == tkActiveUid) && !strictMotif) {
1798 gc = mePtr->activeGC;
1803 if ((mePtr->state == tkDisabledUid)
1805 gc = mePtr->disabledGC;
1810 gc = mePtr->textGC;
1821 fontPtr = mePtr->fontPtr;
1825 baseline = mePtr->y + (mePtr->height + fontPtr->ascent
1827 if (mePtr->image != NULL) {
1830 Tk_SizeOfImage(mePtr->image, &width, &height);
1831 if ((mePtr->selectImage != NULL)
1832 && (mePtr->flags & ENTRY_SELECTED)) {
1833 Tk_RedrawImage(mePtr->selectImage, 0, 0, width, height,
1835 (int) (mePtr->y + (mePtr->height - height)/2));
1837 Tk_RedrawImage(mePtr->image, 0, 0, width, height,
1839 (int) (mePtr->y + (mePtr->height - height)/2));
1841 } else if (mePtr->bitmap != None) {
1844 Tk_SizeOfBitmap(menuPtr->display, mePtr->bitmap, &width, &height);
1845 XCopyPlane(menuPtr->display, mePtr->bitmap, Tk_WindowId(tkwin),
1847 (int) (mePtr->y + (mePtr->height - height)/2), 1);
1849 baseline = mePtr->y + (mePtr->height + fontPtr->ascent
1851 if (mePtr->label != NULL) {
1853 fontPtr, mePtr->label, mePtr->labelLength,
1856 if (mePtr->underline >= 0) {
1858 fontPtr, mePtr->label, leftEdge, baseline,
1860 mePtr->underline, mePtr->underline);
1869 if (mePtr->type == CASCADE_ENTRY) {
1873 points[0].y = mePtr->y + (mePtr->height - CASCADE_ARROW_HEIGHT)/2;
1880 (menuPtr->postedCascade == mePtr) ? TK_RELIEF_SUNKEN
1882 } else if (mePtr->accel != NULL) {
1884 fontPtr, mePtr->accel, mePtr->accelLength,
1893 gc = mePtr->indicatorGC;
1897 if ((mePtr->type == CHECK_BUTTON_ENTRY) && mePtr->indicatorOn) {
1900 dim = mePtr->indicatorDiameter;
1903 y = mePtr->y + (mePtr->height - dim)/2;
1910 if ((dim > 0) && (mePtr->flags & ENTRY_SELECTED)) {
1920 if ((mePtr->type == RADIO_BUTTON_ENTRY) && mePtr->indicatorOn) {
1924 radius = mePtr->indicatorDiameter/2;
1926 + (menuPtr->indicatorSpace - mePtr->indicatorDiameter)/2;
1927 points[0].y = mePtr->y + (mePtr->height)/2;
1934 if (mePtr->flags & ENTRY_SELECTED) {
1951 if (mePtr->type == SEPARATOR_ENTRY) {
1955 points[0].y = mePtr->y + mePtr->height/2;
1966 if (mePtr->type == TEAROFF_ENTRY) {
1971 points[0].y = mePtr->y + mePtr->height/2;
1992 if ((mePtr->state == tkDisabledUid) && (menuPtr->disabledFg == NULL)) {
1995 mePtr->y,
1997 (unsigned) mePtr->height);
2007 mePtr = menuPtr->entries[menuPtr->numEntries-1];
2008 y = mePtr->y + mePtr->height;
2078 MenuEntry *mePtr = menuPtr->entries[i];
2080 if (y < (mePtr->y + mePtr->height)) {
2237 MenuEntry *mePtr;
2259 menuPtr->entries[index] = mePtr = (MenuEntry *) ckalloc(sizeof(MenuEntry));
2260 mePtr->type = type;
2261 mePtr->menuPtr = menuPtr;
2262 mePtr->label = NULL;
2263 mePtr->labelLength = 0;
2264 mePtr->underline = -1;
2265 mePtr->bitmap = None;
2266 mePtr->imageString = NULL;
2267 mePtr->image = NULL;
2268 mePtr->selectImageString = NULL;
2269 mePtr->selectImage = NULL;
2270 mePtr->accel = NULL;
2271 mePtr->accelLength = 0;
2272 mePtr->state = tkNormalUid;
2273 mePtr->height = 0;
2274 mePtr->y = 0;
2275 mePtr->indicatorDiameter = 0;
2276 mePtr->border = NULL;
2277 mePtr->fg = NULL;
2278 mePtr->activeBorder = NULL;
2279 mePtr->activeFg = NULL;
2280 mePtr->fontPtr = NULL;
2281 mePtr->textGC = None;
2282 mePtr->activeGC = None;
2283 mePtr->disabledGC = None;
2284 mePtr->indicatorOn = 1;
2285 mePtr->indicatorFg = NULL;
2286 mePtr->indicatorGC = None;
2287 mePtr->command = NULL;
2288 mePtr->name = NULL;
2289 mePtr->onValue = NULL;
2290 mePtr->offValue = NULL;
2291 mePtr->flags = 0;
2292 return mePtr;
2328 MenuEntry *mePtr;
2373 mePtr = MenuNewEntry(menuPtr, index, type);
2374 if (ConfigureMenuEntry(interp, menuPtr, mePtr, index,
2376 DestroyMenuEntry((ClientData) mePtr);
2415 MenuEntry *mePtr = (MenuEntry *) clientData;
2419 menuPtr = mePtr->menuPtr;
2427 mePtr->flags &= ~ENTRY_SELECTED;
2429 Tcl_TraceVar(interp, mePtr->name,
2442 value = Tcl_GetVar(interp, mePtr->name, TCL_GLOBAL_ONLY);
2446 if (strcmp(value, mePtr->onValue) == 0) {
2447 if (mePtr->flags & ENTRY_SELECTED) {
2450 mePtr->flags |= ENTRY_SELECTED;
2451 } else if (mePtr->flags & ENTRY_SELECTED) {
2452 mePtr->flags &= ~ENTRY_SELECTED;
2480 EventuallyRedrawMenu(menuPtr, mePtr)
2482 register MenuEntry *mePtr; /* Entry to redraw. NULL means redraw
2489 if (mePtr != NULL) {
2490 mePtr->flags |= ENTRY_NEEDS_REDISPLAY;
2526 PostSubmenu(interp, menuPtr, mePtr)
2530 register MenuEntry *mePtr; /* Info about submenu that is to be
2538 if (mePtr == menuPtr->postedCascade) {
2569 if ((mePtr != NULL) && (mePtr->name != NULL)
2576 tkwin = Tk_NameToWindow(interp, mePtr->name, menuPtr->tkwin);
2595 y += mePtr->y + menuPtr->activeBorderWidth + 2;
2597 result = Tcl_VarEval(interp, mePtr->name, " post ", string,
2602 menuPtr->postedCascade = mePtr;
2634 register MenuEntry *mePtr;
2638 mePtr = menuPtr->entries[menuPtr->active];
2645 if (mePtr->state == tkActiveUid) {
2646 mePtr->state = tkNormalUid;
2652 mePtr = menuPtr->entries[index];
2653 mePtr->state = tkActiveUid;
2654 EventuallyRedrawMenu(menuPtr, mePtr);
2723 register MenuEntry *mePtr = (MenuEntry *) clientData;
2725 if ((mePtr->flags & ENTRY_SELECTED)
2726 && !(mePtr->menuPtr->flags & REDRAW_PENDING)) {
2727 mePtr->menuPtr->flags |= REDRAW_PENDING;
2728 Tcl_DoWhenIdle(DisplayMenu, (ClientData) mePtr->menuPtr);