head	1.11;
access;
symbols
	core-8-4-19:1.9.4.1
	core-8-4-18:1.9.4.1
	core-8-4-17:1.9.4.1
	core-8-4-16:1.9.4.1
	core-8-4-15:1.9.4.1
	core-8-4-14:1.9.4.1
	core-8-4-13:1.9.4.1
	core-8-4-12:1.9.4.1
	core-8-4-11:1.9.4.1
	core-8-4-10:1.9.4.1
	core-8-4-9-branch:1.9.4.1.0.2
	core-8-4-9:1.9.4.1
	core-8-4-8:1.9.4.1
	core-8-4-7:1.9.4.1
	core-8-5-a1:1.10
	core-8-4-6:1.9.4.1
	core-8-4-5:1.9.4.1
	mistachkin-dev-branch:1.9.0.6
	core-8-4-4:1.9
	core-8-4-3:1.9
	core-8-4-branch:1.9.0.4
	core-8-4-2:1.9
	core-8-4-1:1.9
	core-8-3-5:1.6
	core-8-4-0:1.9
	macosx-8-4-merge-2002-08-31-trunk:1.9
	macosx-8-4-premerge-2002-08-31-branch:1.9
	macosx-8-4-premerge-2002-08-31-trunk:1.9
	macosx-8-4-merge-2002-08-30-branch:1.9
	macosx-8-4-merge-2002-08-30-trunk:1.9
	macosx-8-4-merge-2002-08-20-branch:1.9
	macosx-8-4-merge-2002-08-20-trunk:1.9
	core-8-4-b2:1.9
	core-8-4-b1:1.9
	macosx-premerge-6-9-02:1.9
	core-8-4-a4:1.9
	core-8-3-4:1.6
	macosx-8-4-branch:1.9.0.2
	macosx-8-4-branchpoint:1.9
	core-8-4-a3:1.8
	core-8-3-3:1.6
	dgp-privates-into-namespace:1.7.0.2
	tclpro-1-5-0:1.6
	core-8-4-win-speedup:1.6.0.4
	core-8-4-a2:1.6
	tclpro-1-4-1:1.6
	tclpro-1-4-0:1.6
	core-8-3-2:1.6
	ajuba-ajuba2-2-1-base:1.6
	ajuba-ajuba2-2-0:1.6
	core-8-4-a1:1.6
	core-8-3-1-branch:1.6.0.2
	core-8-3-1:1.6
	scriptics-sc-2-0-b5:1.6
	scriptics-sc-2-0-fixed:1.6
	scriptics-sc-2-0-b2:1.6
	scriptics-sc-2-0-b1:1.6
	core-8-3-0:1.6
	core-8-3-b2:1.6
	core-8-3-b1:1.6
	scriptics-sc-1-1:1.5.4.1
	scriptics-sc-1-1-b1:1.5.4.1
	core-8-2-3:1.5.4.1
	scriptics-sc-1-1-branch:1.5.4.1.0.4
	scriptics-sc-1-1-base:1.5.4.1
	scriptics-sc-1-0:1.5.4.1
	scriptics-sc-1-0-branch:1.5.4.1.0.2
	scriptics-sc-1-0-base:1.5.4.1
	core-8-2-2:1.5.4.1
	core-8-2-1:1.5.4.1
	scriptics-bc-1-0-b1:1.5.4.1
	core-8-2-1-branch:1.5.0.4
	scriptics-tclpro-1-3-0:1.5
	core-8-2-0:1.5
	core-8-2-b3-branch:1.5.0.2
	core-8-2-b3-base:1.5
	scriptics-tclpro-1-3-b4:1.4
	core-8-2-b2:1.4
	scriptics-tclpro-1-3-b3:1.4
	core-8-2-b1:1.4
	scriptics-tclpro-1-3-b2:1.3
	merge-to-mainline-5/21/99:1.3
	scriptics-tclpro-1-3-b2-branch:1.3.0.2
	core-8-1-1:1.3
	scriptics-tclpro-1-3-b1:1.3
	core-8-1-1-base:1.3
	core-8-1-0:1.3
	merge-to-mainline-4-29-99:1.3
	merge-to-mainline-4-23-99:1.3
	core-8-1-branch-old:1.1.0.4
	core-8-0-6-branch:1.2.0.6
	core-8-0-6-base:1.2
	core-8-0-5:1.2
	core-8-1-b3:1.1.4.4
	core-8-1-b2:1.1.4.4
	dev-8-1-stubs-branch:1.1.4.4.0.2
	dev-stubs-branch:1.2.0.4
	scriptics-tclpro-1-2:1.2
	scriptics-tclpro-1-2-b2:1.2
	core-8-1-merge-2/10/99:1.2
	core-8-0-5-branch:1.2.0.2
	core-8-0-5-base:1.2
	scriptics-tclpro-1-2-b1:1.2
	scriptics-tclpro-1-2-a1:1.2
	core-8-1-b1:1.1.4.1
	core-8-0-4:1.2
	core-8-1-a2:1.1
	core-8-0-2:1.1
	core-8-0-3:1.2;
locks; strict;
comment	@ * @;


1.11
date	2004.03.17.18.15.46;	author das;	state dead;
branches;
next	1.10;

1.10
date	2003.11.17.23.12.44;	author hobbs;	state Exp;
branches;
next	1.9;

1.9
date	2001.10.12.13.30.31;	author tmh;	state Exp;
branches
	1.9.4.1;
next	1.8;

1.8
date	2001.05.21.14.07.33;	author tmh;	state Exp;
branches;
next	1.7;

1.7
date	2000.11.22.01.49.38;	author ericm;	state Exp;
branches
	1.7.2.1;
next	1.6;

1.6
date	99.09.21.06.42.33;	author hobbs;	state Exp;
branches
	1.6.4.1;
next	1.5;

1.5
date	99.08.10.05.05.02;	author jingham;	state Exp;
branches
	1.5.4.1;
next	1.4;

1.4
date	99.05.22.06.33.38;	author jingham;	state Exp;
branches;
next	1.3;

1.3
date	99.04.16.01.51.31;	author stanton;	state Exp;
branches;
next	1.2;

1.2
date	98.09.14.18.23.38;	author stanton;	state Exp;
branches;
next	1.1;

1.1
date	98.04.01.09.57.02;	author rjohnson;	state Exp;
branches
	1.1.4.1;
next	;

1.1.4.1
date	98.09.30.02.18.12;	author stanton;	state Exp;
branches;
next	1.1.4.2;

1.1.4.2
date	99.01.07.02.42.56;	author lfb;	state Exp;
branches;
next	1.1.4.3;

