From: Vadim Zeitlin Date: Sun, 25 Jan 2009 18:10:24 +0000 (+0000) Subject: remove duplicated HitTest implementation from wxCheckListBox, it already inherits... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/0a03dc7a13b8654be11e20b7361ed2d692e7cbca remove duplicated HitTest implementation from wxCheckListBox, it already inherits wxListBox::HitTest() (which was however lacking an overload taking 2 coordinates, added now) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58406 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/listbox.h b/include/wx/listbox.h index 50d409c189..fa924a53c4 100644 --- a/include/wx/listbox.h +++ b/include/wx/listbox.h @@ -91,8 +91,10 @@ public: // event.GetExtraLong()) void Command(wxCommandEvent& event); - // returns the item number at a point or wxNOT_FOUND + // return the index of the item at this position or wxNOT_FOUND int HitTest(const wxPoint& point) const { return DoListHitTest(point); } + int HitTest(int x, int y) const { return DoListHitTest(wxPoint(x, y)); } + // For generating events in multiple and extended mode wxArrayInt m_oldSelections; diff --git a/include/wx/msw/checklst.h b/include/wx/msw/checklst.h index 25f75d3c81..4a9ab22815 100644 --- a/include/wx/msw/checklst.h +++ b/include/wx/msw/checklst.h @@ -64,10 +64,6 @@ public: virtual bool IsChecked(unsigned int uiIndex) const; virtual void Check(unsigned int uiIndex, bool bCheck = true); - // return the index of the item at this position or wxNOT_FOUND - int HitTest(const wxPoint& pt) const { return DoHitTestItem(pt.x, pt.y); } - int HitTest(wxCoord x, wxCoord y) const { return DoHitTestItem(x, y); } - // accessors size_t GetItemHeight() const { return m_nItemHeight; } @@ -77,9 +73,6 @@ public: virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item); protected: - // this can't be called DoHitTest() because wxWindow already has this method - int DoHitTestItem(wxCoord x, wxCoord y) const; - // pressing space or clicking the check box toggles the item void OnKeyDown(wxKeyEvent& event); void OnLeftClick(wxMouseEvent& event); diff --git a/interface/wx/listbox.h b/interface/wx/listbox.h index 275ec8d903..ea702f2381 100644 --- a/interface/wx/listbox.h +++ b/interface/wx/listbox.h @@ -171,6 +171,7 @@ public: */ virtual int GetSelections(wxArrayInt& selections) const; + //@{ /** Returns the item located at @a point, or @c wxNOT_FOUND if there is no item located at @a point. @@ -186,6 +187,8 @@ public: @since 2.7.0 */ int HitTest(const wxPoint& point) const; + int HitTest(int x, int y) const; + //@} /** Insert the given number of strings before the specified position. diff --git a/src/msw/checklst.cpp b/src/msw/checklst.cpp index fd480f4f70..99d72f3e89 100644 --- a/src/msw/checklst.cpp +++ b/src/msw/checklst.cpp @@ -508,20 +508,6 @@ void wxCheckListBox::OnLeftClick(wxMouseEvent& event) } } -int wxCheckListBox::DoHitTestItem(wxCoord x, wxCoord y) const -{ - int nItem = (int)::SendMessage - ( - (HWND)GetHWND(), - LB_ITEMFROMPOINT, - 0, - MAKELPARAM(x, y) - ); - - return nItem >= (int)m_noItems ? wxNOT_FOUND : nItem; -} - - wxSize wxCheckListBox::DoGetBestSize() const { wxSize best = wxListBox::DoGetBestSize(); @@ -530,4 +516,4 @@ wxSize wxCheckListBox::DoGetBestSize() const return best; } -#endif +#endif // wxUSE_CHECKLISTBOX