void CJS_Object::Alert(CJS_Context* pContext, const FX_WCHAR* swMsg) { ASSERT(pContext != NULL); if (pContext->IsMsgBoxEnabled()) { CPDFDoc_Environment* pApp = pContext->GetReaderApp(); if (pApp) pApp->JS_appAlert(swMsg, NULL, 0, 3); } }
int32_t CPDFXFA_App::MsgBox(const CFX_WideStringC& wsMessage, const CFX_WideStringC& wsTitle, FX_DWORD dwIconType, FX_DWORD dwButtonType) { CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); if (!pEnv) return -1; FX_DWORD iconType = 0; int iButtonType = 0; switch (dwIconType) { case XFA_MBICON_Error: iconType |= 0; break; case XFA_MBICON_Warning: iconType |= 1; break; case XFA_MBICON_Question: iconType |= 2; break; case XFA_MBICON_Status: iconType |= 3; break; } switch (dwButtonType) { case XFA_MB_OK: iButtonType |= 0; break; case XFA_MB_OKCancel: iButtonType |= 1; break; case XFA_MB_YesNo: iButtonType |= 2; break; case XFA_MB_YesNoCancel: iButtonType |= 3; break; } int32_t iRet = pEnv->JS_appAlert(wsMessage.GetPtr(), wsTitle.GetPtr(), iButtonType, iconType); switch (iRet) { case 1: return XFA_IDOK; case 2: return XFA_IDCancel; case 3: return XFA_IDNo; case 4: return XFA_IDYes; } return XFA_IDYes; }