added GetItemRect() test
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34803 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -884,6 +884,8 @@ void MyListCtrl::OnFocused(wxListEvent& event)
|
||||
|
||||
void MyListCtrl::OnListKeyDown(wxListEvent& event)
|
||||
{
|
||||
long item;
|
||||
|
||||
switch ( event.GetKeyCode() )
|
||||
{
|
||||
case 'c': // colorize
|
||||
@@ -907,9 +909,7 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event)
|
||||
|
||||
case 'n': // next
|
||||
case 'N':
|
||||
{
|
||||
long item = GetNextItem(-1,
|
||||
wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED);
|
||||
item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED);
|
||||
if ( item++ == GetItemCount() - 1 )
|
||||
{
|
||||
item = 0;
|
||||
@@ -919,13 +919,26 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event)
|
||||
|
||||
SetItemState(item, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED);
|
||||
EnsureVisible(item);
|
||||
break;
|
||||
|
||||
case 'r': // show bounding Rect
|
||||
case 'R':
|
||||
{
|
||||
item = event.GetIndex();
|
||||
wxRect r;
|
||||
if ( !GetItemRect(item, r) )
|
||||
{
|
||||
wxLogError(_T("Failed to retrieve rect of item %ld"), item);
|
||||
break;
|
||||
}
|
||||
|
||||
wxLogMessage(_T("Bounding rect of item %ld is (%d, %d)-(%d, %d)"),
|
||||
item, r.x, r.y, r.x + r.width, r.y + r.height);
|
||||
}
|
||||
break;
|
||||
|
||||
case WXK_DELETE:
|
||||
{
|
||||
long item = GetNextItem(-1,
|
||||
wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
||||
item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
||||
while ( item != -1 )
|
||||
{
|
||||
DeleteItem(item);
|
||||
@@ -936,7 +949,6 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event)
|
||||
item = GetNextItem(item - 1,
|
||||
wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WXK_INSERT:
|
||||
|
Reference in New Issue
Block a user