diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2022-02-06 16:04:24 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2022-02-06 16:04:24 +0100 |
commit | 5d2c2b27a6323e2666378b986129b2a7c2c39e5c (patch) | |
tree | ce8982b6c0111f79791068de2c2d4c6ce3138a49 /app/wlib/mswlib/mswchoic.c | |
parent | b623f5953691b2a0614e6f1f4def86bdbb9a4113 (diff) |
New upstream version 5.2.2GAupstream/5.2.2GA
Diffstat (limited to 'app/wlib/mswlib/mswchoic.c')
-rw-r--r-- | app/wlib/mswlib/mswchoic.c | 87 |
1 files changed, 44 insertions, 43 deletions
diff --git a/app/wlib/mswlib/mswchoic.c b/app/wlib/mswlib/mswchoic.c index 2ac391a..55ed177 100644 --- a/app/wlib/mswlib/mswchoic.c +++ b/app/wlib/mswlib/mswchoic.c @@ -15,8 +15,8 @@ ***************************************************************************** */ -int CHOICE_HEIGHT=(17); -int CHOICE_MIN_WIDTH=25; +#define CHOICE_HEIGHT (17) +#define CHOICE_MIN_WIDTH (25) static XWNDPROC oldChoiceItemProc = NULL; static XWNDPROC newChoiceItemProc; @@ -28,7 +28,7 @@ typedef struct { struct wChoice_t { WOBJ_COMMON - const char * * labels; + const char * const * labels; wChoiceItem_p *buttList; long *valueP; long oldVal; @@ -42,14 +42,14 @@ void wRadioSetValue( wChoice_p bc, long val ) { - const char ** labels; + const char * const * labels; long cnt; wChoiceItem_p * butts; butts = (wChoiceItem_p*)bc->buttList; for (labels = bc->labels, cnt=0; *labels; labels++, cnt++, butts++ ) SendMessage( (*butts)->hWnd, BM_SETCHECK, - (val==cnt)?1:0, 0L ); + (WPARAM)((val==cnt)?1:0), (LPARAM)0 ); bc->oldVal = val; if (bc->valueP) *bc->valueP = val; @@ -67,14 +67,14 @@ void wToggleSetValue( wChoice_p bc, long val ) { - const char ** labels; + const char * const * labels; long cnt; wChoiceItem_p * butts; butts = (wChoiceItem_p*)bc->buttList; for (labels = bc->labels, cnt=0; *labels; labels++, cnt++, butts++ ) SendMessage( (*butts)->hWnd, BM_SETCHECK, - (val & (1L<<cnt)) != 0, 0L ); + (WPARAM)((val & (1L<<cnt)) != 0), (LPARAM)0 ); bc->oldVal = val; if (bc->valueP) *bc->valueP = val; @@ -115,12 +115,12 @@ static void choiceShow( static void choiceSetPos( wControl_p b, - wPos_t x, - wPos_t y ) + wWinPix_t x, + wWinPix_t y ) { wChoice_p bc = (wChoice_p)b; wChoiceItem_p * butts; - wPos_t dx, dy; + wWinPix_t dx, dy; dx = x - bc->x; dy = y - bc->y; @@ -129,8 +129,10 @@ static void choiceSetPos( SWP_NOSIZE|SWP_NOZORDER ); for (butts = (wChoiceItem_p*)bc->buttList; *butts; butts++ ) { + (*butts)->x += dx; + (*butts)->y += dy; SetWindowPos( (*butts)->hWnd, HWND_TOP, - (*butts)->x+=dx, (*butts)->y+=dy, + (*butts)->x, (*butts)->y, CW_USEDEFAULT, CW_USEDEFAULT, SWP_NOSIZE|SWP_NOZORDER ); } @@ -138,19 +140,14 @@ static void choiceSetPos( bc->y = y; } -long FAR PASCAL _export pushChoiceItem( +LRESULT FAR PASCAL _export pushChoiceItem( HWND hWnd, UINT message, - UINT wParam, - LONG lParam ) + WPARAM wParam, + LPARAM lParam ) { /* Catch <Return> and cause focus to leave control */ -#ifdef WIN32 - long inx = GetWindowLong( hWnd, GWL_ID ); -#else - short inx = GetWindowWord( hWnd, GWW_ID ); -#endif - + wIndex_t inx = (wIndex_t)GetWindowLongPtr( hWnd, GWL_ID ); wControl_p b = mswMapIndex( inx ); switch (message) { @@ -165,7 +162,7 @@ long FAR PASCAL _export pushChoiceItem( wParam, lParam ); /*SendMessage( ((wControl_p)(b->parent))->hWnd, WM_COMMAND, inx, MAKELONG( hWnd, EN_KILLFOCUS ) );*/ - return 0L; + return (LRESULT)0; } } break; @@ -194,20 +191,20 @@ LRESULT choiceItemProc( for (rest = (wChoiceItem_p*)bc->buttList; *rest; rest++ ) { switch (bc->type) { case B_TOGGLE: - num = rest-(wChoiceItem_p*)bc->buttList; + num = (int)(rest-(wChoiceItem_p*)bc->buttList); if (*rest == me) { bc->oldVal ^= (1L<<num); } SendMessage( (*rest)->hWnd, BM_SETCHECK, - (bc->oldVal & (1L<<num)) != 0, 0L ); + (WPARAM)((bc->oldVal & (1L<<num)) != 0), (LPARAM)0 ); break; case B_RADIO: if (*rest != me) { - SendMessage( (*rest)->hWnd, BM_SETCHECK, 0, 0L ); + SendMessage( (*rest)->hWnd, BM_SETCHECK, (WPARAM)0, (LPARAM)0 ); } else { - bc->oldVal = rest-(wChoiceItem_p*)bc->buttList; - SendMessage( (*rest)->hWnd, BM_SETCHECK, 1, 0L ); + bc->oldVal = (long)(rest-(wChoiceItem_p*)bc->buttList); + SendMessage( (*rest)->hWnd, BM_SETCHECK, (WPARAM)1, (LPARAM)0 ); } break; } @@ -259,25 +256,25 @@ static callBacks_t choiceItemCallBacks = { static wChoice_p choiceCreate( wType_e type, wWin_p parent, - POS_T x, - POS_T y, + wWinPix_t x, + wWinPix_t y, const char * helpStr, const char * labelStr, long option, - const char **labels, + const char * const * labels, long *valueP, wChoiceCallBack_p action, void *data ) { wChoice_p b; - const char ** lp; + const char * const * lp; int cnt; wChoiceItem_p * butts; - int ppx, ppy; + wWinPix_t ppx, ppy; int bs; HDC hDc; HWND hButt; - int lab_l; + size_t lab_l; DWORD dw; int w, maxW; int pw, ph; @@ -319,7 +316,7 @@ static wChoice_p choiceCreate( (*butts)->hWnd = hButt = CreateWindow( "BUTTON", (*butts)->labelStr, bs | WS_CHILD | WS_VISIBLE | mswGetBaseStyle(parent), b->x+pw, b->y+ph, 80, CHOICE_HEIGHT, - ((wControl_p)parent)->hWnd, (HMENU)index, mswHInst, NULL ); + ((wControl_p)parent)->hWnd, (HMENU)(UINT_PTR)index, mswHInst, NULL ); if ( hButt == (HWND)0 ) { mswFail( "choiceCreate button" ); return b; @@ -334,7 +331,7 @@ static wChoice_p choiceCreate( lab_l = strlen((*butts)->labelStr); if (!mswThickFont) {hFont = SelectObject( hDc, mswLabelFont );} - dw = GetTextExtent( hDc, (char *)((*butts)->labelStr), lab_l ); + dw = GetTextExtent( hDc, (char *)((*butts)->labelStr), (UINT)lab_l ); if (!mswThickFont) {SelectObject( hDc, hFont );} w = LOWORD(dw) + CHOICE_MIN_WIDTH; @@ -354,10 +351,14 @@ static wChoice_p choiceCreate( } mswChainFocus( (wControl_p)*butts ); newChoiceItemProc = MakeProcInstance( (XWNDPROC)pushChoiceItem, mswHInst ); - oldChoiceItemProc = (XWNDPROC)GetWindowLong( (*butts)->hWnd, GWL_WNDPROC ); - SetWindowLong( (*butts)->hWnd, GWL_WNDPROC, (LONG)newChoiceItemProc ); + oldChoiceItemProc = (XWNDPROC)GetWindowLongPtr((*butts)->hWnd, GWLP_WNDPROC); + SetWindowLongPtr((*butts)->hWnd, GWLP_WNDPROC, (LPARAM)newChoiceItemProc); +#ifdef _OLDCODE + oldChoiceItemProc = (XWNDPROC)GetWindowLong((*butts)->hWnd, GWL_WNDPROC); + SetWindowLong((*butts)->hWnd, GWL_WNDPROC, (LONG)newChoiceItemProc); +#endif if ( !mswThickFont ) - SendMessage( (*butts)->hWnd, WM_SETFONT, (WPARAM)mswLabelFont, 0L ); + SendMessage( (*butts)->hWnd, WM_SETFONT, (WPARAM)mswLabelFont, (LPARAM)0 ); } *butts = NULL; switch (b->type) { @@ -392,12 +393,12 @@ static wChoice_p choiceCreate( wChoice_p wRadioCreate( wWin_p parent, - POS_T x, - POS_T y, + wWinPix_t x, + wWinPix_t y, const char * helpStr, const char * labelStr, long option, - const char **labels, + const char * const *labels, long *valueP, wChoiceCallBack_p action, void *data ) @@ -408,12 +409,12 @@ wChoice_p wRadioCreate( wChoice_p wToggleCreate( wWin_p parent, - POS_T x, - POS_T y, + wWinPix_t x, + wWinPix_t y, const char * helpStr, const char * labelStr, long option, - const char **labels, + const char * const *labels, long *valueP, wChoiceCallBack_p action, void *data ) |