1.1.4.3
date	99.02.13.05.38.49;	author lfb;	state Exp;
branches;
next	1.1.4.4;

1.1.4.4
date	99.02.16.06.00.42;	author lfb;	state Exp;
branches;
next	;

1.5.4.1
date	99.09.22.06.53.14;	author hobbs;	state Exp;
branches;
next	;

1.6.4.1
date	2002.04.02.20.57.54;	author hobbs;	state Exp;
branches;
next	;

1.7.2.1
date	2001.07.03.20.01.09;	author dgp;	state Exp;
branches;
next	;

1.9.4.1
date	2003.11.17.23.29.36;	author hobbs;	state Exp;
branches;
next	;


desc
@@


1.11
log
@Removed support for Mac OS Classic platform [Patch 918139]
@
text
@/* 
 * tkMacMenubutton.c --
 *
 *	This file implements the Macintosh specific portion of the
 *	menubutton widget.
 *
 * Copyright (c) 1996 by Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @@(#) $Id: tkMacMenubutton.c,v 1.10 2003/11/17 23:12:44 hobbs Exp $
 */

#include "tkMenubutton.h"
#include "tkMacInt.h"
#include <Controls.h>

#define kShadowOffset	(3)	/* amount to offset shadow from frame */
#define kTriangleWidth	(11)	/* width of the triangle */
#define kTriangleHeight	(6)	/* height of the triangle */
#define kTriangleMargin	(5)	/* margin around triangle */

/*
 * Declaration of Unix specific button structure.
 */

typedef struct MacMenuButton {
    TkMenuButton info;		/* Generic button info. */
} MacMenuButton;

/*
 * The structure below defines menubutton class behavior by means of
 * procedures that can be invoked from generic window code.
 */

Tk_ClassProcs tkpMenubuttonClass = {
    sizeof(Tk_ClassProcs),	/* size */
    TkMenuButtonWorldChanged,	/* worldChangedProc */
};

/*
 *----------------------------------------------------------------------
 *
 * TkpCreateMenuButton --
 *
 *	Allocate a new TkMenuButton structure.
 *
 * Results:
 *	Returns a newly allocated TkMenuButton structure.
 *
 * Side effects:
 *	Registers an event handler for the widget.
 *
 *----------------------------------------------------------------------
 */

TkMenuButton *
TkpCreateMenuButton(
    Tk_Window tkwin)
{
    MacMenuButton *butPtr = (MacMenuButton *)ckalloc(sizeof(MacMenuButton));

    return (TkMenuButton *) butPtr;
}

/*
 *----------------------------------------------------------------------
 *
 * TkpDisplayMenuButton --
 *
 *	This procedure is invoked to display a menubutton widget.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Commands are output to X to display the menubutton in its
 *	current mode.
 *
 *----------------------------------------------------------------------
 */

void
TkpDisplayMenuButton(
    ClientData clientData)	/* Information about widget. */
{
    TkMenuButton *mbPtr = (TkMenuButton *) clientData;
    GC gc;
    Tk_3DBorder border;
    int x = 0;			/* Initialization needed only to stop
				 * compiler warning. */
    int y;
    Tk_Window tkwin = mbPtr->tkwin;
    int width, height, fullWidth, fullHeight;
    int imageWidth, imageHeight;
    int imageXOffset, imageYOffset, textXOffset, textYOffset;
    int haveImage = 0, haveText = 0;
    MacMenuButton * macMBPtr = (MacMenuButton *) mbPtr;
    GWorldPtr destPort;
    CGrafPtr saveWorld;
    GDHandle saveDevice;
    MacDrawable *macDraw;

    mbPtr->flags &= ~REDRAW_PENDING;
    if ((mbPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) {
	return;
    }

    GetGWorld(&saveWorld, &saveDevice);
    destPort = TkMacGetDrawablePort(Tk_WindowId(tkwin));
    SetGWorld(destPort, NULL);
    macDraw = (MacDrawable *) Tk_WindowId(tkwin);

    if ((mbPtr->state == STATE_DISABLED) && (mbPtr->disabledFg != NULL)) {
	gc = mbPtr->disabledGC;
    } else if ((mbPtr->state == STATE_ACTIVE)
	    && !Tk_StrictMotif(mbPtr->tkwin)) {
	gc = mbPtr->activeTextGC;
    } else {
	gc = mbPtr->normalTextGC;
    }
    border = mbPtr->normalBorder;

    if (mbPtr->image != None) {
        Tk_SizeOfImage(mbPtr->image, &width, &height);
        haveImage = 1;
    } else if (mbPtr->bitmap != None) {
        Tk_SizeOfBitmap(mbPtr->display, mbPtr->bitmap, &width, &height);
        haveImage = 1;
    }
    imageWidth  = width;
    imageHeight = height;

    haveText = (mbPtr->textWidth != 0 && mbPtr->textHeight != 0);

    /*
     * In order to avoid screen flashes, this procedure redraws
     * the menu button in a pixmap, then copies the pixmap to the
     * screen in a single operation.  This means that there's no
     * point in time where the on-sreen image has been cleared.
     */

    Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, 0, 0,
	    Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT);

    imageXOffset = 0;
    imageYOffset = 0;
    textXOffset = 0;
    textYOffset = 0;
    fullWidth = 0;
    fullHeight = 0;

    if (mbPtr->compound != COMPOUND_NONE && haveImage && haveText) {
        switch ((enum compound) mbPtr->compound) {
            case COMPOUND_TOP:
            case COMPOUND_BOTTOM: {
                /* Image is above or below text */
                if (mbPtr->compound == COMPOUND_TOP) {
                    textYOffset = height + mbPtr->padY;
                } else {
                    imageYOffset = mbPtr->textHeight + mbPtr->padY;
                }
                fullHeight = height + mbPtr->textHeight + mbPtr->padY;
                fullWidth = (width > mbPtr->textWidth ? width :
                        mbPtr->textWidth);
                textXOffset = (fullWidth - mbPtr->textWidth)/2;
                imageXOffset = (fullWidth - width)/2;
                break;
            }
            case COMPOUND_LEFT:
            case COMPOUND_RIGHT: {
                /* Image is left or right of text */
                if (mbPtr->compound == COMPOUND_LEFT) {
                    textXOffset = width + mbPtr->padX;
                } else {
                    imageXOffset = mbPtr->textWidth + mbPtr->padX;
                }
                fullWidth = mbPtr->textWidth + mbPtr->padX + width;
                fullHeight = (height > mbPtr->textHeight ? height :
                        mbPtr->textHeight);
                textYOffset = (fullHeight - mbPtr->textHeight)/2;
                imageYOffset = (fullHeight - height)/2;
                break;
            }
            case COMPOUND_CENTER: {
                /* Image and text are superimposed */
                fullWidth = (width > mbPtr->textWidth ? width :
                        mbPtr->textWidth);
                fullHeight = (height > mbPtr->textHeight ? height :
                        mbPtr->textHeight);
                textXOffset = (fullWidth - mbPtr->textWidth)/2;
                imageXOffset = (fullWidth - width)/2;
                textYOffset = (fullHeight - mbPtr->textHeight)/2;
                imageYOffset = (fullHeight - height)/2;
                break;
            }
            case COMPOUND_NONE: {break;}
        }


        TkComputeAnchor(mbPtr->anchor, tkwin, 0, 0,
                mbPtr->indicatorWidth + fullWidth, fullHeight,
                &x, &y);

	imageXOffset += x;
	imageYOffset += y;
        if (mbPtr->image != NULL) {
            Tk_RedrawImage(mbPtr->image, 0, 0, width, height, Tk_WindowId(tkwin),
                    imageXOffset, imageYOffset);
        } else if (mbPtr->bitmap != None) {
            XCopyPlane(mbPtr->display, mbPtr->bitmap, Tk_WindowId(tkwin),
                    gc, 0, 0, (unsigned) width, (unsigned) height,
                    imageXOffset, imageYOffset, 1);
        }

	Tk_DrawTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
		mbPtr->textLayout, x + textXOffset, y + textYOffset, 0, -1);
	Tk_UnderlineTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
		mbPtr->textLayout, x + textXOffset, y + textYOffset,
		mbPtr->underline);
    } else if (haveImage) {
	TkComputeAnchor(mbPtr->anchor, tkwin, 0, 0,
		width + mbPtr->indicatorWidth, height, &x, &y);
	imageXOffset += x;
	imageYOffset += y;
	if (mbPtr->image != NULL) {
	    Tk_RedrawImage(mbPtr->image, 0, 0, width, height, Tk_WindowId(tkwin),
		    imageXOffset, imageYOffset);
	} else if (mbPtr->bitmap != None) {
	    XCopyPlane(mbPtr->display, mbPtr->bitmap, Tk_WindowId(tkwin),
		    gc, 0, 0, (unsigned) width, (unsigned) height, 
		    x, y, 1);
	}
    } else {
	TkComputeAnchor(mbPtr->anchor, tkwin, mbPtr->padX, mbPtr->padY,
		mbPtr->textWidth + mbPtr->indicatorWidth,
		mbPtr->textHeight, &x, &y);
	Tk_DrawTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
		mbPtr->textLayout, x + textXOffset, y + textYOffset, 0, -1);
	Tk_UnderlineTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
		mbPtr->textLayout, x + textXOffset, y + textYOffset,
		mbPtr->underline);
    }

