From be0e5d699f3681f291340f1e4d107a2348b40136 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 14 Jun 2006 12:00:57 +0000 Subject: [PATCH] made wxTree/ListCtrl::HitTest() const git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39716 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/listctrl.tex | 2 +- docs/latex/wx/treectrl.tex | 2 +- include/wx/generic/listctrl.h | 2 +- include/wx/generic/treectlg.h | 2 +- include/wx/msw/listctrl.h | 2 +- include/wx/msw/treectrl.h | 2 +- include/wx/treectrl.h | 7 ++++--- src/generic/listctrl.cpp | 6 +++--- src/generic/treectlg.cpp | 6 ++---- src/msw/listctrl.cpp | 3 ++- src/msw/treectrl.cpp | 2 +- 11 files changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/latex/wx/listctrl.tex b/docs/latex/wx/listctrl.tex index b9201706ef..05aa3c6578 100644 --- a/docs/latex/wx/listctrl.tex +++ b/docs/latex/wx/listctrl.tex @@ -573,7 +573,7 @@ list or report views (this is a limitation of the native Win32 control). \membersection{wxListCtrl::HitTest}\label{wxlistctrlhittest} -\func{long}{HitTest}{\param{const wxPoint\& }{point}, \param{int\& }{flags}, \param{long *}{ptrSubItem}} +\constfunc{long}{HitTest}{\param{const wxPoint\& }{point}, \param{int\& }{flags}, \param{long *}{ptrSubItem}} Determines which item (if any) is at the specified point, giving details in {\it flags}. Returns index of the item or {\tt wxNOT\_FOUND} diff --git a/docs/latex/wx/treectrl.tex b/docs/latex/wx/treectrl.tex index 0c25fccc32..89f240e011 100644 --- a/docs/latex/wx/treectrl.tex +++ b/docs/latex/wx/treectrl.tex @@ -657,7 +657,7 @@ Returns the state image list (from which application-defined state images are ta \membersection{wxTreeCtrl::HitTest}\label{wxtreectrlhittest} -\func{wxTreeItemId}{HitTest}{\param{const wxPoint\& }{point}, \param{int\& }{flags}} +\constfunc{wxTreeItemId}{HitTest}{\param{const wxPoint\& }{point}, \param{int\& }{flags}} Calculates which (if any) item is under the given point, returning the tree item id at this point plus extra information {\it flags}. {\it flags} is a bitlist of the following: diff --git a/include/wx/generic/listctrl.h b/include/wx/generic/listctrl.h index 6d04d813d0..0224f03c14 100644 --- a/include/wx/generic/listctrl.h +++ b/include/wx/generic/listctrl.h @@ -149,7 +149,7 @@ public: long FindItem( long start, const wxString& str, bool partial = false ); long FindItem( long start, wxUIntPtr data ); long FindItem( long start, const wxPoint& pt, int direction ); // not supported in wxGLC - long HitTest( const wxPoint& point, int& flags, long *pSubItem = NULL ); + long HitTest( const wxPoint& point, int& flags, long *pSubItem = NULL ) const; long InsertItem(wxListItem& info); long InsertItem( long index, const wxString& label ); long InsertItem( long index, int imageIndex ); diff --git a/include/wx/generic/treectlg.h b/include/wx/generic/treectlg.h index 4954afb37f..e6df2ee56c 100644 --- a/include/wx/generic/treectlg.h +++ b/include/wx/generic/treectlg.h @@ -304,7 +304,7 @@ protected: const wxString& text, int image = -1, int selImage = -1, wxTreeItemData *data = NULL); - virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, int& flags); + virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, int& flags) const; // called by wxTextTreeCtrl when it marks itself for deletion void ResetTextControl(); diff --git a/include/wx/msw/listctrl.h b/include/wx/msw/listctrl.h index 2008397f8f..fea8942770 100644 --- a/include/wx/msw/listctrl.h +++ b/include/wx/msw/listctrl.h @@ -297,7 +297,7 @@ public: // Determines which item (if any) is at the specified point, // giving details in 'flags' (see wxLIST_HITTEST_... flags above) // Request the subitem number as well at the given coordinate. - long HitTest(const wxPoint& point, int& flags, long* ptrSubItem = NULL); + long HitTest(const wxPoint& point, int& flags, long* ptrSubItem = NULL) const; // Inserts an item, returning the index of the new item if successful, // -1 otherwise. diff --git a/include/wx/msw/treectrl.h b/include/wx/msw/treectrl.h index 99906f62f7..d154a48042 100644 --- a/include/wx/msw/treectrl.h +++ b/include/wx/msw/treectrl.h @@ -257,7 +257,7 @@ protected: const wxString& text, int image = -1, int selImage = -1, wxTreeItemData *data = NULL); - virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, int& flags); + virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, int& flags) const; // obtain the user data for the lParam member of TV_ITEM class wxTreeItemParam *GetItemParam(const wxTreeItemId& item) const; diff --git a/include/wx/treectrl.h b/include/wx/treectrl.h index 873d779059..cbf50e4bc5 100644 --- a/include/wx/treectrl.h +++ b/include/wx/treectrl.h @@ -353,9 +353,9 @@ public: // coordinates specified are relative to the client area of tree ctrl) // and, in the second variant, fill the flags parameter with a bitmask // of wxTREE_HITTEST_xxx constants. - wxTreeItemId HitTest(const wxPoint& point) + wxTreeItemId HitTest(const wxPoint& point) const { int dummy; return DoTreeHitTest(point, dummy); } - wxTreeItemId HitTest(const wxPoint& point, int& flags) + wxTreeItemId HitTest(const wxPoint& point, int& flags) const { return DoTreeHitTest(point, flags); } // get the bounding rectangle of the item (or of its label only) @@ -398,7 +398,8 @@ protected: // real HitTest() implementation: again, can't be called just HitTest() // because it's overloaded and so the non-virtual overload would be hidden // (and can't be called DoHitTest() because this is already in wxWindow) - virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, int& flags) = 0; + virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, + int& flags) const = 0; wxImageList *m_imageListNormal, // images for tree elements diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 4eccdff7f6..161c1dedf2 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -707,7 +707,7 @@ public: long FindItem( long start, const wxString& str, bool partial = false ); long FindItem( long start, wxUIntPtr data); long FindItem( const wxPoint& pt ); - long HitTest( int x, int y, int &flags ); + long HitTest( int x, int y, int &flags ) const; void InsertItem( wxListItem &item ); void InsertColumn( long col, wxListItem &item ); int GetItemWidthWithImage(wxListItem * item); @@ -4432,7 +4432,7 @@ long wxListMainWindow::FindItem( const wxPoint& pt ) return wxNOT_FOUND; } -long wxListMainWindow::HitTest( int x, int y, int &flags ) +long wxListMainWindow::HitTest( int x, int y, int &flags ) const { CalcUnscrolledPosition( x, y, &x, &y ); @@ -5257,7 +5257,7 @@ long wxGenericListCtrl::FindItem( long WXUNUSED(start), const wxPoint& pt, } // TODO: sub item hit testing -long wxGenericListCtrl::HitTest(const wxPoint& point, int& flags, long *) +long wxGenericListCtrl::HitTest(const wxPoint& point, int& flags, long *) const { return m_mainWin->HitTest( (int)point.x, (int)point.y, flags ); } diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 3815ee03d8..c0b0ca5d1a 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -2852,11 +2852,9 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event ) } } -wxTreeItemId wxGenericTreeCtrl::DoTreeHitTest(const wxPoint& point, int& flags) +wxTreeItemId +wxGenericTreeCtrl::DoTreeHitTest(const wxPoint& point, int& flags) const { - // JACS: removed wxYieldIfNeeded() because it can cause the window - // to be deleted from under us if a close window event is pending - int w, h; GetSize(&w, &h); flags=0; diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 811e089e88..6e8eba40b5 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -1511,7 +1511,8 @@ long wxListCtrl::FindItem(long start, const wxPoint& pt, int direction) // Determines which item (if any) is at the specified point, // giving details in 'flags' (see wxLIST_HITTEST_... flags above) -long wxListCtrl::HitTest(const wxPoint& point, int& flags, long *ptrSubItem) +long +wxListCtrl::HitTest(const wxPoint& point, int& flags, long *ptrSubItem) const { LV_HITTESTINFO hitTestInfo; hitTestInfo.pt.x = (int) point.x; diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index dfd2f6ebec..915bfbd020 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -1874,7 +1874,7 @@ void wxTreeCtrl::DoEndEditLabel(bool discardChanges) DeleteTextCtrl(); } -wxTreeItemId wxTreeCtrl::DoTreeHitTest(const wxPoint& point, int& flags) +wxTreeItemId wxTreeCtrl::DoTreeHitTest(const wxPoint& point, int& flags) const { TV_HITTESTINFO hitTestInfo; hitTestInfo.pt.x = (int)point.x; -- 2.47.2