summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authormdejong <mdejong>2003-12-26 20:46:03 (GMT)
committermdejong <mdejong>2003-12-26 20:46:03 (GMT)
commit27f3695532a8ecf6d52803e8ef8dd81c319677b0 (patch)
tree5641abd4a3e83d18cda7421e5575070556e6de16 /win
parentd0cc770ddd6d60de01f58e7de080fffd2f051cd5 (diff)
downloadtk-27f3695532a8ecf6d52803e8ef8dd81c319677b0.zip
tk-27f3695532a8ecf6d52803e8ef8dd81c319677b0.tar.gz
tk-27f3695532a8ecf6d52803e8ef8dd81c319677b0.tar.bz2
* win/tkWinMenu.c (DrawMenuEntryAccelerator,
DrawMenuEntryArrow): Move the unused menu arrow drawing code in DrawMenuEntryAccelerator into a new function named DrawMenuEntryArrow. This makes no functional change but it will make it easier to fix things in the future.
Diffstat (limited to 'win')
-rw-r--r--win/tkWinMenu.c72
1 files changed, 59 insertions, 13 deletions
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index f366cf7..57c9d41 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinMenu.c,v 1.26 2003/12/21 23:50:13 davygrvy Exp $
+ * RCS: @(#) $Id: tkWinMenu.c,v 1.27 2003/12/26 20:46:03 mdejong Exp $
*/
#define OEMRESOURCE
@@ -91,6 +91,11 @@ static void DrawMenuEntryAccelerator _ANSI_ARGS_((
Drawable d, GC gc, Tk_Font tkfont,
CONST Tk_FontMetrics *fmPtr,
Tk_3DBorder activeBorder, int x, int y,
+ int width, int height));
+static void DrawMenuEntryArrow _ANSI_ARGS_((
+ TkMenu *menuPtr, TkMenuEntry *mePtr,
+ Drawable d, GC gc,
+ Tk_3DBorder activeBorder, int x, int y,
int width, int height, int drawArrow));
static void DrawMenuEntryBackground _ANSI_ARGS_((
TkMenu *menuPtr, TkMenuEntry *mePtr,
@@ -1589,7 +1594,7 @@ DrawMenuEntryIndicator(menuPtr, mePtr, d, gc, indicatorGC, tkfont, fmPtr, x,
void
DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr,
- activeBorder, x, y, width, height, drawArrow)
+ activeBorder, x, y, width, height)
TkMenu *menuPtr; /* The menu we are drawing */
TkMenuEntry *mePtr; /* The entry we are drawing */
Drawable d; /* What we are drawing into */
@@ -1601,10 +1606,6 @@ DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr,
int y; /* top edge */
int width; /* Width of menu entry */
int height; /* Height of menu entry */
- int drawArrow; /* For cascade menus, whether of not
- * to draw the arraw. I cannot figure
- * out Windows' algorithm for where
- * to draw this. */
{
int baseline;
int leftEdge = x + mePtr->indicatorSpace + mePtr->labelWidth;
@@ -1617,8 +1618,7 @@ DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr,
baseline = y + (height + fmPtr->ascent - fmPtr->descent) / 2;
if ((mePtr->state == ENTRY_DISABLED) && (menuPtr->disabledFgPtr != NULL)
- && ((mePtr->accelPtr != NULL)
- || ((mePtr->type == CASCADE_ENTRY) && drawArrow))) {
+ && (mePtr->accelPtr != NULL)) {
COLORREF oldFgColor = gc->foreground;
gc->foreground = GetSysColor(COLOR_3DHILIGHT);
@@ -1627,6 +1627,55 @@ DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr,
mePtr->accelLength, leftEdge + 1, baseline + 1);
}
+ gc->foreground = oldFgColor;
+ }
+
+ if (mePtr->accelPtr != NULL) {
+ Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel,
+ mePtr->accelLength, leftEdge, baseline);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DrawMenuEntryArrow --
+ *
+ * This function draws the arrow bitmap on the right side of a
+ * a menu entry. This function is currently unused.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+DrawMenuEntryArrow(menuPtr, mePtr, d, gc,
+ activeBorder, x, y, width, height, drawArrow)
+ TkMenu *menuPtr; /* The menu we are drawing */
+ TkMenuEntry *mePtr; /* The entry we are drawing */
+ Drawable d; /* What we are drawing into */
+ GC gc; /* The gc we are drawing with */
+ Tk_3DBorder activeBorder; /* The border when an item is active */
+ int x; /* left edge */
+ int y; /* top edge */
+ int width; /* Width of menu entry */
+ int height; /* Height of menu entry */
+ int drawArrow; /* For cascade menus, whether of not
+ * to draw the arraw. I cannot figure
+ * out Windows' algorithm for where
+ * to draw this. */
+{
+ if ((mePtr->state == ENTRY_DISABLED) && (menuPtr->disabledFgPtr != NULL)
+ && ((mePtr->type == CASCADE_ENTRY) && drawArrow)) {
+ COLORREF oldFgColor = gc->foreground;
+
+ gc->foreground = GetSysColor(COLOR_3DHILIGHT);
+
if (mePtr->type == CASCADE_ENTRY) {
RECT rect;
@@ -1640,11 +1689,6 @@ DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr,
gc->foreground = oldFgColor;
}
- if (mePtr->accelPtr != NULL) {
- Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel,
- mePtr->accelLength, leftEdge, baseline);
- }
-
if ((mePtr->type == CASCADE_ENTRY) && drawArrow) {
RECT rect;
@@ -2377,6 +2421,8 @@ TkpDrawMenuEntry(mePtr, d, tkfont, menuMetricsPtr, x, y, width, height,
DrawMenuEntryLabel(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, adjustedY,
width, adjustedHeight);
DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr,
+ activeBorder, x, adjustedY, width, adjustedHeight);
+ DrawMenuEntryArrow(menuPtr, mePtr, d, gc,
activeBorder, x, adjustedY, width, adjustedHeight, drawArrow);
if (!mePtr->hideMargin) {
DrawMenuEntryIndicator(menuPtr, mePtr, d, gc, indicatorGC, tkfont,