#if 0		/* this is the original code */
    /*
     * Display image or bitmap or text for button.
     */

    if (mbPtr->image != None) {
	Tk_SizeOfImage(mbPtr->image, &width, &height);

	imageOrBitmap:
	TkComputeAnchor(mbPtr->anchor, tkwin, 0, 0, 
		width + mbPtr->indicatorWidth, height, &x, &y);
	if (mbPtr->image != NULL) {
	    Tk_RedrawImage(mbPtr->image, 0, 0, width, height,
		    Tk_WindowId(tkwin), x, y);
	} else {
	    XCopyPlane(mbPtr->display, mbPtr->bitmap, Tk_WindowId(tkwin),
		    gc, 0, 0, (unsigned) width, (unsigned) height, x, y, 1);
	}
    } else if (mbPtr->bitmap != None) {
	Tk_SizeOfBitmap(mbPtr->display, mbPtr->bitmap, &width, &height);
	goto imageOrBitmap;
    } else {
	TkComputeAnchor(mbPtr->anchor, tkwin, mbPtr->padX, mbPtr->padY,
		mbPtr->textWidth + mbPtr->indicatorWidth, mbPtr->textHeight,
		&x, &y);
	Tk_DrawTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
		mbPtr->textLayout, x, y, 0, -1);
    }
#endif

    /*
     * If the menu button is disabled with a stipple rather than a special
     * foreground color, generate the stippled effect.
     */

    if ((mbPtr->state == STATE_DISABLED)
	    && ((mbPtr->disabledFg != NULL) || (mbPtr->image != NULL))) {
	/*
	 * Stipple the whole button if no disabledFg was specified,
	 * otherwise restrict stippling only to displayed image
	 */
	if (mbPtr->disabledFg == NULL) {
	    XFillRectangle(mbPtr->display, Tk_WindowId(tkwin),
		    mbPtr->stippleGC, mbPtr->inset, mbPtr->inset,
		    (unsigned) (Tk_Width(tkwin) - 2*mbPtr->inset),
		    (unsigned) (Tk_Height(tkwin) - 2*mbPtr->inset));
	} else {
	    XFillRectangle(mbPtr->display, Tk_WindowId(tkwin),
		    mbPtr->stippleGC, imageXOffset, imageYOffset,
		    (unsigned) imageWidth, (unsigned) imageHeight);
	}
    }

    /*
     * Draw the cascade indicator for the menu button on the
     * right side of the window, if desired.
     */

    if (mbPtr->indicatorOn) {
	int w, h, i;
	Rect r;

	r.left = macDraw->xOff + Tk_Width(tkwin) - mbPtr->inset
	    - mbPtr->indicatorWidth;
	r.top = macDraw->yOff + Tk_Height(tkwin)/2
	    - mbPtr->indicatorHeight/2;
	r.right = macDraw->xOff + Tk_Width(tkwin) - mbPtr->inset
	    - kTriangleMargin;
	r.bottom = macDraw->yOff + Tk_Height(tkwin)/2
	    + mbPtr->indicatorHeight/2;

	h = mbPtr->indicatorHeight;
	w = mbPtr->indicatorWidth - 1 - kTriangleMargin;
	for (i = 0; i < h; i++) {
	    MoveTo(r.left + i, r.top + i);
	    LineTo(r.left + i + w, r.top + i);
	    w -= 2;
	}
    }

    /*
     * Draw the border and traversal highlight last.  This way, if the
     * menu button's contents overflow onto the border they'll be covered
     * up by the border.
     */

    TkMacSetUpClippingRgn(Tk_WindowId(tkwin));
    if (mbPtr->borderWidth > 0) {
	Rect r;
	
	r.left = macDraw->xOff + mbPtr->highlightWidth + mbPtr->borderWidth;
	r.top = macDraw->yOff + mbPtr->highlightWidth + mbPtr->borderWidth;
	r.right = macDraw->xOff + Tk_Width(tkwin) - mbPtr->highlightWidth
	    - mbPtr->borderWidth;
	r.bottom = macDraw->yOff + Tk_Height(tkwin) - mbPtr->highlightWidth
	    - mbPtr->borderWidth;
	FrameRect(&r);

	PenSize(mbPtr->borderWidth - 1, mbPtr->borderWidth - 1);
	MoveTo(r.right, r.top + kShadowOffset);
	LineTo(r.right, r.bottom);
	LineTo(r.left + kShadowOffset, r.bottom);
    }
    
    if (mbPtr->highlightWidth != 0) {
	GC fgGC, bgGC;

	bgGC = Tk_GCForColor(mbPtr->highlightBgColorPtr, Tk_WindowId(tkwin));
	if (mbPtr->flags & GOT_FOCUS) {
	    fgGC = Tk_GCForColor(mbPtr->highlightColorPtr, Tk_WindowId(tkwin));
	    TkpDrawHighlightBorder(tkwin, fgGC, bgGC, mbPtr->highlightWidth,
		    Tk_WindowId(tkwin));
	} else {
	    TkpDrawHighlightBorder(tkwin, bgGC, bgGC, mbPtr->highlightWidth,
		    Tk_WindowId(tkwin));
	}
    }

    SetGWorld(saveWorld, saveDevice);
}

