summaryrefslogtreecommitdiff
path: root/app/wlib/mswlib/mswmenu.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/wlib/mswlib/mswmenu.c')
-rw-r--r--app/wlib/mswlib/mswmenu.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/app/wlib/mswlib/mswmenu.c b/app/wlib/mswlib/mswmenu.c
index d56e24d..9e36c8b 100644
--- a/app/wlib/mswlib/mswmenu.c
+++ b/app/wlib/mswlib/mswmenu.c
@@ -31,7 +31,6 @@
#include <math.h>
#include <ctype.h>
#include <assert.h>
-#include "misc.h"
#include "mswint.h"
#include "i18n.h"
@@ -94,7 +93,7 @@ struct wMenuRadio_t {
struct wMenuToggle_t {
MOBJ_COMMON
wMenu_p mparent;
- wMenuToggleCallBack_p action;
+ wMenuCallBack_p action;
long acclKey;
wBool_t enabled;
};
@@ -174,7 +173,7 @@ static LRESULT menuPush(
set = !set;
wMenuToggleSet((wMenuToggle_p)m,set);
if (((wMenuToggle_p)m)->action)
- ((wMenuToggle_p)m)->action(set, ((wMenuPush_p)m)->data);
+ ((wMenuToggle_p)m)->action(((wMenuPush_p)m)->data);
break;
case M_LISTITEM:
if (((wMenuListItem_p)m)->action)
@@ -185,7 +184,7 @@ static LRESULT menuPush(
((wMenuRadio_p)m)->action(((wMenuRadio_p)m)->data);
break;
}
- return 0L;
+ return (LRESULT)0;
}
if ( (m->parentMenu)->traceFunc ) {
(m->parentMenu)->traceFunc( m->parentMenu, m->labelStr, ((wMenu_p)m->parentMenu)->traceData );
@@ -261,7 +260,7 @@ typedef struct {
wAccelKey_e key;
void * data;
} acclTable_t, *acclTable_p;
-dynArr_t acclTable_da;
+static dynArr_t acclTable_da;
#define acclTable(N) DYNARR_N( acclTable_t, acclTable_da, N )
@@ -364,7 +363,8 @@ HBITMAP GetMyCheckBitmaps(UINT fuCheck)
HBITMAP hbmpCheck; /* handle to check-mark bitmap */
RECT rc; /* rectangle for check-box bitmap */
WORD wBitmapX; /* width of check-mark bitmap */
- WORD wBitmapY; /* height of check-mark bitmap */
+ WORD wBitmapY; /* height of check-mark bitmap */
+ WORD wMenuH; /* height of menu line */
/* Get the menu background color and create a solid brush
with that color. */
@@ -383,6 +383,7 @@ HBITMAP GetMyCheckBitmaps(UINT fuCheck)
wBitmapX = GetSystemMetrics(SM_CXMENUCHECK);
wBitmapY = GetSystemMetrics(SM_CYMENUCHECK);
+ wMenuH = GetSystemMetrics(SM_CYMENU);
hbmpCheck = CreateCompatibleBitmap(hdcSource, wBitmapX,
wBitmapY);
@@ -428,11 +429,11 @@ HBITMAP GetMyCheckBitmaps(UINT fuCheck)
case RADIOCHECK:
rc.left = (bmCheckbox.bmWidth / 4);
rc.right = (bmCheckbox.bmWidth / 4) * 2;
- rc.top = (bmCheckbox.bmHeight / 3) + 1;
+ rc.top = (bmCheckbox.bmHeight / 3);
rc.bottom = (bmCheckbox.bmHeight / 3) * 2;
break;
case RADIOUNCHECK:
- rc.top = (bmCheckbox.bmHeight / 3) + 1;
+ rc.top = (bmCheckbox.bmHeight / 3);
rc.bottom = (bmCheckbox.bmHeight / 3) * 2;
rc.left = 0;
rc.right = (bmCheckbox.bmWidth / 4);
@@ -444,7 +445,6 @@ HBITMAP GetMyCheckBitmaps(UINT fuCheck)
check-box bitmap is larger than the default check-mark
bitmap, use StretchBlt to make it fit; otherwise, just
copy it. */
-
if (((rc.right - rc.left) > (int) wBitmapX) ||
((rc.bottom - rc.top) > (int) wBitmapY))
{
@@ -455,7 +455,9 @@ HBITMAP GetMyCheckBitmaps(UINT fuCheck)
else
{
- BitBlt(hdcTarget, 0, 0, rc.right - rc.left,
+ // Center it vertically
+ WORD dy = (wMenuH > wBitmapY) ? (wMenuH - wBitmapY) / 2 : 0;
+ BitBlt(hdcTarget, 0, dy, rc.right - rc.left,
rc.bottom - rc.top,
hdcSource, rc.left, rc.top, SRCCOPY);
}
@@ -655,7 +657,7 @@ wMenu_p wMenuMenuCreate(
/*mm->parent = (wControl_p)m;*/
mm->first = mm->last = NULL;
- rc = AppendMenu( m->menu, MF_STRING|MF_ENABLED|MF_POPUP, (UINT)mm->menu, mm->labelStr );
+ rc = AppendMenu( m->menu, MF_STRING|MF_ENABLED|MF_POPUP, (UINT_PTR)(mm->menu), mm->labelStr );
return mm;
}
@@ -857,7 +859,7 @@ wMenuToggle_p wMenuToggleCreate(
const char * labelStr,
long acclKey,
wBool_t set,
- wMenuToggleCallBack_p action,
+ wMenuCallBack_p action,
void * data )
{
wMenuToggle_p mt;
@@ -958,8 +960,8 @@ void wMenuToggleEnable(
void mswMenuMove(
wMenu_p m,
- wPos_t x,
- wPos_t y )
+ wWinPix_t x,
+ wWinPix_t y )
{
wControl_p b;
b = (wControl_p)m->parent;
@@ -985,8 +987,8 @@ static void pushMenuButt(
wMenu_p wMenuCreate(
wWin_p parent,
- POS_T x,
- POS_T y,
+ wWinPix_t x,
+ wWinPix_t y,
const char * helpStr,
const char * labelStr,
long option )
@@ -1041,7 +1043,7 @@ wMenu_p wMenuBarAdd(
m->mmtype = MM_BAR;
m->first = m->last = NULL;
- rc = AppendMenu( menu, MF_STRING|MF_POPUP|MF_ENABLED, (UINT)m->menu, labelStr );
+ rc = AppendMenu( menu, MF_STRING|MF_POPUP|MF_ENABLED, (UINT_PTR)(m->menu), labelStr );
DrawMenuBar( ((wControl_p)w)->hWnd );
return m;
@@ -1118,7 +1120,7 @@ wBool_t wMenuAction(
} else {
set = wMenuToggleGet( mt );
wMenuToggleSet( mt, !set );
- mt->action( set, mt->data );
+ mt->action( mt->data );
}
break;
case M_MENU: