X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fa17ced1b55a0dd89e7bead4905248d33e879bd4..f0b1ccde63c1acd9ca18847f758603f39f22cf4b:/src/msw/listctrl.cpp diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 3c9adee638..98df698331 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -318,7 +318,7 @@ bool wxListCtrl::Create(wxWindow *parent, const wxPoint& pos, const wxSize& size, long style, - const wxValidator& validator, + const wxValidator& wxVALIDATOR_PARAM(validator), const wxString& name) { #if wxUSE_VALIDATORS @@ -390,6 +390,12 @@ bool wxListCtrl::DoCreateControl(int x, int y, int w, int h) return FALSE; } + // explicitly say that we want to use Unicode because otherwise we get ANSI + // versions of _some_ messages (notably LVN_GETDISPINFOA) in MSLU build +#if wxUSE_UNICODE + ::SendMessage(GetHwnd(), LVM_SETUNICODEFORMAT, TRUE, 0); +#endif + // for comctl32.dll v 4.70+ we want to have this attribute because it's // prettier (and also because wxGTK does it like this) if ( (wstyle & LVS_REPORT) && wxTheApp->GetComCtl32Version() >= 470 ) @@ -1026,6 +1032,25 @@ bool wxListCtrl::SetItemData(long item, long data) return SetItem(info); } +wxRect wxListCtrl::GetViewRect() const +{ + wxASSERT_MSG( !HasFlag(wxLC_REPORT | wxLC_LIST), + _T("wxListCtrl::GetViewRect() only works in icon mode") ); + + RECT rc; + if ( !ListView_GetViewRect(GetHwnd(), &rc) ) + { + wxLogDebug(_T("ListView_GetViewRect() failed.")); + + wxZeroMemory(rc); + } + + wxRect rect; + wxCopyRECTToRect(rc, rect); + + return rect; +} + // Gets the item rectangle bool wxListCtrl::GetItemRect(long item, wxRect& rect, int code) const { @@ -1078,9 +1103,13 @@ int wxListCtrl::GetItemCount() const return m_count; } -// Retrieves the spacing between icons in pixels. -// If small is TRUE, gets the spacing for the small icon -// view, otherwise the large icon view. +wxSize wxListCtrl::GetItemSpacing() const +{ + const int spacing = GetItemSpacing(HasFlag(wxLC_SMALL_ICON)); + + return wxSize(LOWORD(spacing), HIWORD(spacing)); +} + int wxListCtrl::GetItemSpacing(bool isSmall) const { return ListView_GetItemSpacing(GetHwnd(), (BOOL) isSmall); @@ -2145,10 +2174,6 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) } break; - // when using MSLU we get ANSI messages sometimes, apparently -#if wxUSE_UNICODE_MSLU - case LVN_GETDISPINFOA: -#endif // wxUSE_UNICODE_MSLU case LVN_GETDISPINFO: if ( IsVirtual() ) { @@ -2160,29 +2185,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) if ( lvi.mask & LVIF_TEXT ) { wxString text = OnGetItemText(item, lvi.iSubItem); -#if wxUSE_UNICODE_MSLU - if ( nmhdr->code == LVN_GETDISPINFOA ) - { - if ( !::WideCharToMultiByte - ( - CP_ACP, - 0, // no flags - text, - text.length() + 1, - (char *)lvi.pszText, - lvi.cchTextMax, - NULL, // default character - NULL // [out] def char used flag - ) ) - { - wxLogLastError(_T("WideCharToMultiByte()")); - } - } - else -#endif // wxUSE_UNICODE_MSLU - { - wxStrncpy(lvi.pszText, text, lvi.cchTextMax); - } + wxStrncpy(lvi.pszText, text, lvi.cchTextMax); } // see comment at the end of wxListCtrl::GetColumn()