/*
 *----------------------------------------------------------------------
 *
 * TkpDestroyMenuButton --
 *
 *	Free data structures associated with the menubutton control.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Restores the default control state.
 *
 *----------------------------------------------------------------------
 */

void
TkpDestroyMenuButton(
    TkMenuButton *mbPtr)
{
}

/*
 *----------------------------------------------------------------------
 *
 * TkpComputeMenuButtonGeometry --
 *
 *	After changes in a menu button's text or bitmap, this procedure
 *	recomputes the menu button's geometry and passes this information
 *	along to the geometry manager for the window.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	The menu button's window may change size.
 *
 *----------------------------------------------------------------------
 */

void
TkpComputeMenuButtonGeometry(mbPtr)
    register TkMenuButton *mbPtr;		/* Widget record for menu button. */
{
    int width=0, height=0, textwidth=0, textheight=0, mm, pixels, noimage=0;

    mbPtr->inset = mbPtr->highlightWidth + mbPtr->borderWidth;
    if (mbPtr->image != None) {
	Tk_SizeOfImage(mbPtr->image, &width, &height);
	if (mbPtr->width > 0) {
	    width = mbPtr->width;
	}
	if (mbPtr->height > 0) {
	    height = mbPtr->height;
	}
    } else if (mbPtr->bitmap != None) {
	Tk_SizeOfBitmap(mbPtr->display, mbPtr->bitmap, &width, &height);
	if (mbPtr->width > 0) {
	    width = mbPtr->width;
	}
	if (mbPtr->height > 0) {
	    height = mbPtr->height;
	}
    } else {
    noimage=1;
    }
    
    if ( noimage || mbPtr->compound != COMPOUND_NONE ) {
	Tk_FreeTextLayout(mbPtr->textLayout);
	mbPtr->textLayout = Tk_ComputeTextLayout(mbPtr->tkfont, mbPtr->text,
		-1, mbPtr->wrapLength, mbPtr->justify, 0, &mbPtr->textWidth,
		&mbPtr->textHeight);
	textwidth = mbPtr->textWidth;
	textheight = mbPtr->textHeight;
	if (mbPtr->width > 0) {
	    textwidth = mbPtr->width * Tk_TextWidth(mbPtr->tkfont, "0", 1);
	}
	if (mbPtr->height > 0) {
	    Tk_FontMetrics fm;

	    Tk_GetFontMetrics(mbPtr->tkfont, &fm);
	    textheight = mbPtr->height * fm.linespace;
	}
	textwidth += 2*mbPtr->padX;
	textheight +=  2*mbPtr->padY;
    }
    
	switch ((enum compound) mbPtr->compound) {
	  case COMPOUND_TOP:
	  case COMPOUND_BOTTOM: {
	      height += textheight + mbPtr->padY;
	      width = (width > textwidth ? width : textwidth);
	      break;
	  }
	  case COMPOUND_LEFT:
	  case COMPOUND_RIGHT: {
	      height = (height > textheight ? height : textheight);
	      width += textwidth + mbPtr->padX;
	      break;
	  }
	  case COMPOUND_CENTER: {
	      height = (height > textheight ? height : textheight);
	      width = (width > textwidth ? width : textwidth);
	      break;
	  }
	  case COMPOUND_NONE: {
	     if (noimage) {
	     	height = textheight;
	     	width = textwidth;
	     }
	     break;
	}
    }

    if (mbPtr->indicatorOn) {
	mm = WidthMMOfScreen(Tk_Screen(mbPtr->tkwin));
	pixels = WidthOfScreen(Tk_Screen(mbPtr->tkwin));
	mbPtr->indicatorHeight= kTriangleHeight;
	mbPtr->indicatorWidth = kTriangleWidth + kTriangleMargin;
	width += mbPtr->indicatorWidth;
    } else {
	mbPtr->indicatorHeight = 0;
	mbPtr->indicatorWidth = 0;
    }

    Tk_GeometryRequest(mbPtr->tkwin, (int) (width + 2*mbPtr->inset),
	    (int) (height + 2*mbPtr->inset));
    Tk_SetInternalBorder(mbPtr->tkwin, mbPtr->inset);
}
@


1.10
log
@	* generic/tkMenubutton.h: fixed compound menubutton handling like
	* generic/tkMenubutton.c: *button corrections of 2003-04-25.
	* mac/tkMacMenubutton.c (TkpDisplayMenuButton):
	* unix/tkUnixMenubu.c (TkpDisplayMenuButton):
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacMenubutton.c,v 1.9 2001/10/12 13:30:31 tmh Exp $
@


1.9
log
@implementation of TIP 63 (accepted) -compound option to menu items.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacMenubutton.c,v 1.8 2001/05/21 14:07:33 tmh Exp $
d19 4
a22 4
#define kShadowOffset				(3)	/* amount to offset shadow from frame */
#define kTriangleWidth				(11)	/* width of the triangle */
#define kTriangleHeight				(6)	/* height of the triangle */
#define kTriangleMargin				(5)	/* margin around triangle */
d96 1
d132 3
d206 2
d210 2
a211 3
                    x + imageXOffset, y + imageYOffset);
        }
        if (mbPtr->bitmap != None) {
d214 1
a214 9
                    x + imageXOffset, y + imageYOffset, 1);
        }
        if (haveText) {
            Tk_DrawTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
                    mbPtr->textLayout, x  + textXOffset, y + textYOffset ,
                    0, -1);
            Tk_UnderlineTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
                    mbPtr->textLayout, x + textXOffset, y + textYOffset ,
                    mbPtr->underline);
