diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2007-08-27 04:00:00 +0400 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:15:54 +0300 |
commit | 051769bbc577aeede90558b6ab5c9be187940ca0 (patch) | |
tree | e6330cb80f2d4a526d8aa27812528e053b0cda90 /CPP/7zip/UI/FileManager/MessagesDialog.cpp | |
parent | 33ccab7e728a996800e166d849fe1e92a17e1afe (diff) |
4.53 beta
Diffstat (limited to 'CPP/7zip/UI/FileManager/MessagesDialog.cpp')
-rwxr-xr-x | CPP/7zip/UI/FileManager/MessagesDialog.cpp | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/CPP/7zip/UI/FileManager/MessagesDialog.cpp b/CPP/7zip/UI/FileManager/MessagesDialog.cpp new file mode 100755 index 00000000..57879d64 --- /dev/null +++ b/CPP/7zip/UI/FileManager/MessagesDialog.cpp @@ -0,0 +1,100 @@ +// MessagesDialog.cpp + +#include "StdAfx.h" +#include "MessagesDialog.h" +#include "Common/StringConvert.h" +#include "Common/IntToString.h" +#include "Windows/ResourceString.h" + +#ifdef LANG +#include "LangUtils.h" +#endif + +using namespace NWindows; + +#ifdef LANG +static CIDLangPair kIDLangPairs[] = +{ + { IDOK, 0x02000713 } +}; +#endif + +void CMessagesDialog::AddMessageDirect(LPCWSTR message) +{ + int itemIndex = _messageList.GetItemCount(); + LVITEMW item; + item.mask = LVIF_TEXT; + item.iItem = itemIndex; + + wchar_t sz[32]; + ConvertInt64ToString(itemIndex, sz); + + item.pszText = sz; + item.iSubItem = 0; + _messageList.InsertItem(&item); + + item.pszText = (LPWSTR)message; + item.iSubItem = 1; + _messageList.SetItem(&item); +} + +void CMessagesDialog::AddMessage(LPCWSTR message) +{ + UString s = message; + while (!s.IsEmpty()) + { + int pos = s.Find(L'\n'); + if (pos < 0) + break; + AddMessageDirect(s.Left(pos)); + s.Delete(0, pos + 1); + } + AddMessageDirect(s); +} + +bool CMessagesDialog::OnInit() +{ + #ifdef LANG + LangSetWindowText(HWND(*this), 0x02000A00); + LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0])); + #endif + _messageList.Attach(GetItem(IDC_MESSAGE_LIST)); + _messageList.SetUnicodeFormat(true); + + LVCOLUMNW columnInfo; + columnInfo.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; + columnInfo.fmt = LVCFMT_LEFT; + columnInfo.pszText = L"#"; + columnInfo.iSubItem = 0; + columnInfo.cx = 30; + + _messageList.InsertColumn(0, &columnInfo); + + + columnInfo.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; + columnInfo.fmt = LVCFMT_LEFT; + UString s = + #ifdef LANG + LangString(IDS_MESSAGES_DIALOG_MESSAGE_COLUMN, 0x02000A80); + #else + MyLoadStringW(IDS_MESSAGES_DIALOG_MESSAGE_COLUMN); + #endif + + columnInfo.pszText = (LPWSTR)(LPCWSTR)s; + columnInfo.iSubItem = 1; + columnInfo.cx = 600; + + _messageList.InsertColumn(1, &columnInfo); + + for(int i = 0; i < Messages->Size(); i++) + AddMessage((*Messages)[i]); + + /* + if(_messageList.GetItemCount() > 0) + { + UINT aState = LVIS_SELECTED | LVIS_FOCUSED; + _messageList.SetItemState(0, aState, aState); + } + */ + return CModalDialog::OnInit(); +} |