implement wxListCtrl::ScrollList() (in report view and vertical direction only) (slightly modified patch 1843647)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@50902 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -107,6 +107,7 @@ All (GUI):
|
||||
works.
|
||||
- When focus is set to wxScrolledWindow child, scroll it into view.
|
||||
- Improve wximage::ResampleBox() (Mihai Ciocarlie)
|
||||
- Implemented ScrollList() in generic wxListCtrl (Tim Kosse)
|
||||
|
||||
All (Unix):
|
||||
|
||||
|
@@ -579,6 +579,8 @@ public:
|
||||
// bring the selected item into view, scrolling to it if necessary
|
||||
void MoveToItem(size_t item);
|
||||
|
||||
bool ScrollList( int WXUNUSED(dx), int dy );
|
||||
|
||||
// bring the current item into view
|
||||
void MoveToFocus() { MoveToItem(m_current); }
|
||||
|
||||
@@ -3319,6 +3321,34 @@ void wxListMainWindow::MoveToItem(size_t item)
|
||||
}
|
||||
}
|
||||
|
||||
bool wxListMainWindow::ScrollList(int WXUNUSED(dx), int dy)
|
||||
{
|
||||
if ( !InReportView() )
|
||||
{
|
||||
// TODO: this should work in all views but is not implemented now
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t top, bottom;
|
||||
GetVisibleLinesRange(&top, &bottom);
|
||||
|
||||
if ( bottom == (size_t)-1 )
|
||||
return 0;
|
||||
|
||||
ResetVisibleLinesRange();
|
||||
|
||||
int hLine = GetLineHeight();
|
||||
|
||||
Scroll(-1, top + dy / hLine);
|
||||
|
||||
#ifdef __WXMAC__
|
||||
// see comment in MoveToItem() for why we do this
|
||||
ResetVisibleLinesRange();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// keyboard handling
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -5581,9 +5611,9 @@ long wxGenericListCtrl::InsertColumn( long col, const wxString &heading,
|
||||
return InsertColumn( col, item );
|
||||
}
|
||||
|
||||
bool wxGenericListCtrl::ScrollList( int WXUNUSED(dx), int WXUNUSED(dy) )
|
||||
bool wxGenericListCtrl::ScrollList( int dx, int dy )
|
||||
{
|
||||
return 0;
|
||||
return m_mainWin->ScrollList(dx, dy);
|
||||
}
|
||||
|
||||
// Sort items.
|
||||
|
Reference in New Issue
Block a user