Beispiel #1
0
UINT_PTR CBkSafeMsgBox::ShowPanelMsg( LPCWSTR lpszXml, LPCRECT lpRect
									 , LPCWSTR lpszCaption /*= NULL*/, UINT uType /*= MB_OK*/, BOOL *pbNoNotifyLater /*= NULL*/, HWND hWndParent /*= NULL */ )
{
	ATLASSERT(lpRect);
	if (!lpRect || !Load(IDR_BK_MESSAGEBOX))
		return -1;
	
	m_isTextXml = TRUE;
	m_rcXml = *lpRect;
	m_uType = uType;
	SetItemVisible(60016, TRUE);
	SetItemVisible(IDC_LBL_MSGBOX_TEXT, FALSE);
	SetPanelXml(60016, CT2CA(lpszXml, CP_UTF8));
	if (lpszCaption)
	{
		m_strCaption    = lpszCaption;
		SetWindowCaption(m_strCaption);
		SetItemText(IDC_LBL_MSGBOX_TITLE, lpszCaption);
	}
	_InitLayout(pbNoNotifyLater);

	UINT_PTR nRet = DoModal(hWndParent);
	if (pbNoNotifyLater)
		*pbNoNotifyLater = m_bNoNotifyLater;

	return nRet;
}
void KEditDialogImpl::_RedrawAttrute()
{
    CStringA    strNowXml("<text></text>");
    BOOL        bBtnVisible = FALSE;

    if (m_pNowComp != NULL)
    {
        m_pNowComp->DrawAttrute(strNowXml);

        SetPanelXml(ATTR_OPERATE, strNowXml.GetString());

        m_pNowComp->InitAttrute(m_kEdit);

        bBtnVisible = TRUE;
    }
    else
    {
        SetPanelXml(ATTR_OPERATE, strNowXml.GetString());
    }

    SetItemVisible(SUBMIT_BUTTION, bBtnVisible);
    SetItemVisible(DELETE_BUTTION, bBtnVisible);
}
void KEditDialogImpl::_RedrawComponent()
{
    CStringA    strPreXml;
    CStringA    strNowXml("<text></text>");

    for (size_t i = 0; i < m_vecComp.size(); ++i)
    {
        m_vecComp[i]->DrawComponent(strPreXml);
        strNowXml.Append(strPreXml);
    }

    _DrawSelRect(strNowXml);

    SetPanelXml(MAIN_OPERATE, strNowXml.GetString());
}
Beispiel #4
0
void CBkSafeMsgBox::_InitLayout( BOOL * pbNoNotifyLater )
{
	CString strButtonXmlFormat, strButtons, strButtonDiv;

	_MakeButtons();

	strButtonXmlFormat = BkString::Get(IDS_MSGBOX_BUTTON_XML);

#   define BUTTON_SPACING 20
	UINT uWidth = 0, uLeft = 0;
	POSITION pos = m_lstButton.GetHeadPosition();


	while (pos)
	{
		const __BKMBButton &btn = m_lstButton.GetNext(pos);

		uWidth += btn.uWidth;
		if (pos)
			uWidth += BUTTON_SPACING;
	}

	pos = m_lstButton.GetHeadPosition();

	while (pos)
	{
		const __BKMBButton &btn = m_lstButton.GetNext(pos);

		strButtons.AppendFormat(strButtonXmlFormat, btn.uCmdID, uLeft, uLeft + btn.uWidth, btn.strText);

		uLeft += btn.uWidth + BUTTON_SPACING;
	}

	strButtonDiv.Format(BkString::Get(IDS_MSGBOX_BUTTON_DIV), uWidth / 2, uWidth / 2, strButtons);
	SetPanelXml(IDC_DIV_MSGBOX_BUTTONS, CT2A(strButtonDiv, CP_UTF8));

	DWORD dwIconID = 0;

	if (0 != (MB_ICONMASK & m_uType))
	{
		switch (MB_ICONMASK & m_uType)
		{
		case MB_ICONHAND:
			dwIconID = (DWORD)(DWORD_PTR)IDI_HAND;
			break;
		case MB_ICONQUESTION:
			dwIconID = (DWORD)(DWORD_PTR)IDI_QUESTION;
			break;
		case MB_ICONEXCLAMATION:
			dwIconID = (DWORD)(DWORD_PTR)IDI_EXCLAMATION;
			break;
		case MB_ICONASTERISK:
			dwIconID = (DWORD)(DWORD_PTR)IDI_ASTERISK;
			break;
		default:
            SetItemDWordAttribute(IDC_ICON_MSGBOX_ICON, "src", dwIconID);
            SetItemDWordAttribute(IDC_ICON_MSGBOX_ICON, "oem", 0);
		}

		if (0 != dwIconID)
			SetItemDWordAttribute(IDC_ICON_MSGBOX_ICON, "src", dwIconID);
	}

	if (0 == dwIconID)
		SetItemVisible(IDC_ICON_MSGBOX_ICON, FALSE);

	if (NULL == pbNoNotifyLater)
		SetItemVisible(IDC_CHK_MSGBOX_NONOTIFYLATER, FALSE);
	else
		m_bShowNoNotifyLater = TRUE;
}
Beispiel #5
0
void CKuiMsgBox::_InitLayout( BOOL * pbNoNotifyLater )
{
	CString strButtonXmlFormat, strButtons, strButtonDiv;
    CString strButtonEx = "<dlg pos=\"0,0,-0,-0\">";
    KAppRes& appRes = KAppRes::Instance();
    BOOL fUseButtonEx = FALSE;

	_MakeButtons();

	strButtonXmlFormat = appRes.GetString("IDS_MSGBOX_BUTTON_XML");

    POSITION pos = m_lstButtonEx.GetHeadPosition();
    while (pos)
    {
        const __BKMBButtonEx &btn = m_lstButtonEx.GetNext(pos);
        CString strBtn;
        strBtn.Format(
            _T("<button id=%d pos=\"%s\" class=normalbtn>%s</button>"),
            btn.uCmdID,
            btn.strPos,
            btn.strText
            );
        strButtonEx += strBtn;
        fUseButtonEx = TRUE;
    }

#   define BUTTON_SPACING 20
	UINT uWidth = 0, uLeft = 0;
	pos = m_lstButton.GetHeadPosition();


	while (pos)
	{
		const __BKMBButton &btn = m_lstButton.GetNext(pos);

		uWidth += btn.uWidth;
		if (pos)
			uWidth += BUTTON_SPACING;
	}

	pos = m_lstButton.GetHeadPosition();

	while (pos)
	{
		const __BKMBButton &btn = m_lstButton.GetNext(pos);

		strButtons.AppendFormat(strButtonXmlFormat, btn.uCmdID, uLeft, uLeft + btn.uWidth, btn.strText);

		uLeft += btn.uWidth + BUTTON_SPACING;
	}

    if (!fUseButtonEx)
    {
        strButtonDiv.Format(appRes.GetString("IDS_MSGBOX_BUTTON_DIV"), uWidth / 2, uWidth / 2, strButtons);
        SetPanelXml(IDC_DIV_MSGBOX_BUTTONS, CT2A(strButtonDiv, CP_UTF8));
        SetItemVisible(IDC_DIV_MSGBOX_BUTTONS+1, FALSE);
    }
    else
    {
        strButtonEx += "</dlg>";
        SetPanelXml(IDC_DIV_MSGBOX_BUTTONS+1, CT2A(strButtonEx, CP_UTF8));
        SetItemVisible(IDC_DIV_MSGBOX_BUTTONS, FALSE);
    }

	CString strIconID;

	if (0 != (MB_ICONMASK & m_uType))
	{
		switch (MB_ICONMASK & m_uType)
		{
		case MB_ICONHAND:
			strIconID = _T("IDI_HAND");
			break;
		case MB_ICONQUESTION:
			strIconID = _T("IDI_QUESTION");
			break;
		case MB_ICONEXCLAMATION:
			strIconID = _T("IDI_EXCLAMATION");
			break;
		case MB_ICONASTERISK:
			strIconID = _T("IDI_ASTERISK");
			break;
		default:
            SetItemStringAttribute(IDC_ICON_MSGBOX_ICON, "src", strIconID);
            SetItemDWordAttribute(IDC_ICON_MSGBOX_ICON, "oem", 0);
		}

		if (strIconID.GetLength())
			SetItemStringAttribute(IDC_ICON_MSGBOX_ICON, "src", strIconID);
	}

	if (0 == strIconID.GetLength())
		SetItemVisible(IDC_ICON_MSGBOX_ICON, FALSE);

	if (NULL == pbNoNotifyLater)
		SetItemVisible(IDC_CHK_MSGBOX_NONOTIFYLATER, FALSE);
	else
		m_bShowNoNotifyLater = TRUE;
}