d216 19
d236 8
a243 22
       if (mbPtr->image != NULL) {
           TkComputeAnchor(mbPtr->anchor, tkwin, 0, 0,
                   width + mbPtr->indicatorWidth, height, &x, &y);
           Tk_RedrawImage(mbPtr->image, 0, 0, width, height, Tk_WindowId(tkwin),
                   x + imageXOffset, y + imageYOffset);
       } else if (mbPtr->bitmap != None) {
           TkComputeAnchor(mbPtr->anchor, tkwin, 0, 0,
                   width + mbPtr->indicatorWidth, height, &x, &y);
           XCopyPlane(mbPtr->display, mbPtr->bitmap, Tk_WindowId(tkwin),
                   gc, 0, 0, (unsigned) width, (unsigned) height,
                   x + imageXOffset, y + imageYOffset, 1);
       } else {
           TkComputeAnchor(mbPtr->anchor, tkwin, mbPtr->padX, mbPtr->padY,
                   mbPtr->textWidth + mbPtr->indicatorWidth,
                   mbPtr->textHeight, &x, &y);
           Tk_DrawTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
                   mbPtr->textLayout, x  + textXOffset, y + textYOffset,
                   0, -1);
           Tk_UnderlineTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
                   mbPtr->textLayout, x + textXOffset, y + textYOffset ,
                   mbPtr->underline);
        }
d283 14
a296 4
	XFillRectangle(mbPtr->display, Tk_WindowId(tkwin), 
                mbPtr->disabledGC, mbPtr->inset, mbPtr->inset,
		(unsigned) (Tk_Width(tkwin) - 2*mbPtr->inset),
		(unsigned) (Tk_Height(tkwin) - 2*mbPtr->inset));
@


1.9.4.1
log
@	* generic/tkMenubutton.h: fixed compound menubutton handling like
	* generic/tkMenubutton.c: *button corrections of 2003-04-25.
	* mac/tkMacMenubutton.c (TkpDisplayMenuButton):
	* unix/tkUnixMenubu.c (TkpDisplayMenuButton):
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacMenubutton.c,v 1.10 2003/11/17 23:12:44 hobbs Exp $
d19 4
a22 4
#define kShadowOffset	(3)	/* amount to offset shadow from frame */
#define kTriangleWidth	(11)	/* width of the triangle */
#define kTriangleHeight	(6)	/* height of the triangle */
#define kTriangleMargin	(5)	/* margin around triangle */
a95 1
    int imageWidth, imageHeight;
a130 3
    imageWidth  = width;
    imageHeight = height;

a201 2
	imageXOffset += x;
	imageYOffset += y;
d204 3
a206 2
                    imageXOffset, imageYOffset);
        } else if (mbPtr->bitmap != None) {
d209 9
a217 1
                    imageXOffset, imageYOffset, 1);
a218 19

	Tk_DrawTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
		mbPtr->textLayout, x + textXOffset, y + textYOffset, 0, -1);
	Tk_UnderlineTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
		mbPtr->textLayout, x + textXOffset, y + textYOffset,
		mbPtr->underline);
    } else if (haveImage) {
	TkComputeAnchor(mbPtr->anchor, tkwin, 0, 0,
		width + mbPtr->indicatorWidth, height, &x, &y);
	imageXOffset += x;
	imageYOffset += y;
	if (mbPtr->image != NULL) {
	    Tk_RedrawImage(mbPtr->image, 0, 0, width, height, Tk_WindowId(tkwin),
		    imageXOffset, imageYOffset);
	} else if (mbPtr->bitmap != None) {
	    XCopyPlane(mbPtr->display, mbPtr->bitmap, Tk_WindowId(tkwin),
		    gc, 0, 0, (unsigned) width, (unsigned) height, 
		    x, y, 1);
	}
d220 22
a241 8
	TkComputeAnchor(mbPtr->anchor, tkwin, mbPtr->padX, mbPtr->padY,
		mbPtr->textWidth + mbPtr->indicatorWidth,
		mbPtr->textHeight, &x, &y);
	Tk_DrawTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
		mbPtr->textLayout, x + textXOffset, y + textYOffset, 0, -1);
	Tk_UnderlineTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
		mbPtr->textLayout, x + textXOffset, y + textYOffset,
		mbPtr->underline);
d281 4
a284 14
	/*
	 * Stipple the whole button if no disabledFg was specified,
	 * otherwise restrict stippling only to displayed image
	 */
	if (mbPtr->disabledFg == NULL) {
	    XFillRectangle(mbPtr->display, Tk_WindowId(tkwin),
		    mbPtr->stippleGC, mbPtr->inset, mbPtr->inset,
		    (unsigned) (Tk_Width(tkwin) - 2*mbPtr->inset),
		    (unsigned) (Tk_Height(tkwin) - 2*mbPtr->inset));
	} else {
	    XFillRectangle(mbPtr->display, Tk_WindowId(tkwin),
		    mbPtr->stippleGC, imageXOffset, imageYOffset,
		    (unsigned) imageWidth, (unsigned) imageHeight);
	}
@


1.8
log
@implement TIP11, -compound option for menubutton widget
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacMenubutton.c,v 1.7 2000/11/22 01:49:38 ericm Exp $
d399 1
a399 1
    int width, height, mm, pixels;
d419 4
d427 2
a428 2
	width = mbPtr->textWidth;
	height = mbPtr->textHeight;
d430 1
a430 1
	    width = mbPtr->width * Tk_TextWidth(mbPtr->tkfont, "0", 1);
d436 30
a465 1
	    height = mbPtr->height * fm.linespace;
a466 2
	width += 2*mbPtr->padX;
	height += 2*mbPtr->padY;
@


1.7
log
@	Overall change:  Implemented TIP 5, which exports
	TkClassProcs/TkSetClassProcs as Tk_ClassProcs/Tk_SetClassProcs,
	adding a size field to Tk_ClassProcs to allow for future
	expansion, and renaming the geometryProc to worldChangedProc,
	which is more in keeping with the actual use of the callback.

	See ChangeLog for details.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacMenubutton.c,v 1.6 1999/09/21 06:42:33 hobbs Exp $
d95 3
a97 1
    int width, height;
d124 9
d143 102
d272 1
@


