X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/851b88c310ac064e826dfd011d02c6dc5301fc35..f09df8b2ea9a005117997c020ab222736805c5d4:/src/generic/listbkg.cpp diff --git a/src/generic/listbkg.cpp b/src/generic/listbkg.cpp index f096095e55..b21319248a 100644 --- a/src/generic/listbkg.cpp +++ b/src/generic/listbkg.cpp @@ -161,22 +161,41 @@ void wxListbook::OnSize(wxSizeEvent& event) wxBookCtrlBase::OnSize(event); } -int wxListbook::HitTest(const wxPoint& pt, long * WXUNUSED(flags)) const +int wxListbook::HitTest(const wxPoint& pt, long *flags) const { int pagePos = wxNOT_FOUND; - const wxPoint clientPt = ClientToScreen(GetListView()->ScreenToClient(pt)); + if ( flags ) + *flags = wxBK_HITTEST_NOWHERE; - if ( wxRect(GetListView()->GetSize()).Inside(clientPt) ) + // convert from listbook control coordinates to list control coordinates + const wxListView * const list = GetListView(); + const wxPoint listPt = list->ScreenToClient(ClientToScreen(pt)); + + // is the point inside list control? + if ( wxRect(list->GetSize()).Contains(listPt) ) { int flagsList; - pagePos = GetListView()->HitTest(clientPt, flagsList); + pagePos = list->HitTest(listPt, flagsList); - if ( !(flagsList & wxLIST_HITTEST_ONITEM) ) + if ( flags ) { - pagePos = wxNOT_FOUND; + if ( pagePos != wxNOT_FOUND ) + *flags = 0; + + if ( flagsList & (wxLIST_HITTEST_ONITEMICON | + wxLIST_HITTEST_ONITEMSTATEICON ) ) + *flags |= wxBK_HITTEST_ONICON; + + if ( flagsList & wxLIST_HITTEST_ONITEMLABEL ) + *flags |= wxBK_HITTEST_ONLABEL; } } + else // not over list control at all + { + if ( flags && GetPageRect().Contains(pt) ) + *flags |= wxBK_HITTEST_ONPAGE; + } return pagePos; }