[USER32] Code formatting/indentation fixes only.

This commit is contained in:
Hermès Bélusca-Maïto 2018-02-18 20:31:29 +01:00
parent 729d6e7981
commit 5e4b3c7cf0
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

@ -98,17 +98,16 @@ static const MSGBTNINFO MsgBtnInfo[] =
DECLARE_MB_3(CANCEL, TRYAGAIN, CONTINUE) DECLARE_MB_3(CANCEL, TRYAGAIN, CONTINUE)
}; };
typedef struct _MSGBOXINFO typedef struct _MSGBOXINFO
{ {
MSGBOXPARAMSW; // Wine passes this too. MSGBOXPARAMSW; // Wine passes this too.
// ReactOS // ReactOS
HICON Icon; HICON Icon;
HFONT Font; HFONT Font;
int DefBtn; int DefBtn;
int nButtons; int nButtons;
LONG *Btns; LONG *Btns;
UINT Timeout; UINT Timeout;
} MSGBOXINFO, *PMSGBOXINFO; } MSGBOXINFO, *PMSGBOXINFO;
/* INTERNAL FUNCTIONS ********************************************************/ /* INTERNAL FUNCTIONS ********************************************************/
@ -217,147 +216,155 @@ static VOID MessageBoxTextToClipboard(HWND DialogWindow)
RtlFreeHeap(GetProcessHeap(), 0, pMessageBoxText); RtlFreeHeap(GetProcessHeap(), 0, pMessageBoxText);
} }
static INT_PTR CALLBACK MessageBoxProc( HWND hwnd, UINT message, static INT_PTR CALLBACK MessageBoxProc(
WPARAM wParam, LPARAM lParam ) HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{ {
int i, Alert; int i, Alert;
PMSGBOXINFO mbi; PMSGBOXINFO mbi;
HELPINFO hi; HELPINFO hi;
HWND owner; HWND owner;
switch(message) { switch (message)
{
case WM_INITDIALOG: case WM_INITDIALOG:
mbi = (PMSGBOXINFO)lParam; {
mbi = (PMSGBOXINFO)lParam;
SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR)mbi); SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR)mbi);
NtUserxSetMessageBox(hwnd); NtUserxSetMessageBox(hwnd);
if(!GetPropW(hwnd, L"ROS_MSGBOX")) if (!GetPropW(hwnd, L"ROS_MSGBOX"))
{
SetPropW(hwnd, L"ROS_MSGBOX", (HANDLE)lParam);
if (mbi->dwContextHelpId)
SetWindowContextHelpId(hwnd, mbi->dwContextHelpId);
if (mbi->Icon)
{ {
SendDlgItemMessageW(hwnd, MSGBOX_IDICON, STM_SETICON, (WPARAM)mbi->Icon, 0); SetPropW(hwnd, L"ROS_MSGBOX", (HANDLE)lParam);
Alert = ALERT_SYSTEM_WARNING;
} if (mbi->dwContextHelpId)
else // Setup the rest of the alerts. SetWindowContextHelpId(hwnd, mbi->dwContextHelpId);
{
switch(mbi->dwStyle & MB_ICONMASK) if (mbi->Icon)
{ {
case MB_ICONWARNING: SendDlgItemMessageW(hwnd, MSGBOX_IDICON, STM_SETICON, (WPARAM)mbi->Icon, 0);
Alert = ALERT_SYSTEM_WARNING; Alert = ALERT_SYSTEM_WARNING;
break; }
case MB_ICONERROR: else // Setup the rest of the alerts.
Alert = ALERT_SYSTEM_ERROR; {
break; switch (mbi->dwStyle & MB_ICONMASK)
case MB_ICONQUESTION: {
Alert = ALERT_SYSTEM_QUERY; case MB_ICONWARNING:
break; Alert = ALERT_SYSTEM_WARNING;
default: break;
Alert = ALERT_SYSTEM_INFORMATIONAL; case MB_ICONERROR:
/* fall through */ Alert = ALERT_SYSTEM_ERROR;
} break;
} case MB_ICONQUESTION:
/* Send out the alert notifications. */ Alert = ALERT_SYSTEM_QUERY;
NotifyWinEvent(EVENT_SYSTEM_ALERT, hwnd, OBJID_ALERT, Alert); break;
default:
Alert = ALERT_SYSTEM_INFORMATIONAL;
/* fall through */
}
}
/* Send out the alert notifications. */
NotifyWinEvent(EVENT_SYSTEM_ALERT, hwnd, OBJID_ALERT, Alert);
/* set control fonts */ /* set control fonts */
SendDlgItemMessageW(hwnd, MSGBOX_IDTEXT, WM_SETFONT, (WPARAM)mbi->Font, 0); SendDlgItemMessageW(hwnd, MSGBOX_IDTEXT, WM_SETFONT, (WPARAM)mbi->Font, 0);
for(i = 0; i < mbi->nButtons; i++) for (i = 0; i < mbi->nButtons; i++)
{ {
SendDlgItemMessageW(hwnd, mbi->Btns[i], WM_SETFONT, (WPARAM)mbi->Font, 0); SendDlgItemMessageW(hwnd, mbi->Btns[i], WM_SETFONT, (WPARAM)mbi->Font, 0);
}
switch (mbi->dwStyle & MB_TYPEMASK)
{
case MB_ABORTRETRYIGNORE:
case MB_YESNO:
RemoveMenu(GetSystemMenu(hwnd, FALSE), SC_CLOSE, MF_BYCOMMAND);
break;
}
SetFocus(GetDlgItem(hwnd, mbi->DefBtn));
if (mbi->Timeout && (mbi->Timeout != (UINT)-1))
SetTimer(hwnd, 0, mbi->Timeout, NULL);
} }
switch(mbi->dwStyle & MB_TYPEMASK) return 0;
{ }
case MB_ABORTRETRYIGNORE:
case MB_YESNO:
RemoveMenu(GetSystemMenu(hwnd, FALSE), SC_CLOSE, MF_BYCOMMAND);
break;
}
SetFocus(GetDlgItem(hwnd, mbi->DefBtn));
if(mbi->Timeout && (mbi->Timeout != (UINT)-1))
SetTimer(hwnd, 0, mbi->Timeout, NULL);
}
return 0;
case WM_COMMAND: case WM_COMMAND:
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDOK: case IDOK:
case IDCANCEL: case IDCANCEL:
case IDABORT: case IDABORT:
case IDRETRY: case IDRETRY:
case IDIGNORE: case IDIGNORE:
case IDYES: case IDYES:
case IDNO: case IDNO:
case IDTRYAGAIN: case IDTRYAGAIN:
case IDCONTINUE: case IDCONTINUE:
EndDialog(hwnd, wParam); EndDialog(hwnd, wParam);
return 0; return 0;
case IDHELP: case IDHELP:
/* send WM_HELP message to messagebox window */ /* send WM_HELP message to messagebox window */
hi.cbSize = sizeof(HELPINFO); hi.cbSize = sizeof(HELPINFO);
hi.iContextType = HELPINFO_WINDOW; hi.iContextType = HELPINFO_WINDOW;
hi.iCtrlId = LOWORD(wParam); hi.iCtrlId = LOWORD(wParam);
hi.hItemHandle = (HANDLE)lParam; hi.hItemHandle = (HANDLE)lParam;
hi.dwContextId = 0; hi.dwContextId = 0;
GetCursorPos(&hi.MousePos); GetCursorPos(&hi.MousePos);
SendMessageW(hwnd, WM_HELP, 0, (LPARAM)&hi); SendMessageW(hwnd, WM_HELP, 0, (LPARAM)&hi);
return 0; return 0;
} }
return 0; return 0;
case WM_COPY: case WM_COPY:
MessageBoxTextToClipboard(hwnd); MessageBoxTextToClipboard(hwnd);
return 0; return 0;
case WM_HELP: case WM_HELP:
mbi = (PMSGBOXINFO)GetPropW(hwnd, L"ROS_MSGBOX"); {
if(!mbi) mbi = (PMSGBOXINFO)GetPropW(hwnd, L"ROS_MSGBOX");
return 0; if (!mbi)
memcpy(&hi, (void *)lParam, sizeof(hi)); return 0;
hi.dwContextId = GetWindowContextHelpId(hwnd); memcpy(&hi, (void *)lParam, sizeof(hi));
hi.dwContextId = GetWindowContextHelpId(hwnd);
if (mbi->lpfnMsgBoxCallback) if (mbi->lpfnMsgBoxCallback)
mbi->lpfnMsgBoxCallback(&hi); mbi->lpfnMsgBoxCallback(&hi);
else else
{ {
owner = GetWindow(hwnd, GW_OWNER); owner = GetWindow(hwnd, GW_OWNER);
if(owner) if (owner)
SendMessageW(GetWindow(hwnd, GW_OWNER), WM_HELP, 0, (LPARAM)&hi); SendMessageW(GetWindow(hwnd, GW_OWNER), WM_HELP, 0, (LPARAM)&hi);
} }
return 0; return 0;
}
case WM_CLOSE: case WM_CLOSE:
mbi = (PMSGBOXINFO)GetPropW(hwnd, L"ROS_MSGBOX"); {
if(!mbi) mbi = (PMSGBOXINFO)GetPropW(hwnd, L"ROS_MSGBOX");
return 0; if (!mbi)
switch(mbi->dwStyle & MB_TYPEMASK) return 0;
{ switch (mbi->dwStyle & MB_TYPEMASK)
{
case MB_ABORTRETRYIGNORE: case MB_ABORTRETRYIGNORE:
case MB_YESNO: case MB_YESNO:
return 1; return 1;
} }
EndDialog(hwnd, IDCANCEL); EndDialog(hwnd, IDCANCEL);
return 1; return 1;
}
case WM_TIMER: case WM_TIMER:
if(wParam == 0) if (wParam == 0)
{ {
EndDialog(hwnd, 32000); EndDialog(hwnd, 32000);
} }
return 0; return 0;
} }
return 0; return 0;
} }
static int static int
MessageBoxTimeoutIndirectW( MessageBoxTimeoutIndirectW(
CONST MSGBOXPARAMSW *lpMsgBoxParams, UINT Timeout) CONST MSGBOXPARAMSW *lpMsgBoxParams, UINT Timeout)
{ {
DLGTEMPLATE *tpl; DLGTEMPLATE *tpl;
DLGITEMTEMPLATE *iico, *itxt; DLGITEMTEMPLATE *iico, *itxt;
@ -430,7 +437,7 @@ MessageBoxTimeoutIndirectW(
Buttons.btnCnt++; Buttons.btnCnt++;
} }
switch(lpMsgBoxParams->dwStyle & MB_ICONMASK) switch (lpMsgBoxParams->dwStyle & MB_ICONMASK)
{ {
case MB_ICONEXCLAMATION: case MB_ICONEXCLAMATION:
Icon = LoadIconW(0, IDI_EXCLAMATIONW); Icon = LoadIconW(0, IDI_EXCLAMATIONW);
@ -502,9 +509,9 @@ MessageBoxTimeoutIndirectW(
} }
buf = RtlAllocateHeap(GetProcessHeap(), 0, bufsize); buf = RtlAllocateHeap(GetProcessHeap(), 0, bufsize);
if(!buf) if (!buf)
{ {
return 0; return 0;
} }
iico = itxt = NULL; iico = itxt = NULL;
@ -516,10 +523,10 @@ MessageBoxTimeoutIndirectW(
tpl->style = WS_CAPTION | WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_SYSMENU | DS_CENTER | DS_MODALFRAME | DS_NOIDLEMSG; tpl->style = WS_CAPTION | WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_SYSMENU | DS_CENTER | DS_MODALFRAME | DS_NOIDLEMSG;
tpl->dwExtendedStyle = WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | WS_EX_CONTROLPARENT; tpl->dwExtendedStyle = WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | WS_EX_CONTROLPARENT;
if(lpMsgBoxParams->dwStyle & MB_TOPMOST) if (lpMsgBoxParams->dwStyle & MB_TOPMOST)
tpl->dwExtendedStyle |= WS_EX_TOPMOST; tpl->dwExtendedStyle |= WS_EX_TOPMOST;
if(lpMsgBoxParams->dwStyle & MB_RIGHT) if (lpMsgBoxParams->dwStyle & MB_RIGHT)
tpl->dwExtendedStyle |= WS_EX_RIGHT; tpl->dwExtendedStyle |= WS_EX_RIGHT;
tpl->x = 100; tpl->x = 100;
tpl->y = 100; tpl->y = 100;
tpl->cdit = Buttons.btnCnt + ((Icon != (HICON)0) ? 1 : 0) + 1; tpl->cdit = Buttons.btnCnt + ((Icon != (HICON)0) ? 1 : 0) + 1;
@ -535,35 +542,35 @@ MessageBoxTimeoutIndirectW(
dest += sizeof(WCHAR); dest += sizeof(WCHAR);
/* Create icon */ /* Create icon */
if(Icon) if (Icon)
{ {
dest = (BYTE*)(((ULONG_PTR)dest + 3) & ~3); dest = (BYTE*)(((ULONG_PTR)dest + 3) & ~3);
iico = (DLGITEMTEMPLATE *)dest; iico = (DLGITEMTEMPLATE *)dest;
iico->style = WS_CHILD | WS_VISIBLE | SS_ICON; iico->style = WS_CHILD | WS_VISIBLE | SS_ICON;
iico->dwExtendedStyle = 0; iico->dwExtendedStyle = 0;
iico->id = MSGBOX_IDICON; iico->id = MSGBOX_IDICON;
dest += sizeof(DLGITEMTEMPLATE); dest += sizeof(DLGITEMTEMPLATE);
*(WORD*)dest = 0xFFFF; *(WORD*)dest = 0xFFFF;
dest += sizeof(WORD); dest += sizeof(WORD);
*(WORD*)dest = 0x0082; /* static control */ *(WORD*)dest = 0x0082; /* static control */
dest += sizeof(WORD); dest += sizeof(WORD);
*(WORD*)dest = 0xFFFF; *(WORD*)dest = 0xFFFF;
dest += sizeof(WORD); dest += sizeof(WORD);
*(WCHAR*)dest = 0; *(WCHAR*)dest = 0;
dest += sizeof(WCHAR); dest += sizeof(WCHAR);
*(WORD*)dest = 0; *(WORD*)dest = 0;
dest += sizeof(WORD); dest += sizeof(WORD);
} }
/* create static for text */ /* create static for text */
dest = (BYTE*)(((UINT_PTR)dest + 3) & ~3); dest = (BYTE*)(((UINT_PTR)dest + 3) & ~3);
itxt = (DLGITEMTEMPLATE *)dest; itxt = (DLGITEMTEMPLATE *)dest;
itxt->style = WS_CHILD | WS_VISIBLE | SS_NOPREFIX; itxt->style = WS_CHILD | WS_VISIBLE | SS_NOPREFIX;
if(lpMsgBoxParams->dwStyle & MB_RIGHT) if (lpMsgBoxParams->dwStyle & MB_RIGHT)
itxt->style |= SS_RIGHT; itxt->style |= SS_RIGHT;
else else
itxt->style |= SS_LEFT; itxt->style |= SS_LEFT;
itxt->dwExtendedStyle = 0; itxt->dwExtendedStyle = 0;
itxt->id = MSGBOX_IDTEXT; itxt->id = MSGBOX_IDTEXT;
dest += sizeof(DLGITEMTEMPLATE); dest += sizeof(DLGITEMTEMPLATE);
@ -586,134 +593,136 @@ MessageBoxTimeoutIndirectW(
btnsize.cy = BTN_CY; btnsize.cy = BTN_CY;
btnrect.left = btnrect.top = 0; btnrect.left = btnrect.top = 0;
for(i = 0; i < Buttons.btnCnt; i++) for (i = 0; i < Buttons.btnCnt; i++)
{ {
dest = (BYTE*)(((UINT_PTR)dest + 3) & ~3); dest = (BYTE*)(((UINT_PTR)dest + 3) & ~3);
ibtn[i] = (DLGITEMTEMPLATE *)dest; ibtn[i] = (DLGITEMTEMPLATE *)dest;
ibtn[i]->style = WS_CHILD | WS_VISIBLE | WS_TABSTOP; ibtn[i]->style = WS_CHILD | WS_VISIBLE | WS_TABSTOP;
if(!defbtn && (i == ((lpMsgBoxParams->dwStyle & MB_DEFMASK) >> 8))) if (!defbtn && (i == ((lpMsgBoxParams->dwStyle & MB_DEFMASK) >> 8)))
{ {
ibtn[i]->style |= BS_DEFPUSHBUTTON; ibtn[i]->style |= BS_DEFPUSHBUTTON;
mbi.DefBtn = Buttons.btnIdx[i]; mbi.DefBtn = Buttons.btnIdx[i];
defbtn = TRUE; defbtn = TRUE;
} }
else else
ibtn[i]->style |= BS_PUSHBUTTON; {
ibtn[i]->dwExtendedStyle = 0; ibtn[i]->style |= BS_PUSHBUTTON;
ibtn[i]->id = Buttons.btnIdx[i]; }
dest += sizeof(DLGITEMTEMPLATE); ibtn[i]->dwExtendedStyle = 0;
*(WORD*)dest = 0xFFFF; ibtn[i]->id = Buttons.btnIdx[i];
dest += sizeof(WORD); dest += sizeof(DLGITEMTEMPLATE);
*(WORD*)dest = 0x0080; /* button control */ *(WORD*)dest = 0xFFFF;
dest += sizeof(WORD); dest += sizeof(WORD);
memcpy(dest, ButtonText[i], ButtonLen[i] * sizeof(WCHAR)); *(WORD*)dest = 0x0080; /* button control */
dest += ButtonLen[i] * sizeof(WCHAR); dest += sizeof(WORD);
*(WORD*)dest = 0; memcpy(dest, ButtonText[i], ButtonLen[i] * sizeof(WCHAR));
dest += sizeof(WORD); dest += ButtonLen[i] * sizeof(WCHAR);
*(WORD*)dest = 0; *(WORD*)dest = 0;
dest += sizeof(WORD); dest += sizeof(WORD);
*(WORD*)dest = 0;
dest += sizeof(WORD);
// btnrect.right = btnrect.bottom = 0; // FIXME: Is it needed?? // btnrect.right = btnrect.bottom = 0; // FIXME: Is it needed??
DrawTextW(hDC, ButtonText[i], ButtonLen[i], &btnrect, DT_LEFT | DT_SINGLELINE | DT_CALCRECT); DrawTextW(hDC, ButtonText[i], ButtonLen[i], &btnrect, DT_LEFT | DT_SINGLELINE | DT_CALCRECT);
btnsize.cx = max(btnsize.cx, btnrect.right); btnsize.cx = max(btnsize.cx, btnrect.right);
btnsize.cy = max(btnsize.cy, btnrect.bottom); btnsize.cy = max(btnsize.cy, btnrect.bottom);
} }
/* make first button the default button if no other is */ /* make first button the default button if no other is */
if(!defbtn) if (!defbtn)
{ {
ibtn[0]->style &= ~BS_PUSHBUTTON; ibtn[0]->style &= ~BS_PUSHBUTTON;
ibtn[0]->style |= BS_DEFPUSHBUTTON; ibtn[0]->style |= BS_DEFPUSHBUTTON;
mbi.DefBtn = Buttons.btnIdx[0]; mbi.DefBtn = Buttons.btnIdx[0];
} }
/* calculate position and size of controls */ /* calculate position and size of controls */
txtrect.right = GetSystemMetrics(SM_CXSCREEN) / 5 * 4; txtrect.right = GetSystemMetrics(SM_CXSCREEN) / 5 * 4;
if(Icon) if (Icon)
txtrect.right -= GetSystemMetrics(SM_CXICON) + MSGBOXEX_SPACING; txtrect.right -= GetSystemMetrics(SM_CXICON) + MSGBOXEX_SPACING;
txtrect.top = txtrect.left = txtrect.bottom = 0; txtrect.top = txtrect.left = txtrect.bottom = 0;
if (textlen != 0) if (textlen != 0)
{ {
DrawTextW(hDC, text, textlen, &txtrect, DT_LEFT | DT_NOPREFIX | DT_WORDBREAK | DT_CALCRECT); DrawTextW(hDC, text, textlen, &txtrect, DT_LEFT | DT_NOPREFIX | DT_WORDBREAK | DT_CALCRECT);
} }
else else
{ {
txtrect.right = txtrect.left + 1; txtrect.right = txtrect.left + 1;
txtrect.bottom = txtrect.top + 1; txtrect.bottom = txtrect.top + 1;
} }
txtrect.right++; txtrect.right++;
if(hDC) if (hDC)
DeleteDC(hDC); DeleteDC(hDC);
/* calculate position and size of the icon */ /* calculate position and size of the icon */
rc.left = rc.bottom = rc.right = 0; rc.left = rc.bottom = rc.right = 0;
btntop = 0; btntop = 0;
if(iico) if (iico)
{ {
rc.right = GetSystemMetrics(SM_CXICON); rc.right = GetSystemMetrics(SM_CXICON);
rc.bottom = GetSystemMetrics(SM_CYICON); rc.bottom = GetSystemMetrics(SM_CYICON);
#ifdef MSGBOX_ICONVCENTER #ifdef MSGBOX_ICONVCENTER
rc.top = MSGBOXEX_MARGIN + (max(txtrect.bottom, rc.bottom) / 2) - (GetSystemMetrics(SM_CYICON) / 2); rc.top = MSGBOXEX_MARGIN + (max(txtrect.bottom, rc.bottom) / 2) - (GetSystemMetrics(SM_CYICON) / 2);
rc.top = max(MSGBOXEX_SPACING, rc.top); rc.top = max(MSGBOXEX_SPACING, rc.top);
#else #else
rc.top = MSGBOXEX_MARGIN; rc.top = MSGBOXEX_MARGIN;
#endif #endif
btnleft = (Buttons.btnCnt * (btnsize.cx + MSGBOXEX_BUTTONSPACING)) - MSGBOXEX_BUTTONSPACING; btnleft = (Buttons.btnCnt * (btnsize.cx + MSGBOXEX_BUTTONSPACING)) - MSGBOXEX_BUTTONSPACING;
if(btnleft > txtrect.right + rc.right + MSGBOXEX_SPACING) if (btnleft > txtrect.right + rc.right + MSGBOXEX_SPACING)
{ {
#ifdef MSGBOX_TEXTHCENTER #ifdef MSGBOX_TEXTHCENTER
lmargin = MSGBOXEX_MARGIN + ((btnleft - txtrect.right - rc.right - MSGBOXEX_SPACING) / 2); lmargin = MSGBOXEX_MARGIN + ((btnleft - txtrect.right - rc.right - MSGBOXEX_SPACING) / 2);
#else #else
lmargin = MSGBOXEX_MARGIN; lmargin = MSGBOXEX_MARGIN;
#endif #endif
btnleft = MSGBOXEX_MARGIN; btnleft = MSGBOXEX_MARGIN;
} }
else else
{ {
lmargin = MSGBOXEX_MARGIN; lmargin = MSGBOXEX_MARGIN;
btnleft = MSGBOXEX_MARGIN + ((txtrect.right + rc.right + MSGBOXEX_SPACING) / 2) - (btnleft / 2); btnleft = MSGBOXEX_MARGIN + ((txtrect.right + rc.right + MSGBOXEX_SPACING) / 2) - (btnleft / 2);
} }
rc.left = lmargin; rc.left = lmargin;
iico->x = RESCALE_X(rc.left, units); iico->x = RESCALE_X(rc.left, units);
iico->y = RESCALE_Y(rc.top, units); iico->y = RESCALE_Y(rc.top, units);
iico->cx = RESCALE_X(rc.right, units); iico->cx = RESCALE_X(rc.right, units);
iico->cy = RESCALE_Y(rc.bottom, units); iico->cy = RESCALE_Y(rc.bottom, units);
btntop = rc.top + rc.bottom + MSGBOXEX_SPACING; btntop = rc.top + rc.bottom + MSGBOXEX_SPACING;
rc.left += rc.right + MSGBOXEX_SPACING; rc.left += rc.right + MSGBOXEX_SPACING;
} }
else else
{ {
btnleft = (Buttons.btnCnt * (btnsize.cx + MSGBOXEX_BUTTONSPACING)) - MSGBOXEX_BUTTONSPACING; btnleft = (Buttons.btnCnt * (btnsize.cx + MSGBOXEX_BUTTONSPACING)) - MSGBOXEX_BUTTONSPACING;
if(btnleft > txtrect.right) if (btnleft > txtrect.right)
{ {
#ifdef MSGBOX_TEXTHCENTER #ifdef MSGBOX_TEXTHCENTER
lmargin = MSGBOXEX_MARGIN + ((btnleft - txtrect.right) / 2); lmargin = MSGBOXEX_MARGIN + ((btnleft - txtrect.right) / 2);
#else #else
lmargin = MSGBOXEX_MARGIN; lmargin = MSGBOXEX_MARGIN;
#endif #endif
btnleft = MSGBOXEX_MARGIN; btnleft = MSGBOXEX_MARGIN;
} }
else else
{ {
lmargin = MSGBOXEX_MARGIN; lmargin = MSGBOXEX_MARGIN;
btnleft = MSGBOXEX_MARGIN + (txtrect.right / 2) - (btnleft / 2); btnleft = MSGBOXEX_MARGIN + (txtrect.right / 2) - (btnleft / 2);
} }
rc.left = lmargin; rc.left = lmargin;
} }
/* calculate position of the text */ /* calculate position of the text */
rc.top = MSGBOXEX_MARGIN + (rc.bottom / 2) - (txtrect.bottom / 2); rc.top = MSGBOXEX_MARGIN + (rc.bottom / 2) - (txtrect.bottom / 2);
rc.top = max(rc.top, MSGBOXEX_MARGIN); rc.top = max(rc.top, MSGBOXEX_MARGIN);
/* calculate position of the buttons */ /* calculate position of the buttons */
btntop = max(rc.top + txtrect.bottom + MSGBOXEX_SPACING, btntop); btntop = max(rc.top + txtrect.bottom + MSGBOXEX_SPACING, btntop);
for(i = 0; i < Buttons.btnCnt; i++) for (i = 0; i < Buttons.btnCnt; i++)
{ {
ibtn[i]->x = RESCALE_X(btnleft, units); ibtn[i]->x = RESCALE_X(btnleft, units);
ibtn[i]->y = RESCALE_Y(btntop, units); ibtn[i]->y = RESCALE_Y(btntop, units);
ibtn[i]->cx = RESCALE_X(btnsize.cx, units); ibtn[i]->cx = RESCALE_X(btnsize.cx, units);
ibtn[i]->cy = RESCALE_Y(btnsize.cy, units); ibtn[i]->cy = RESCALE_Y(btnsize.cy, units);
btnleft += btnsize.cx + MSGBOXEX_BUTTONSPACING; btnleft += btnsize.cx + MSGBOXEX_BUTTONSPACING;
} }
/* calculate size and position of the messagebox window */ /* calculate size and position of the messagebox window */
btnleft = max(btnleft - MSGBOXEX_BUTTONSPACING, rc.left + txtrect.right); btnleft = max(btnleft - MSGBOXEX_BUTTONSPACING, rc.left + txtrect.right);
@ -750,8 +759,8 @@ MessageBoxTimeoutIndirectW(
ret = DialogBoxIndirectParamW(lpMsgBoxParams->hInstance, tpl, lpMsgBoxParams->hwndOwner, ret = DialogBoxIndirectParamW(lpMsgBoxParams->hInstance, tpl, lpMsgBoxParams->hwndOwner,
MessageBoxProc, (LPARAM)&mbi); MessageBoxProc, (LPARAM)&mbi);
if(hFont) if (hFont)
DeleteObject(hFont); DeleteObject(hFont);
RtlFreeHeap(GetProcessHeap(), 0, buf); RtlFreeHeap(GetProcessHeap(), 0, buf);
return ret; return ret;
@ -766,10 +775,10 @@ MessageBoxTimeoutIndirectW(
int int
WINAPI WINAPI
MessageBoxA( MessageBoxA(
HWND hWnd, IN HWND hWnd,
LPCSTR lpText, IN LPCSTR lpText,
LPCSTR lpCaption, IN LPCSTR lpCaption,
UINT uType) IN UINT uType)
{ {
return MessageBoxExA(hWnd, lpText, lpCaption, uType, LANG_NEUTRAL); return MessageBoxExA(hWnd, lpText, lpCaption, uType, LANG_NEUTRAL);
} }
@ -781,11 +790,11 @@ MessageBoxA(
int int
WINAPI WINAPI
MessageBoxExA( MessageBoxExA(
HWND hWnd, IN HWND hWnd,
LPCSTR lpText, IN LPCSTR lpText,
LPCSTR lpCaption, IN LPCSTR lpCaption,
UINT uType, IN UINT uType,
WORD wLanguageId) IN WORD wLanguageId)
{ {
MSGBOXPARAMSA msgbox; MSGBOXPARAMSA msgbox;
@ -810,11 +819,11 @@ MessageBoxExA(
int int
WINAPI WINAPI
MessageBoxExW( MessageBoxExW(
HWND hWnd, IN HWND hWnd,
LPCWSTR lpText, IN LPCWSTR lpText,
LPCWSTR lpCaption, IN LPCWSTR lpCaption,
UINT uType, IN UINT uType,
WORD wLanguageId) IN WORD wLanguageId)
{ {
MSGBOXPARAMSW msgbox; MSGBOXPARAMSW msgbox;
@ -839,7 +848,7 @@ MessageBoxExW(
int int
WINAPI WINAPI
MessageBoxIndirectA( MessageBoxIndirectA(
CONST MSGBOXPARAMSA *lpMsgBoxParams) IN CONST MSGBOXPARAMSA* lpMsgBoxParams)
{ {
MSGBOXPARAMSW msgboxW; MSGBOXPARAMSW msgboxW;
UNICODE_STRING textW, captionW, iconW; UNICODE_STRING textW, captionW, iconW;
@ -869,7 +878,7 @@ MessageBoxIndirectA(
else else
captionW.Buffer = (LPWSTR)lpMsgBoxParams->lpszCaption; captionW.Buffer = (LPWSTR)lpMsgBoxParams->lpszCaption;
if(lpMsgBoxParams->dwStyle & MB_USERICON) if (lpMsgBoxParams->dwStyle & MB_USERICON)
{ {
if (!IS_INTRESOURCE(lpMsgBoxParams->lpszIcon)) if (!IS_INTRESOURCE(lpMsgBoxParams->lpszIcon))
{ {
@ -918,7 +927,7 @@ MessageBoxIndirectA(
int int
WINAPI WINAPI
MessageBoxIndirectW( MessageBoxIndirectW(
CONST MSGBOXPARAMSW *lpMsgBoxParams) IN CONST MSGBOXPARAMSW* lpMsgBoxParams)
{ {
return MessageBoxTimeoutIndirectW(lpMsgBoxParams, (UINT)-1); return MessageBoxTimeoutIndirectW(lpMsgBoxParams, (UINT)-1);
} }
@ -930,10 +939,10 @@ MessageBoxIndirectW(
int int
WINAPI WINAPI
MessageBoxW( MessageBoxW(
HWND hWnd, IN HWND hWnd,
LPCWSTR lpText, IN LPCWSTR lpText,
LPCWSTR lpCaption, IN LPCWSTR lpCaption,
UINT uType) IN UINT uType)
{ {
return MessageBoxExW(hWnd, lpText, lpCaption, uType, LANG_NEUTRAL); return MessageBoxExW(hWnd, lpText, lpCaption, uType, LANG_NEUTRAL);
} }
@ -944,12 +953,12 @@ MessageBoxW(
int int
WINAPI WINAPI
MessageBoxTimeoutA( MessageBoxTimeoutA(
HWND hWnd, IN HWND hWnd,
LPCSTR lpText, IN LPCSTR lpText,
LPCSTR lpCaption, IN LPCSTR lpCaption,
UINT uType, IN UINT uType,
WORD wLanguageId, IN WORD wLanguageId,
DWORD dwTime) IN DWORD dwTime)
{ {
MSGBOXPARAMSW msgboxW; MSGBOXPARAMSW msgboxW;
UNICODE_STRING textW, captionW; UNICODE_STRING textW, captionW;
@ -993,12 +1002,12 @@ MessageBoxTimeoutA(
int int
WINAPI WINAPI
MessageBoxTimeoutW( MessageBoxTimeoutW(
HWND hWnd, IN HWND hWnd,
LPCWSTR lpText, IN LPCWSTR lpText,
LPCWSTR lpCaption, IN LPCWSTR lpCaption,
UINT uType, IN UINT uType,
WORD wLanguageId, IN WORD wLanguageId,
DWORD dwTime) IN DWORD dwTime)
{ {
MSGBOXPARAMSW msgbox; MSGBOXPARAMSW msgbox;
@ -1034,7 +1043,7 @@ SoftModalMessageBox(DWORD Unknown0)
*/ */
BOOL BOOL
WINAPI WINAPI
MessageBeep(UINT uType) MessageBeep(IN UINT uType)
{ {
return NtUserxMessageBeep(uType); return NtUserxMessageBeep(uType);
} }
@ -1047,7 +1056,9 @@ MessageBeep(UINT uType)
* and: http://undoc.airesoft.co.uk/user32.dll/MB_GetString.php * and: http://undoc.airesoft.co.uk/user32.dll/MB_GetString.php
* for more information. * for more information.
*/ */
LPCWSTR WINAPI MB_GetString(UINT wBtn) LPCWSTR
WINAPI
MB_GetString(IN UINT wBtn)
{ {
LPCWSTR btnStr = NULL; LPCWSTR btnStr = NULL;