1.7.2.1
log
@        * Merged in updates from HEAD branch.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacMenubutton.c,v 1.8 2001/05/21 14:07:33 tmh Exp $
d95 1
a95 3
    int width, height, fullWidth, fullHeight;
    int imageXOffset, imageYOffset, textXOffset, textYOffset;
    int haveImage = 0, haveText = 0;
a121 9
    if (mbPtr->image != None) {
        Tk_SizeOfImage(mbPtr->image, &width, &height);
        haveImage = 1;
    } else if (mbPtr->bitmap != None) {
        Tk_SizeOfBitmap(mbPtr->display, mbPtr->bitmap, &width, &height);
        haveImage = 1;
    }
    haveText = (mbPtr->textWidth != 0 && mbPtr->textHeight != 0);

a131 102
    imageXOffset = 0;
    imageYOffset = 0;
    textXOffset = 0;
    textYOffset = 0;
    fullWidth = 0;
    fullHeight = 0;

    if (mbPtr->compound != COMPOUND_NONE && haveImage && haveText) {
        switch ((enum compound) mbPtr->compound) {
            case COMPOUND_TOP:
            case COMPOUND_BOTTOM: {
                /* Image is above or below text */
                if (mbPtr->compound == COMPOUND_TOP) {
                    textYOffset = height + mbPtr->padY;
                } else {
                    imageYOffset = mbPtr->textHeight + mbPtr->padY;
                }
                fullHeight = height + mbPtr->textHeight + mbPtr->padY;
                fullWidth = (width > mbPtr->textWidth ? width :
                        mbPtr->textWidth);
                textXOffset = (fullWidth - mbPtr->textWidth)/2;
                imageXOffset = (fullWidth - width)/2;
                break;
            }
            case COMPOUND_LEFT:
            case COMPOUND_RIGHT: {
                /* Image is left or right of text */
                if (mbPtr->compound == COMPOUND_LEFT) {
                    textXOffset = width + mbPtr->padX;
                } else {
                    imageXOffset = mbPtr->textWidth + mbPtr->padX;
                }
                fullWidth = mbPtr->textWidth + mbPtr->padX + width;
                fullHeight = (height > mbPtr->textHeight ? height :
                        mbPtr->textHeight);
                textYOffset = (fullHeight - mbPtr->textHeight)/2;
                imageYOffset = (fullHeight - height)/2;
                break;
            }
            case COMPOUND_CENTER: {
                /* Image and text are superimposed */
                fullWidth = (width > mbPtr->textWidth ? width :
                        mbPtr->textWidth);
                fullHeight = (height > mbPtr->textHeight ? height :
                        mbPtr->textHeight);
                textXOffset = (fullWidth - mbPtr->textWidth)/2;
                imageXOffset = (fullWidth - width)/2;
                textYOffset = (fullHeight - mbPtr->textHeight)/2;
                imageYOffset = (fullHeight - height)/2;
                break;
            }
            case COMPOUND_NONE: {break;}
        }


        TkComputeAnchor(mbPtr->anchor, tkwin, 0, 0,
                mbPtr->indicatorWidth + fullWidth, fullHeight,
                &x, &y);

        if (mbPtr->image != NULL) {
            Tk_RedrawImage(mbPtr->image, 0, 0, width, height, Tk_WindowId(tkwin),
                    x + imageXOffset, y + imageYOffset);
        }
        if (mbPtr->bitmap != None) {
            XCopyPlane(mbPtr->display, mbPtr->bitmap, Tk_WindowId(tkwin),
                    gc, 0, 0, (unsigned) width, (unsigned) height,
                    x + imageXOffset, y + imageYOffset, 1);
        }
        if (haveText) {
            Tk_DrawTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
                    mbPtr->textLayout, x  + textXOffset, y + textYOffset ,
                    0, -1);
            Tk_UnderlineTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
                    mbPtr->textLayout, x + textXOffset, y + textYOffset ,
                    mbPtr->underline);
        }
    } else {
       if (mbPtr->image != NULL) {
           TkComputeAnchor(mbPtr->anchor, tkwin, 0, 0,
                   width + mbPtr->indicatorWidth, height, &x, &y);
           Tk_RedrawImage(mbPtr->image, 0, 0, width, height, Tk_WindowId(tkwin),
                   x + imageXOffset, y + imageYOffset);
       } else if (mbPtr->bitmap != None) {
           TkComputeAnchor(mbPtr->anchor, tkwin, 0, 0,
                   width + mbPtr->indicatorWidth, height, &x, &y);
           XCopyPlane(mbPtr->display, mbPtr->bitmap, Tk_WindowId(tkwin),
                   gc, 0, 0, (unsigned) width, (unsigned) height,
                   x + imageXOffset, y + imageYOffset, 1);
       } else {
           TkComputeAnchor(mbPtr->anchor, tkwin, mbPtr->padX, mbPtr->padY,
                   mbPtr->textWidth + mbPtr->indicatorWidth,
                   mbPtr->textHeight, &x, &y);
           Tk_DrawTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
                   mbPtr->textLayout, x  + textXOffset, y + textYOffset,
                   0, -1);
           Tk_UnderlineTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
                   mbPtr->textLayout, x + textXOffset, y + textYOffset ,
                   mbPtr->underline);
        }
    }

#if 0		/* this is the original code */
a158 1
#endif
@


1.6
log
@1999-09-16  Jeff Hobbs  <hobbs@@scriptics.com>

	* generic/tkFont.c: fixed processing of font options and error
	returned [Bug: 2075]

	* win/tkWinWm.c: fixed bug in 'wm deiconify' that raised the
	wrong toplevel, and changed it to not set focus on overridden
	toplevels

1999-09-15  Jeff Hobbs  <hobbs@@scriptics.com>

	* unix/aclocal.m4: added fix for FreeBSD-[1-2] recognition [Bug: 2070]
	and fix to AIX-* to get ldAix right [Bug: 2624], fixed AIX
	version check (readjust from 8-21 fix) and several other config
	fixes for AIX
	* mac/tkMacMenubutton.c:
	* unix/tkUnixMenubu.c: fixed permanently stippled menubutton image
	* win/tkWinButton.c: fixed possible pointer smash [Bug: 2733]

