Exemplo n.º 1
0
void CWndAbout::Notify( TNotifyUI &msg )
{
	__super::Notify(msg);

	if (msg.sType == DUI_MSGTYPE_CLICK)
	{
		if (msg.pSender->GetName() == _T("btn_link"))
		{
			CButtonUI *pBtn = static_cast<CButtonUI*>(m_PaintManager.FindControl(_T("btn_link")));
			CDuiString strLink = pBtn->GetText();
			::ShellExecute(NULL, _T("open"), strLink.GetData(), NULL, NULL, SW_SHOWNORMAL);
		}
	}
}
Exemplo n.º 2
0
		int ShowMsgBox(HWND hwnd,
			LPCTSTR lpszText,
			LPCTSTR lpszCaption,
			UINT nType)
		{
			if(!IsWindow())
			{
				//	this->Create(hwnd,lpszCaption,UI_WNDSTYLE_DIALOG,UI_WNDSTYLE_EX_DIALOG);
				this->Create(hwnd,lpszCaption,UI_WNDSTYLE_DIALOG,0);
			}

			CenterWindow();

			CTextUI* pTitle       = static_cast<CTextUI*>(GetPaintMgr()->FindControl(_T("title")));
			CTextUI* pMsg         = static_cast<CTextUI*>(GetPaintMgr()->FindControl(_T("msg")));
			CButtonUI* pCancelBtn = static_cast<CButtonUI*>(GetPaintMgr()->FindControl(_T("cancel")));
			CButtonUI* pOkBtn     = static_cast<CButtonUI*>(GetPaintMgr()->FindControl(_T("yes")));
			CTabLayoutUI* pTable  = static_cast<CTabLayoutUI*>(GetPaintMgr()->FindControl(_T("icon")));
			CCheckBoxUI* pCheckBox= static_cast<CCheckBoxUI*>(GetPaintMgr()->FindControl(_T("checkbox")));

			ASSERT(pTitle);
			ASSERT(pMsg);
			ASSERT(pCancelBtn);
			ASSERT(pOkBtn);
			ASSERT(pTable);
			ASSERT(pCheckBox);

			if(pTitle) pTitle->SetText((lpszCaption ? lpszCaption : _T("")));
			if(pMsg)   pMsg->SetText((lpszText ? lpszText : _T("")));
			if(pCancelBtn) pCancelBtn->SetFocus();

			if(pTable)
			{
				if(nType & MBT_INFO)
					pTable->SelectItem(0);
				else if(nType & MBT_OK)
					pTable->SelectItem(1);
				else if(nType & MBT_WARN)
					pTable->SelectItem(2);
			}

			const bool isShowCancel   = (pCancelBtn && ((nType & MBBT_CANCEL) > 0));
			const bool isShowOk       = (pOkBtn && ((nType & MBBT_OK) > 0));
			const bool isShowCheckBox = (pCheckBox &&((nType & MBBT_CHECKBOX) > 0));
			const bool isShake = ((nType & MBT_SHAKE) > 0);
			_bShakeWindow = isShake;

			pCancelBtn->SetVisible(isShowCancel);
			pOkBtn->SetVisible(isShowOk);
			pCheckBox->SetVisible((/*isShowOk && */isShowCheckBox));
		
			if(!isShowCancel && isShowOk)
			{
				pCancelBtn->SetVisible(true);
				pOkBtn->SetVisible(false);
				pCancelBtn->SetName(pOkBtn->GetName());
				pCancelBtn->SetText(pOkBtn->GetText());
				pCancelBtn->SetToolTip(pOkBtn->GetToolTip());
				pCancelBtn->SetFocus();
			}
			return ShowModal();
		}