X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4a10ea8b13fd0851e71e6fa5ebbe5b93933be11e..443e2f09a5f5295bfbb25459956d806ecc5c2e7f:/src/msw/listbox.cpp?ds=sidebyside diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index 71cc9a44a0..7abbf18e2b 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -552,6 +552,16 @@ wxListBox::DoInsertItems(const wxArrayString& items, int pos) InvalidateBestSize(); } +int wxListBox::DoListHitTest(const wxPoint& point) const +{ + LRESULT lRes = ::SendMessage(GetHwnd(), LB_ITEMFROMPOINT, + 0L, MAKELONG(point.x, point.y)); + + // non zero high-order word means that this item is outside of the client + // area, IOW the point is outside of the listbox + return HIWORD(lRes) ? wxNOT_FOUND : lRes; +} + void wxListBox::SetString(int N, const wxString& s) { wxCHECK_RET( N >= 0 && N < m_noItems, @@ -776,16 +786,19 @@ bool wxListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item) HDC hdc = CreateIC(wxT("DISPLAY"), NULL, NULL, 0); #endif - wxDC dc; - dc.SetHDC((WXHDC)hdc); - dc.SetFont(GetFont()); - - pStruct->itemHeight = dc.GetCharHeight() + 2*OWNER_DRAWN_LISTBOX_EXTRA_SPACE; - pStruct->itemWidth = dc.GetCharWidth(); + { + wxDCTemp dc((WXHDC)hdc); + dc.SetFont(GetFont()); - dc.SetHDC(0); + pStruct->itemHeight = dc.GetCharHeight() + 2*OWNER_DRAWN_LISTBOX_EXTRA_SPACE; + pStruct->itemWidth = dc.GetCharWidth(); + } +#ifdef __WXWINCE__ + ReleaseDC(NULL, hdc); +#else DeleteDC(hdc); +#endif return true; }