1999-09-14  Jeff Hobbs  <hobbs@@scriptics.com>

	* win/tkWinMenu.c: fix for stack overrun in GetTextFace [Bug: 909]
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacMenubutton.c,v 1.5 1999/08/10 05:05:02 jingham Exp $
d37 3
a39 4
TkClassProcs tkpMenubuttonClass = {
    NULL,			/* createProc. */
    TkMenuButtonWorldChanged,	/* geometryProc. */
    NULL			/* modalProc. */
@


1.6.4.1
log
@sync with head
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacMenubutton.c,v 1.9 2001/10/12 13:30:31 tmh Exp $
d37 4
a40 3
Tk_ClassProcs tkpMenubuttonClass = {
    sizeof(Tk_ClassProcs),	/* size */
    TkMenuButtonWorldChanged,	/* worldChangedProc */
d96 1
a96 3
    int width, height, fullWidth, fullHeight;
    int imageXOffset, imageYOffset, textXOffset, textYOffset;
    int haveImage = 0, haveText = 0;
a122 9
    if (mbPtr->image != None) {
        Tk_SizeOfImage(mbPtr->image, &width, &height);
        haveImage = 1;
    } else if (mbPtr->bitmap != None) {
        Tk_SizeOfBitmap(mbPtr->display, mbPtr->bitmap, &width, &height);
        haveImage = 1;
    }
    haveText = (mbPtr->textWidth != 0 && mbPtr->textHeight != 0);

a132 102
    imageXOffset = 0;
    imageYOffset = 0;
    textXOffset = 0;
    textYOffset = 0;
    fullWidth = 0;
    fullHeight = 0;

    if (mbPtr->compound != COMPOUND_NONE && haveImage && haveText) {
        switch ((enum compound) mbPtr->compound) {
            case COMPOUND_TOP:
            case COMPOUND_BOTTOM: {
                /* Image is above or below text */
                if (mbPtr->compound == COMPOUND_TOP) {
                    textYOffset = height + mbPtr->padY;
                } else {
                    imageYOffset = mbPtr->textHeight + mbPtr->padY;
                }
                fullHeight = height + mbPtr->textHeight + mbPtr->padY;
                fullWidth = (width > mbPtr->textWidth ? width :
                        mbPtr->textWidth);
                textXOffset = (fullWidth - mbPtr->textWidth)/2;
                imageXOffset = (fullWidth - width)/2;
                break;
            }
            case COMPOUND_LEFT:
            case COMPOUND_RIGHT: {
                /* Image is left or right of text */
                if (mbPtr->compound == COMPOUND_LEFT) {
                    textXOffset = width + mbPtr->padX;
                } else {
                    imageXOffset = mbPtr->textWidth + mbPtr->padX;
                }
                fullWidth = mbPtr->textWidth + mbPtr->padX + width;
                fullHeight = (height > mbPtr->textHeight ? height :
                        mbPtr->textHeight);
                textYOffset = (fullHeight - mbPtr->textHeight)/2;
                imageYOffset = (fullHeight - height)/2;
                break;
            }
            case COMPOUND_CENTER: {
                /* Image and text are superimposed */
                fullWidth = (width > mbPtr->textWidth ? width :
                        mbPtr->textWidth);
                fullHeight = (height > mbPtr->textHeight ? height :
                        mbPtr->textHeight);
                textXOffset = (fullWidth - mbPtr->textWidth)/2;
                imageXOffset = (fullWidth - width)/2;
                textYOffset = (fullHeight - mbPtr->textHeight)/2;
                imageYOffset = (fullHeight - height)/2;
                break;
            }
            case COMPOUND_NONE: {break;}
        }


        TkComputeAnchor(mbPtr->anchor, tkwin, 0, 0,
                mbPtr->indicatorWidth + fullWidth, fullHeight,
                &x, &y);

        if (mbPtr->image != NULL) {
            Tk_RedrawImage(mbPtr->image, 0, 0, width, height, Tk_WindowId(tkwin),
                    x + imageXOffset, y + imageYOffset);
        }
        if (mbPtr->bitmap != None) {
            XCopyPlane(mbPtr->display, mbPtr->bitmap, Tk_WindowId(tkwin),
                    gc, 0, 0, (unsigned) width, (unsigned) height,
                    x + imageXOffset, y + imageYOffset, 1);
        }
        if (haveText) {
            Tk_DrawTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
                    mbPtr->textLayout, x  + textXOffset, y + textYOffset ,
                    0, -1);
            Tk_UnderlineTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
                    mbPtr->textLayout, x + textXOffset, y + textYOffset ,
                    mbPtr->underline);
        }
    } else {
       if (mbPtr->image != NULL) {
           TkComputeAnchor(mbPtr->anchor, tkwin, 0, 0,
                   width + mbPtr->indicatorWidth, height, &x, &y);
           Tk_RedrawImage(mbPtr->image, 0, 0, width, height, Tk_WindowId(tkwin),
                   x + imageXOffset, y + imageYOffset);
       } else if (mbPtr->bitmap != None) {
           TkComputeAnchor(mbPtr->anchor, tkwin, 0, 0,
                   width + mbPtr->indicatorWidth, height, &x, &y);
           XCopyPlane(mbPtr->display, mbPtr->bitmap, Tk_WindowId(tkwin),
                   gc, 0, 0, (unsigned) width, (unsigned) height,
                   x + imageXOffset, y + imageYOffset, 1);
       } else {
           TkComputeAnchor(mbPtr->anchor, tkwin, mbPtr->padX, mbPtr->padY,
                   mbPtr->textWidth + mbPtr->indicatorWidth,
                   mbPtr->textHeight, &x, &y);
           Tk_DrawTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
                   mbPtr->textLayout, x  + textXOffset, y + textYOffset,
                   0, -1);
           Tk_UnderlineTextLayout(mbPtr->display, Tk_WindowId(tkwin), gc,
                   mbPtr->textLayout, x + textXOffset, y + textYOffset ,
                   mbPtr->underline);
        }
    }

#if 0		/* this is the original code */
a159 1
#endif
d286 1
a286 1
    int width=0, height=0, textwidth=0, textheight=0, mm, pixels, noimage=0;
