#include "stdafx.h" #include "DlgNotifyModal.h"
#define NOTIFY_TYPE_1BTN 1 #define NOTIFY_TYPE_2BTN 2
CDlgNotifyModal::CDlgNotifyModal() :SHostDialog(_T("layout:xml_notify")) { }
CDlgNotifyModal::CDlgNotifyModal(SStringT xmlName) : SHostDialog(xmlName) {
}
CDlgNotifyModal::~CDlgNotifyModal() { }
void CDlgNotifyModal::OnClose() { EndDialog(IDOK); }
void CDlgNotifyModal::OnBtnConfirm() { EndDialog(IDOK); }
void CDlgNotifyModal::OnBtnLater() { EndDialog(IDCANCEL); }
void CDlgNotifyModal::setDisplayType(const int type, const wstring strInfo, const wstring strVer) { SStatic* txt = nullptr; if (false == strInfo.empty()) { txt = (SStatic*)FindChildByName(L"txt_info"); txt->SetWindowTextW(strInfo.c_str()); } if (false == strVer.empty()) { txt = (SStatic*)FindChildByName(L"txt_ver"); txt->SetWindowTextW(strVer.c_str()); txt->SetVisible(TRUE); } else { txt = (SStatic*)FindChildByName(L"txt_ver"); txt->SetVisible(FALSE); }
if (NOTIFY_TYPE_1BTN == type) { SImageButton* pBtn = (SImageButton*)FindChildByName(L"btn_confirm"); if (pBtn) { pBtn->Move(112, 136, 192, 32); pBtn->SetWindowTextW(m_btn1Text.c_str()); } pBtn = (SImageButton*)FindChildByName(L"btn_later"); pBtn->SetVisible(FALSE); } else if (NOTIFY_TYPE_2BTN == type) { SImageButton* pBtn = (SImageButton*)FindChildByName(L"btn_confirm"); pBtn->Move(208, 136, 128, 32); pBtn->SetWindowTextW(m_btn1Text.c_str());
pBtn = (SImageButton*)FindChildByName(L"btn_later"); pBtn->Move(72, 136, 128, 32); pBtn->SetWindowTextW(m_btn2Text.c_str()); pBtn->SetVisible(TRUE); }
::SetWindowPos(m_hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); }
void CDlgNotifyModal::OnShowWindow(BOOL bShow, UINT nStatus) { setDisplayType(m_btnCount, m_strTips, m_strVer); }
|