| 155 | } |
| 156 | |
| 157 | BOOL SMessageBoxImpl::OnInitDialog( HWND wnd, LPARAM lInitParam ) |
| 158 | { |
| 159 | pugi::xml_node uiRoot=GetMsgTemplate(); |
| 160 | |
| 161 | InitFromXml(uiRoot); |
| 162 | |
| 163 | UINT uType = s_MsgBoxInfo.uType&0x0F; |
| 164 | |
| 165 | STabCtrl *pBtnSwitch= FindChildByName2<STabCtrl>(NAME_MSGBOX_BTNSWITCH); |
| 166 | SASSERT(pBtnSwitch); |
| 167 | pBtnSwitch->SetCurSel(g_msgBtnText[uType].nBtns-1); |
| 168 | SWindow *pBtnPanel=pBtnSwitch->GetItem(g_msgBtnText[uType].nBtns-1); |
| 169 | SASSERT(pBtnPanel); |
| 170 | |
| 171 | pugi::xml_node nodeBtnTxt = GetMsgTemplate().child(L"buttonText"); |
| 172 | for(int i=0; i<g_msgBtnText[uType].nBtns; i++) |
| 173 | { |
| 174 | SWindow *pBtn=pBtnPanel->FindChildByName(g_wcsNameOfBtns[i]); |
| 175 | int nID = g_msgBtnText[uType].btnInfo[i].uBtnID; |
| 176 | pBtn->SetID(nID); |
| 177 | |
| 178 | SStringT strText = OnGetButtonText(nID); |
| 179 | if(strText.IsEmpty()) |
| 180 | { |
| 181 | SStringW strBtnText = g_msgBtnText[uType].btnInfo[i].szText; |
| 182 | //先从模板中的buttonText节点里查按钮的文字 |
| 183 | pugi::xml_node nodeTxt = nodeBtnTxt.child(strBtnText); |
| 184 | if(nodeTxt) |
| 185 | { |
| 186 | strBtnText=nodeTxt.text().get(); |
| 187 | strBtnText.TrimBlank(); |
| 188 | strBtnText = GETSTRING(strBtnText); |
| 189 | } |
| 190 | //从翻译引擎中翻译 |
| 191 | strText = S_CW2T(tr(strBtnText)); |
| 192 | } |
| 193 | pBtn->SetWindowText(strText); |
| 194 | } |
| 195 | |
| 196 | SStringW strMinSize = uiRoot.attribute(L"minSize").value(); |
| 197 | SStringWList lstMinSize ; |
| 198 | SplitString(strMinSize,L',',lstMinSize); |
| 199 | SASSERT(lstMinSize.GetCount()==2); |
| 200 | SLayoutSize szMin[2]={SLayoutSize::fromString(lstMinSize[0]),SLayoutSize::fromString(lstMinSize[1])}; |
| 201 | |
| 202 | SWindow * pTitle= FindChildByName(NAME_MSGBOX_TITLE); |
| 203 | SASSERT(pTitle); |
| 204 | SStringT strTitle = pTitle->GetWindowText(); |
| 205 | if (s_MsgBoxInfo.pszCaption) strTitle = s_MsgBoxInfo.pszCaption; |
| 206 | pTitle->SetWindowText(S_CW2T(TR(S_CT2W(strTitle),GetTranslatorContext()))); |
| 207 | |
| 208 | SWindow * pMsg= FindChildByName(NAME_MSGBOX_TEXT); |
| 209 | SASSERT(pMsg); |
| 210 | pMsg->SetWindowText(S_CW2T(TR(S_CT2W(s_MsgBoxInfo.pszText),GetTranslatorContext()))); |
| 211 | |
| 212 | OnSetIcon(s_MsgBoxInfo.uType); |
| 213 | UpdateLayout(); |
| 214 |
nothing calls this directly
no test coverage detected