a305 4
    noimage=1;
    }
    
    if ( noimage || mbPtr->compound != COMPOUND_NONE ) {
d310 2
a311 2
	textwidth = mbPtr->textWidth;
	textheight = mbPtr->textHeight;
d313 1
a313 1
	    textwidth = mbPtr->width * Tk_TextWidth(mbPtr->tkfont, "0", 1);
d319 1
a319 30
	    textheight = mbPtr->height * fm.linespace;
	}
	textwidth += 2*mbPtr->padX;
	textheight +=  2*mbPtr->padY;
    }
    
	switch ((enum compound) mbPtr->compound) {
	  case COMPOUND_TOP:
	  case COMPOUND_BOTTOM: {
	      height += textheight + mbPtr->padY;
	      width = (width > textwidth ? width : textwidth);
	      break;
	  }
	  case COMPOUND_LEFT:
	  case COMPOUND_RIGHT: {
	      height = (height > textheight ? height : textheight);
	      width += textwidth + mbPtr->padX;
	      break;
	  }
	  case COMPOUND_CENTER: {
	      height = (height > textheight ? height : textheight);
	      width = (width > textwidth ? width : textwidth);
	      break;
	  }
	  case COMPOUND_NONE: {
	     if (noimage) {
	     	height = textheight;
	     	width = textwidth;
	     }
	     break;
d321 2
@


1.5
log
@New Function: TkpDrawHighlightBorder.  Use this in place of Tk_DrawFocusHighlight.  The latter did not work on the Mac, since you need to know both foreground & background color when you draw the active focus ring.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacMenubutton.c,v 1.4 1999/05/22 06:33:38 jingham Exp $
d166 2
a167 2
    if ((mbPtr->state == STATE_DISABLED && mbPtr->disabledFg != NULL)
            || (mbPtr->image != NULL)) {
@


1.5.4.1
log
@1999-09-21  Jeff Hobbs  <hobbs@@scriptics.com>

	* generic/tkFont.c: fixed processing of font options and error
	returned [Bug: 2075]

	* win/tkWinWm.c: fixed bug in 'wm deiconify' that raised the
	wrong toplevel, and changed it to not set focus on overridden
	toplevels

	* unix/aclocal.m4: added fix for FreeBSD-[1-2] recognition [Bug: 2070]
	and fix to AIX-* to get ldAix right [Bug: 2624], fixed AIX
	version check and several other config fixes for AIX

	* mac/tkMacMenubutton.c:
	* unix/tkUnixMenubu.c: fixed permanently stippled menubutton image
	* win/tkWinButton.c: fixed possible pointer smash [Bug: 2733]

	* win/tkWinMenu.c: fix for stack overrun in GetTextFace [Bug: 909]

	* unix/tkUnixDraw.c: fixed header style for TkpDrawHighlightBorder

	* generic/tkCanvas.c: fixed GC error (bg <> fg) in tkCanvas.c
	(from code added to support TkpDrawHighlightBorder) [Bug: 2676]
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacMenubutton.c,v 1.5 1999/08/10 05:05:02 jingham Exp $
d166 2
a167 2
    if ((mbPtr->state == STATE_DISABLED)
	    && ((mbPtr->disabledFg != NULL) || (mbPtr->image != NULL))) {
@


1.4
log
@Changes needed to get Tk8.1 to compile with stubs on the Mac
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacMenubutton.c,v 1.3 1999/04/16 01:51:31 stanton Exp $
d226 1
a226 1
	GC gc;
d228 1
d230 3
a232 1
	    gc = Tk_GCForColor(mbPtr->highlightColorPtr, Tk_WindowId(tkwin));
d234 2
a235 1
	    gc = Tk_GCForColor(mbPtr->highlightBgColorPtr, Tk_WindowId(tkwin));
a236 2
	Tk_DrawFocusHighlight(tkwin, gc, mbPtr->highlightWidth,
		Tk_WindowId(tkwin));
@


1.3
log
@* Merged 8.1 branch into the main trunk
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id$
d166 2
a167 2
    if (mbPtr->state == STATE_DISABLED && mbPtr->disabledFg != NULL) {
            || (mbPtr->image != NULL))) {
@


1.2
log
@Replaced SCCS strings, fixed binary files
@
text
@d113 1
a113 1
    if ((mbPtr->state == tkDisabledUid) && (mbPtr->disabledFg != NULL)) {
d115 2
a116 1
    } else if ((mbPtr->state == tkActiveUid) && !Tk_StrictMotif(mbPtr->tkwin)) {
d166 4
a169 4
    if ((mbPtr->state == tkDisabledUid)
	    && ((mbPtr->disabledFg == NULL) || (mbPtr->image != NULL))) {
	XFillRectangle(mbPtr->display, Tk_WindowId(tkwin), mbPtr->disabledGC,
		mbPtr->inset, mbPtr->inset,
a223 3
    
	if (mbPtr->state == tkDisabledUid) {
	}
@


1.1
log
@Initial revision
@
text
@d12 1
a12 1
 * SCCS: @@(#) tkMacMenubutton.c 1.4 97/01/03 13:55:19
@


1.1.4.1
log
@Merged 8.0.3 changes into 8.1
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacMenubutton.c,v 1.2 1998/09/14 18:23:38 stanton Exp $
@


1.1.4.2
log
@Removed perky gloabal Tk_Uids causing concurrency problems.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacMenubutton.c,v 1.1.4.1 1998/09/30 02:18:12 stanton Exp $
d113 1
a113 1
    if ((mbPtr->state == TK_STATE_DISABLED) && (mbPtr->disabledFg != NULL)) {
d115 1
a115 1
    } else if ((mbPtr->state == TK_STATE_ACTIVE) && !Tk_StrictMotif(mbPtr->tkwin)) {
d165 1
a165 1
    if ((mbPtr->state == TK_STATE_DISABLED)
d224 1
a224 1
	if (mbPtr->state == TK_STATE_DISABLED) {
@


1.1.4.3
log
@Removed Tk_Uids from Menubutton widget.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacMenubutton.c,v 1.1.4.2 1999/01/07 02:42:56 lfb Exp $
d113 1
a113 2
    if ((mbPtr->state[0] == 'd') && (strcmp(mbPtr->state, "disabled"))
	    && (mbPtr->disabledFg != NULL)) {
d115 1
a115 2
    } else if ((mbPtr->state[0] == 'a') && (strcmp(mbPtr->state, "active"))
	    && !Tk_StrictMotif(mbPtr->tkwin)) {
d165 1
a165 1
    if ((mbPtr->state[0] == 'd') && (strcmp(mbPtr->state, "disabled"))
d223 3
@


1.1.4.4
log
@Change Menubutton to use TK_OPTION interface to eliminate static data.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkMacMenubutton.c,v 1.1.4.3 1999/02/13 05:38:49 lfb Exp $
d113 2
a114 1
    if ((mbPtr->state == STATE_DISABLED) && (mbPtr->disabledFg != NULL)) {
d116 1
a116 1
    } else if ((mbPtr->state == STATE_ACTIVE)
d167 4
a170 4
    if (mbPtr->state == STATE_DISABLED && mbPtr->disabledFg != NULL) {
            || (mbPtr->image != NULL))) {
	XFillRectangle(mbPtr->display, Tk_WindowId(tkwin), 
                mbPtr->disabledGC, mbPtr->inset, mbPtr->inset,
@


