summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXMenubutton.c
diff options
context:
space:
mode:
authoroehhar <harald.oehlmann@elmicron.de>2020-05-24 15:44:22 (GMT)
committeroehhar <harald.oehlmann@elmicron.de>2020-05-24 15:44:22 (GMT)
commite9d72bbaa4a4cef256b3d3480ed1136b8651d019 (patch)
tree5b555bb43f3c32b4ff86fe07b3b06f5000ade4d9 /macosx/tkMacOSXMenubutton.c
parenta48a5b55179978d3f31371c90d9be6eaa6931f17 (diff)
parentad1ded4a7f409e06bd6e1b33da463e6c7cd844af (diff)
downloadtk-e9d72bbaa4a4cef256b3d3480ed1136b8651d019.zip
tk-e9d72bbaa4a4cef256b3d3480ed1136b8651d019.tar.gz
tk-e9d72bbaa4a4cef256b3d3480ed1136b8651d019.tar.bz2
Merge trunk
Diffstat (limited to 'macosx/tkMacOSXMenubutton.c')
-rw-r--r--macosx/tkMacOSXMenubutton.c452
1 files changed, 224 insertions, 228 deletions
diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c
index b2b4b76..1e88f3a 100644
--- a/macosx/tkMacOSXMenubutton.c
+++ b/macosx/tkMacOSXMenubutton.c
@@ -1,8 +1,8 @@
/*
* tkMacOSXMenubutton.c --
*
- * This file implements the Macintosh specific portion of the
- * menubutton widget.
+ * This file implements the Macintosh specific portion of the menubutton
+ * widget.
*
* Copyright (c) 1996 by Sun Microsystems, Inc.
* Copyright 2001, Apple Computer, Inc.
@@ -32,7 +32,6 @@ typedef struct {
int hasImageOrBitmap;
} DrawParams;
-
/*
* Declaration of Mac specific button structure.
*/
@@ -50,21 +49,24 @@ typedef struct MacMenuButton {
* Forward declarations for static functions defined later in this file:
*/
-static void MenuButtonEventProc(ClientData clientData, XEvent *eventPtr);
-static void MenuButtonBackgroundDrawCB (MacMenuButton *ptr, SInt16 depth,
- Boolean isColorDev);
-static void MenuButtonContentDrawCB (ThemeButtonKind kind,
- const HIThemeButtonDrawInfo * info,
- MacMenuButton *ptr, SInt16 depth,
- Boolean isColorDev);
-static void MenuButtonEventProc ( ClientData clientData, XEvent *eventPtr);
-static void TkMacOSXComputeMenuButtonParams (TkMenuButton * butPtr,
- ThemeButtonKind* btnkind,
- HIThemeButtonDrawInfo* drawinfo);
-static void TkMacOSXComputeMenuButtonDrawParams (TkMenuButton * butPtr,
- DrawParams * dpPtr);
-static void TkMacOSXDrawMenuButton (MacMenuButton *butPtr, GC gc, Pixmap pixmap);
-static void DrawMenuButtonImageAndText(TkMenuButton* butPtr);
+static void MenuButtonEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static void MenuButtonBackgroundDrawCB(MacMenuButton *ptr,
+ SInt16 depth, Boolean isColorDev);
+static void MenuButtonContentDrawCB(ThemeButtonKind kind,
+ const HIThemeButtonDrawInfo *info,
+ MacMenuButton *ptr, SInt16 depth,
+ Boolean isColorDev);
+static void MenuButtonEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static void TkMacOSXComputeMenuButtonParams(TkMenuButton *butPtr,
+ ThemeButtonKind *btnkind,
+ HIThemeButtonDrawInfo *drawinfo);
+static void TkMacOSXComputeMenuButtonDrawParams(
+ TkMenuButton *butPtr, DrawParams *dpPtr);
+static void TkMacOSXDrawMenuButton(MacMenuButton *butPtr, GC gc,
+ Pixmap pixmap);
+static void DrawMenuButtonImageAndText(TkMenuButton *butPtr);
/*
* The structure below defines menubutton class behavior by means of
@@ -74,6 +76,8 @@ static void DrawMenuButtonImageAndText(TkMenuButton* butPtr);
Tk_ClassProcs tkpMenubuttonClass = {
sizeof(Tk_ClassProcs), /* size */
TkMenuButtonWorldChanged, /* worldChangedProc */
+ NULL,
+ NULL
};
/*
@@ -131,10 +135,9 @@ TkMenuButton *
TkpCreateMenuButton(
Tk_Window tkwin)
{
- MacMenuButton *mbPtr = (MacMenuButton *) ckalloc(sizeof(MacMenuButton));
+ MacMenuButton *mbPtr = (MacMenuButton *)ckalloc(sizeof(MacMenuButton));
- Tk_CreateEventHandler(tkwin, ActivateMask, MenuButtonEventProc,
- (ClientData) mbPtr);
+ Tk_CreateEventHandler(tkwin, ActivateMask, MenuButtonEventProc, mbPtr);
mbPtr->flags = FIRST_DRAW;
mbPtr->btnkind = kThemePopupButton;
bzero(&mbPtr->drawinfo, sizeof(mbPtr->drawinfo));
@@ -153,8 +156,7 @@ TkpCreateMenuButton(
* None.
*
* Side effects:
- * Commands are output to X to display the menubutton in its
- * current mode.
+ * Commands are output to X to display the menubutton in its current mode.
*
*----------------------------------------------------------------------
*/
@@ -163,11 +165,11 @@ void
TkpDisplayMenuButton(
ClientData clientData) /* Information about widget. */
{
- MacMenuButton *mbPtr = (MacMenuButton *)clientData;
- TkMenuButton *butPtr = (TkMenuButton *) clientData;
- Tk_Window tkwin = butPtr->tkwin;
+ MacMenuButton *mbPtr = clientData;
+ TkMenuButton *butPtr = clientData;
+ Tk_Window tkwin = butPtr->tkwin;
Pixmap pixmap;
- DrawParams* dpPtr = &mbPtr->drawParams;
+ DrawParams *dpPtr = &mbPtr->drawParams;
butPtr->flags &= ~REDRAW_PENDING;
if ((butPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) {
@@ -179,22 +181,27 @@ TkpDisplayMenuButton(
TkMacOSXComputeMenuButtonDrawParams(butPtr, dpPtr);
/*
- * set up clipping region. Make sure the we are using the port
- * for this button, or we will set the wrong window's clip.
+ * Set up clipping region. Make sure the we are using the port for this
+ * button, or we will set the wrong window's clip.
*/
TkMacOSXSetUpClippingRgn(pixmap);
- /* Draw the native portion of the buttons. */
+ /*
+ * Draw the native portion of the buttons.
+ */
+
TkMacOSXDrawMenuButton(mbPtr, dpPtr->gc, pixmap);
- /* Draw highlight border, if needed. */
+ /*
+ * Draw highlight border, if needed.
+ */
+
if (butPtr->highlightWidth < 3) {
- if ((butPtr->flags & GOT_FOCUS)) {
- Tk_Draw3DRectangle(tkwin, pixmap, butPtr->normalBorder, 0, 0,
- Tk_Width(tkwin), Tk_Height(tkwin),
- butPtr->highlightWidth, TK_RELIEF_SOLID);
- }
+ if (butPtr->flags & GOT_FOCUS) {
+ GC gc = Tk_GCForColor(butPtr->highlightColorPtr, pixmap);
+ TkMacOSXDrawSolidBorder(tkwin, gc, 0, butPtr->highlightWidth);
+ }
}
}
@@ -203,8 +210,8 @@ TkpDisplayMenuButton(
*
* TkpDestroyMenuButton --
*
- * Free data structures associated with the menubutton control.
- * This is a no-op on the Mac.
+ * Free data structures associated with the menubutton control. This is a
+ * no-op on the Mac.
*
* Results:
* None.
@@ -217,7 +224,7 @@ TkpDisplayMenuButton(
void
TkpDestroyMenuButton(
- TkMenuButton *mbPtr)
+ TCL_UNUSED(TkMenuButton *))
{
}
@@ -241,7 +248,7 @@ TkpDestroyMenuButton(
void
TkpComputeMenuButtonGeometry(butPtr)
- register TkMenuButton *butPtr; /* Widget record for menu button. */
+ TkMenuButton *butPtr; /* Widget record for menu button. */
{
int width, height, avgWidth, haveImage = 0, haveText = 0;
int txtWidth, txtHeight;
@@ -279,44 +286,42 @@ TkpComputeMenuButtonGeometry(butPtr)
}
/*
- * If the button is compound (ie, it shows both an image and text),
- * the new geometry is a combination of the image and text geometry.
- * We only honor the compound bit if the button has both text and an
- * image, because otherwise it is not really a compound button.
+ * If the button is compound (ie, it shows both an image and text), the new
+ * geometry is a combination of the image and text geometry. We only honor
+ * the compound bit if the button has both text and an image, because
+ * otherwise it is not really a compound button.
*/
if (haveImage && haveText) {
switch ((enum compound) butPtr->compound) {
- case COMPOUND_TOP:
- case COMPOUND_BOTTOM: {
- /*
- * Image is above or below text
- */
-
- height += txtHeight + butPtr->padY;
- width = (width > txtWidth ? width : txtWidth);
- break;
- }
- case COMPOUND_LEFT:
- case COMPOUND_RIGHT: {
- /*
- * Image is left or right of text
- */
-
- width += txtWidth + butPtr->padX;
- height = (height > txtHeight ? height : txtHeight);
- break;
- }
- case COMPOUND_CENTER: {
- /*
- * Image and text are superimposed
- */
-
- width = (width > txtWidth ? width : txtWidth);
- height = (height > txtHeight ? height : txtHeight);
- break;
- }
- case COMPOUND_NONE: {break;}
+ case COMPOUND_TOP:
+ case COMPOUND_BOTTOM:
+ /*
+ * Image is above or below text
+ */
+
+ height += txtHeight + butPtr->padY;
+ width = (width > txtWidth ? width : txtWidth);
+ break;
+ case COMPOUND_LEFT:
+ case COMPOUND_RIGHT:
+ /*
+ * Image is left or right of text
+ */
+
+ width += txtWidth + butPtr->padX;
+ height = (height > txtHeight ? height : txtHeight);
+ break;
+ case COMPOUND_CENTER:
+ /*
+ * Image and text are superimposed
+ */
+
+ width = (width > txtWidth ? width : txtWidth);
+ height = (height > txtHeight ? height : txtHeight);
+ break;
+ case COMPOUND_NONE:
+ break;
}
if (butPtr->width > 0) {
@@ -345,7 +350,7 @@ TkpComputeMenuButtonGeometry(butPtr)
}
}
}
-
+
butPtr->inset = highlightWidth + butPtr->borderWidth;
width += LEFT_INSET + RIGHT_INSET + 2*butPtr->inset;
height += 2*butPtr->inset;
@@ -371,34 +376,26 @@ TkpComputeMenuButtonGeometry(butPtr)
*/
void
DrawMenuButtonImageAndText(
- TkMenuButton* butPtr)
+ TkMenuButton *butPtr)
{
- MacMenuButton *mbPtr = (MacMenuButton*)butPtr;
- Tk_Window tkwin = butPtr->tkwin;
- Pixmap pixmap;
- int haveImage = 0;
- int haveText = 0;
- int imageWidth = 0;
- int imageHeight = 0;
- int imageXOffset = 0;
- int imageYOffset = 0;
- int textXOffset = 0;
- int textYOffset = 0;
- int width = 0;
- int height = 0;
- int fullWidth = 0;
- int fullHeight = 0;
- int pressed;
+ MacMenuButton *mbPtr = (MacMenuButton *) butPtr;
+ Tk_Window tkwin = butPtr->tkwin;
+ Pixmap pixmap;
+ int haveImage = 0, haveText = 0;
+ int imageWidth = 0, imageHeight = 0;
+ int imageXOffset = 0, imageYOffset = 0;
+ int textXOffset = 0, textYOffset = 0;
+ int width = 0, height = 0;
+ int fullWidth = 0, fullHeight = 0;
if (tkwin == NULL || !Tk_IsMapped(tkwin)) {
return;
}
- DrawParams* dpPtr = &mbPtr->drawParams;
- pixmap = (Pixmap)Tk_WindowId(tkwin);
-
+ DrawParams *dpPtr = &mbPtr->drawParams;
+ pixmap = (Pixmap) Tk_WindowId(tkwin);
- if (butPtr->image != None) {
+ if (butPtr->image != NULL) {
Tk_SizeOfImage(butPtr->image, &width, &height);
haveImage = 1;
} else if (butPtr->bitmap != None) {
@@ -406,86 +403,80 @@ DrawMenuButtonImageAndText(
haveImage = 1;
}
- imageWidth = width;
+ imageWidth = width;
imageHeight = height;
- if (mbPtr->drawinfo.state == kThemeStatePressed) {
- /* Offset bitmaps by a bit when the button is pressed. */
- pressed = 1;
- }
-
haveText = (butPtr->textWidth != 0 && butPtr->textHeight != 0);
if (butPtr->compound != COMPOUND_NONE && haveImage && haveText) {
- int x = 0;
- int y = 0;
+ int x = 0, y = 0;
+
textXOffset = 0;
textYOffset = 0;
fullWidth = 0;
fullHeight = 0;
switch ((enum compound) butPtr->compound) {
- case COMPOUND_TOP:
- case COMPOUND_BOTTOM: {
- /* Image is above or below text */
- if (butPtr->compound == COMPOUND_TOP) {
- textYOffset = height + butPtr->padY;
- } else {
- imageYOffset = butPtr->textHeight + butPtr->padY;
- }
- fullHeight = height + butPtr->textHeight + butPtr->padY;
- fullWidth = (width > butPtr->textWidth ?
- width : butPtr->textWidth);
- textXOffset = (fullWidth - butPtr->textWidth)/2;
- imageXOffset = (fullWidth - width)/2;
- break;
- }
- case COMPOUND_LEFT:
- case COMPOUND_RIGHT: {
- /*
- * Image is left or right of text
- */
-
- if (butPtr->compound == COMPOUND_LEFT) {
- textXOffset = width + butPtr->padX - 2;
- } else {
- imageXOffset = butPtr->textWidth + butPtr->padX;
- }
- fullWidth = butPtr->textWidth + butPtr->padX + width;
- fullHeight = (height > butPtr->textHeight ? height :
- butPtr->textHeight);
- textYOffset = (fullHeight - butPtr->textHeight)/2;
- imageYOffset = (fullHeight - height)/2;
- break;
- }
- case COMPOUND_CENTER: {
- /*
- * Image and text are superimposed
- */
-
- fullWidth = (width > butPtr->textWidth ? width :
- butPtr->textWidth);
- fullHeight = (height > butPtr->textHeight ? height :
- butPtr->textHeight);
- textXOffset = (fullWidth - butPtr->textWidth)/2;
- imageXOffset = (fullWidth - width)/2;
- textYOffset = (fullHeight - butPtr->textHeight)/2;
- imageYOffset = (fullHeight - height)/2;
- break;
- }
- case COMPOUND_NONE: {break;}
+ case COMPOUND_TOP:
+ case COMPOUND_BOTTOM:
+ /*
+ * Image is above or below text.
+ */
+
+ if (butPtr->compound == COMPOUND_TOP) {
+ textYOffset = height + butPtr->padY;
+ } else {
+ imageYOffset = butPtr->textHeight + butPtr->padY;
+ }
+ fullHeight = height + butPtr->textHeight + butPtr->padY;
+ fullWidth = (width > butPtr->textWidth ?
+ width : butPtr->textWidth);
+ textXOffset = (fullWidth - butPtr->textWidth)/2;
+ imageXOffset = (fullWidth - width)/2;
+ break;
+ case COMPOUND_LEFT:
+ case COMPOUND_RIGHT:
+ /*
+ * Image is left or right of text
+ */
+
+ if (butPtr->compound == COMPOUND_LEFT) {
+ textXOffset = width + butPtr->padX - 2;
+ } else {
+ imageXOffset = butPtr->textWidth + butPtr->padX;
+ }
+ fullWidth = butPtr->textWidth + butPtr->padX + width;
+ fullHeight = (height > butPtr->textHeight ? height :
+ butPtr->textHeight);
+ textYOffset = (fullHeight - butPtr->textHeight)/2;
+ imageYOffset = (fullHeight - height)/2;
+ break;
+ case COMPOUND_CENTER:
+ /*
+ * Image and text are superimposed
+ */
+
+ fullWidth = (width > butPtr->textWidth ? width : butPtr->textWidth);
+ fullHeight = (height > butPtr->textHeight ? height :
+ butPtr->textHeight);
+ textXOffset = (fullWidth - butPtr->textWidth) / 2;
+ imageXOffset = (fullWidth - width) / 2;
+ textYOffset = (fullHeight - butPtr->textHeight) / 2;
+ imageYOffset = (fullHeight - height) / 2;
+ break;
+ case COMPOUND_NONE:
+ break;
}
TkComputeAnchor(butPtr->anchor, tkwin,
- butPtr->padX + butPtr->inset,
- butPtr->padY + butPtr->inset,
+ butPtr->padX + butPtr->inset, butPtr->padY + butPtr->inset,
fullWidth, fullHeight, &x, &y);
imageXOffset = LEFT_INSET;
imageYOffset += y;
textYOffset -= 1;
if (butPtr->image != NULL) {
- Tk_RedrawImage(butPtr->image, 0, 0, width,
- height, pixmap, imageXOffset, imageYOffset);
+ Tk_RedrawImage(butPtr->image, 0, 0, width,
+ height, pixmap, imageXOffset, imageYOffset);
} else {
XSetClipOrigin(butPtr->display, dpPtr->gc,
imageXOffset, imageYOffset);
@@ -499,12 +490,12 @@ DrawMenuButtonImageAndText(
dpPtr->gc, butPtr->textLayout,
x + textXOffset, y + textYOffset, 0, -1);
Tk_UnderlineTextLayout(butPtr->display, pixmap, dpPtr->gc,
- butPtr->textLayout,
- x + textXOffset, y + textYOffset,
+ butPtr->textLayout, x + textXOffset, y + textYOffset,
butPtr->underline);
} else {
+ int x, y;
+
if (haveImage) {
- int x, y;
TkComputeAnchor(butPtr->anchor, tkwin,
butPtr->padX + butPtr->borderWidth,
butPtr->padY + butPtr->borderWidth,
@@ -524,27 +515,24 @@ DrawMenuButtonImageAndText(
XSetClipOrigin(butPtr->display, dpPtr->gc, 0, 0);
}
} else {
- int x, y;
textXOffset = LEFT_INSET;
TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX, butPtr->padY,
- butPtr->textWidth, butPtr->textHeight, &x, &y);
+ butPtr->textWidth, butPtr->textHeight, &x, &y);
Tk_DrawTextLayout(butPtr->display, pixmap, dpPtr->gc,
- butPtr->textLayout, textXOffset, y, 0, -1);
+ butPtr->textLayout, textXOffset, y, 0, -1);
y += butPtr->textHeight/2;
- }
+ }
}
}
-
-
-
+
/*
*--------------------------------------------------------------
*
* TkMacOSXDrawMenuButton --
*
- * This function draws the tk menubutton using Mac controls
- * In addition, this code may apply custom colors passed
- * in the TkMenubutton.
+ * This function draws the tk menubutton using Mac controls. In
+ * addition, this code may apply custom colors passed in the
+ * TkMenubutton.
*
* Results:
* None.
@@ -554,43 +542,38 @@ DrawMenuButtonImageAndText(
*
*--------------------------------------------------------------
*/
+
static void
TkMacOSXDrawMenuButton(
MacMenuButton *mbPtr, /* Mac menubutton. */
- GC gc, /* The GC we are drawing into - needed for
- * the bevel button */
- Pixmap pixmap) /* The pixmap we are drawing into - needed
- * for the bevel button */
+ TCL_UNUSED(GC), /* The GC we are drawing into - not used */
+ Pixmap pixmap) /* The pixmap we are drawing into - needed for the
+ * bevel button */
{
- TkMenuButton * butPtr = ( TkMenuButton *)mbPtr;
- TkWindow * winPtr;
- HIRect cntrRect;
+ TkMenuButton *butPtr = (TkMenuButton *) mbPtr;
+ TkWindow *winPtr = (TkWindow *) butPtr->tkwin;
+ HIRect cntrRect;
TkMacOSXDrawingContext dc;
- DrawParams* dpPtr = &mbPtr->drawParams;
+ DrawParams *dpPtr = &mbPtr->drawParams;
int useNewerHITools = 1;
- winPtr = (TkWindow *)butPtr->tkwin;
-
TkMacOSXComputeMenuButtonParams(butPtr, &mbPtr->btnkind, &mbPtr->drawinfo);
cntrRect = CGRectMake(winPtr->privatePtr->xOff, winPtr->privatePtr->yOff,
- Tk_Width(butPtr->tkwin),
- Tk_Height(butPtr->tkwin));
+ Tk_Width(butPtr->tkwin), Tk_Height(butPtr->tkwin));
if (useNewerHITools == 1) {
HIRect contHIRec;
static HIThemeButtonDrawInfo hiinfo;
- MenuButtonBackgroundDrawCB((MacMenuButton*) mbPtr, 32, true);
-
+ MenuButtonBackgroundDrawCB(mbPtr, 32, true);
if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, 1, &dc)) {
return;
}
-
hiinfo.version = 0;
hiinfo.state = mbPtr->drawinfo.state;
- hiinfo.kind = mbPtr->btnkind;
+ hiinfo.kind = mbPtr->btnkind;
hiinfo.value = mbPtr->drawinfo.value;
hiinfo.adornment = mbPtr->drawinfo.adornment;
hiinfo.animation.time.current = CFAbsoluteTimeGetCurrent();
@@ -598,11 +581,22 @@ TkMacOSXDrawMenuButton(
hiinfo.animation.time.start = hiinfo.animation.time.current;
}
+ /*
+ * To avoid menubuttons with white text on a white background, we
+ * always set the state to inactive in Dark Mode. It isn't perfect but
+ * it is usable. Using a ttk::menubutton would be a better choice,
+ * however.
+ */
+
+ if (TkMacOSXInDarkMode(butPtr->tkwin)) {
+ hiinfo.state = kThemeStateInactive;
+ }
+
HIThemeDrawButton(&cntrRect, &hiinfo, dc.context,
- kHIThemeOrientationNormal, &contHIRec);
+ kHIThemeOrientationNormal, &contHIRec);
TkMacOSXRestoreDrawingContext(&dc);
- MenuButtonContentDrawCB( mbPtr->btnkind, &mbPtr->drawinfo,
- (MacMenuButton *)mbPtr, 32, true);
+ MenuButtonContentDrawCB(mbPtr->btnkind, &mbPtr->drawinfo,
+ mbPtr, 32, true);
} else {
if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, 1, &dc)) {
return;
@@ -617,33 +611,34 @@ TkMacOSXDrawMenuButton(
*
* MenuButtonBackgroundDrawCB --
*
- * This function draws the background that
- * lies under checkboxes and radiobuttons.
+ * This function draws the background that lies under checkboxes and
+ * radiobuttons.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * The background gets updated to the current color.
+ * The background gets updated to the current color.
*
*--------------------------------------------------------------
*/
+
static void
MenuButtonBackgroundDrawCB (
MacMenuButton *ptr,
- SInt16 depth,
- Boolean isColorDev)
+ TCL_UNUSED(SInt16),
+ TCL_UNUSED(Boolean))
{
- TkMenuButton* butPtr = (TkMenuButton*)ptr;
- Tk_Window tkwin = butPtr->tkwin;
+ TkMenuButton* butPtr = (TkMenuButton *) ptr;
+ Tk_Window tkwin = butPtr->tkwin;
Pixmap pixmap;
+
if (tkwin == NULL || !Tk_IsMapped(tkwin)) {
return;
}
- pixmap = (Pixmap)Tk_WindowId(tkwin);
-
+ pixmap = (Pixmap) Tk_WindowId(tkwin);
Tk_Fill3DRectangle(tkwin, pixmap, butPtr->normalBorder, 0, 0,
- Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT);
+ Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT);
}
/*
@@ -651,26 +646,27 @@ MenuButtonBackgroundDrawCB (
*
* MenuButtonContentDrawCB --
*
- * This function draws the label and image for the button.
+ * This function draws the label and image for the button.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * The content of the button gets updated.
+ * The content of the button gets updated.
*
*--------------------------------------------------------------
*/
+
static void
MenuButtonContentDrawCB (
- ThemeButtonKind kind,
- const HIThemeButtonDrawInfo *drawinfo,
+ TCL_UNUSED(ThemeButtonKind),
+ TCL_UNUSED(const HIThemeButtonDrawInfo *),
MacMenuButton *ptr,
- SInt16 depth,
- Boolean isColorDev)
+ TCL_UNUSED(SInt16),
+ TCL_UNUSED(Boolean))
{
- TkMenuButton *butPtr = (TkMenuButton *)ptr;
- Tk_Window tkwin = butPtr->tkwin;
+ TkMenuButton *butPtr = (TkMenuButton *) ptr;
+ Tk_Window tkwin = butPtr->tkwin;
if (tkwin == NULL || !Tk_IsMapped(tkwin)) {
return;
@@ -683,8 +679,8 @@ MenuButtonContentDrawCB (
*
* MenuButtonEventProc --
*
- * This procedure is invoked by the Tk dispatcher for various
- * events on buttons.
+ * This procedure is invoked by the Tk dispatcher for various events on
+ * buttons.
*
* Results:
* None.
@@ -700,8 +696,8 @@ MenuButtonEventProc(
ClientData clientData, /* Information about window. */
XEvent *eventPtr) /* Information about event. */
{
- TkMenuButton *buttonPtr = (TkMenuButton *) clientData;
- MacMenuButton *mbPtr = (MacMenuButton *) clientData;
+ TkMenuButton *buttonPtr = clientData;
+ MacMenuButton *mbPtr = clientData;
if (eventPtr->type == ActivateNotify
|| eventPtr->type == DeactivateNotify) {
@@ -725,9 +721,9 @@ MenuButtonEventProc(
*
* TkMacOSXComputeMenuButtonParams --
*
- * This procedure computes the various parameters used
- * when creating a Carbon Appearance control.
- * These are determined by the various tk button parameters
+ * This procedure computes the various parameters used when creating a
+ * Carbon Appearance control. These are determined by the various Tk
+ * button parameters
*
* Results:
* None.
@@ -740,11 +736,11 @@ MenuButtonEventProc(
static void
TkMacOSXComputeMenuButtonParams(
- TkMenuButton * butPtr,
- ThemeButtonKind* btnkind,
+ TkMenuButton *butPtr,
+ ThemeButtonKind *btnkind,
HIThemeButtonDrawInfo *drawinfo)
{
- MacMenuButton *mbPtr = (MacMenuButton *)butPtr;
+ MacMenuButton *mbPtr = (MacMenuButton *) butPtr;
if (butPtr->image || butPtr->bitmap || butPtr->text) {
/* TODO: allow for Small and Mini menubuttons. */
@@ -789,25 +785,25 @@ TkMacOSXComputeMenuButtonParams(
*
* TkMacOSXComputeMenuButtonDrawParams --
*
- * This procedure selects an appropriate drawing context for
- * drawing a menubutton.
+ * This procedure selects an appropriate drawing context for drawing a
+ * menubutton.
*
* Results:
- * None.
+ * None.
*
* Side effects:
- * Sets the button draw parameters.
+ * Sets the button draw parameters.
*
*----------------------------------------------------------------------
*/
static void
TkMacOSXComputeMenuButtonDrawParams(
- TkMenuButton * butPtr,
- DrawParams * dpPtr)
+ TkMenuButton *butPtr,
+ DrawParams *dpPtr)
{
- dpPtr->hasImageOrBitmap = ((butPtr->image != NULL) ||
- (butPtr->bitmap != None));
+ dpPtr->hasImageOrBitmap =
+ ((butPtr->image != NULL) || (butPtr->bitmap != None));
dpPtr->border = butPtr->normalBorder;
if ((butPtr->state == STATE_DISABLED) && (butPtr->disabledFg != NULL)) {
dpPtr->gc = butPtr->disabledGC;
@@ -818,7 +814,7 @@ TkMacOSXComputeMenuButtonDrawParams(
dpPtr->gc = butPtr->normalTextGC;
}
}
-
+
/*
* Local Variables:
* mode: objc