made wxTree/ListCtrl::HitTest() const

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39716 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-06-14 12:00:57 +00:00
parent 028285e4af
commit be0e5d699f
11 changed files with 18 additions and 18 deletions

View File

@@ -573,7 +573,7 @@ list or report views (this is a limitation of the native Win32 control).
\membersection{wxListCtrl::HitTest}\label{wxlistctrlhittest} \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, Determines which item (if any) is at the specified point,
giving details in {\it flags}. Returns index of the item or {\tt wxNOT\_FOUND} giving details in {\it flags}. Returns index of the item or {\tt wxNOT\_FOUND}

View File

@@ -657,7 +657,7 @@ Returns the state image list (from which application-defined state images are ta
\membersection{wxTreeCtrl::HitTest}\label{wxtreectrlhittest} \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 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: id at this point plus extra information {\it flags}. {\it flags} is a bitlist of the following:

View File

@@ -149,7 +149,7 @@ public:
long FindItem( long start, const wxString& str, bool partial = false ); long FindItem( long start, const wxString& str, bool partial = false );
long FindItem( long start, wxUIntPtr data ); long FindItem( long start, wxUIntPtr data );
long FindItem( long start, const wxPoint& pt, int direction ); // not supported in wxGLC 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(wxListItem& info);
long InsertItem( long index, const wxString& label ); long InsertItem( long index, const wxString& label );
long InsertItem( long index, int imageIndex ); long InsertItem( long index, int imageIndex );

View File

@@ -304,7 +304,7 @@ protected:
const wxString& text, const wxString& text,
int image = -1, int selImage = -1, int image = -1, int selImage = -1,
wxTreeItemData *data = NULL); 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 // called by wxTextTreeCtrl when it marks itself for deletion
void ResetTextControl(); void ResetTextControl();

View File

@@ -297,7 +297,7 @@ public:
// Determines which item (if any) is at the specified point, // Determines which item (if any) is at the specified point,
// giving details in 'flags' (see wxLIST_HITTEST_... flags above) // giving details in 'flags' (see wxLIST_HITTEST_... flags above)
// Request the subitem number as well at the given coordinate. // 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, // Inserts an item, returning the index of the new item if successful,
// -1 otherwise. // -1 otherwise.

View File

@@ -257,7 +257,7 @@ protected:
const wxString& text, const wxString& text,
int image = -1, int selImage = -1, int image = -1, int selImage = -1,
wxTreeItemData *data = NULL); 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 // obtain the user data for the lParam member of TV_ITEM
class wxTreeItemParam *GetItemParam(const wxTreeItemId& item) const; class wxTreeItemParam *GetItemParam(const wxTreeItemId& item) const;

View File

@@ -353,9 +353,9 @@ public:
// coordinates specified are relative to the client area of tree ctrl) // coordinates specified are relative to the client area of tree ctrl)
// and, in the second variant, fill the flags parameter with a bitmask // and, in the second variant, fill the flags parameter with a bitmask
// of wxTREE_HITTEST_xxx constants. // of wxTREE_HITTEST_xxx constants.
wxTreeItemId HitTest(const wxPoint& point) wxTreeItemId HitTest(const wxPoint& point) const
{ int dummy; return DoTreeHitTest(point, dummy); } { 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); } { return DoTreeHitTest(point, flags); }
// get the bounding rectangle of the item (or of its label only) // 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() // real HitTest() implementation: again, can't be called just HitTest()
// because it's overloaded and so the non-virtual overload would be hidden // 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) // (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 wxImageList *m_imageListNormal, // images for tree elements

View File

@@ -707,7 +707,7 @@ public:
long FindItem( long start, const wxString& str, bool partial = false ); long FindItem( long start, const wxString& str, bool partial = false );
long FindItem( long start, wxUIntPtr data); long FindItem( long start, wxUIntPtr data);
long FindItem( const wxPoint& pt ); 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 InsertItem( wxListItem &item );
void InsertColumn( long col, wxListItem &item ); void InsertColumn( long col, wxListItem &item );
int GetItemWidthWithImage(wxListItem * item); int GetItemWidthWithImage(wxListItem * item);
@@ -4432,7 +4432,7 @@ long wxListMainWindow::FindItem( const wxPoint& pt )
return wxNOT_FOUND; 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 ); CalcUnscrolledPosition( x, y, &x, &y );
@@ -5257,7 +5257,7 @@ long wxGenericListCtrl::FindItem( long WXUNUSED(start), const wxPoint& pt,
} }
// TODO: sub item hit testing // 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 ); return m_mainWin->HitTest( (int)point.x, (int)point.y, flags );
} }

View File

@@ -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; int w, h;
GetSize(&w, &h); GetSize(&w, &h);
flags=0; flags=0;

View File

@@ -1511,7 +1511,8 @@ long wxListCtrl::FindItem(long start, const wxPoint& pt, int direction)
// Determines which item (if any) is at the specified point, // Determines which item (if any) is at the specified point,
// giving details in 'flags' (see wxLIST_HITTEST_... flags above) // 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; LV_HITTESTINFO hitTestInfo;
hitTestInfo.pt.x = (int) point.x; hitTestInfo.pt.x = (int) point.x;

View File

@@ -1874,7 +1874,7 @@ void wxTreeCtrl::DoEndEditLabel(bool discardChanges)
DeleteTextCtrl(); DeleteTextCtrl();
} }
wxTreeItemId wxTreeCtrl::DoTreeHitTest(const wxPoint& point, int& flags) wxTreeItemId wxTreeCtrl::DoTreeHitTest(const wxPoint& point, int& flags) const
{ {
TV_HITTESTINFO hitTestInfo; TV_HITTESTINFO hitTestInfo;
hitTestInfo.pt.x = (int)point.x; hitTestInfo.pt.x = (int)point.x;