// make this item visible void wxSymbolListCtrl::EnsureVisible(int item) { if (item != wxNOT_FOUND && item >= m_minSymbolValue && item <= m_maxSymbolValue) { ScrollToRow(SymbolValueToLineNumber(item)); } }
bool wxSymbolListCtrl::DoSetCurrent(int current) { wxASSERT_MSG( current == wxNOT_FOUND || (current >= m_minSymbolValue && current <= m_maxSymbolValue), wxT("wxSymbolListCtrl::DoSetCurrent(): invalid symbol value") ); if ( current == m_current ) { // nothing to do return false; } if ( m_current != wxNOT_FOUND ) RefreshRow(SymbolValueToLineNumber(m_current)); m_current = current; if ( m_current != wxNOT_FOUND ) { int lineNo = SymbolValueToLineNumber(m_current); // if the line is not visible at all, we scroll it into view but we // don't need to refresh it -- it will be redrawn anyhow if ( !IsVisible(lineNo) ) { ScrollToRow(lineNo); } else // line is at least partly visible { // it is, indeed, only partly visible, so scroll it into view to // make it entirely visible while ( (unsigned)lineNo + 1 == GetVisibleEnd() && ScrollToRow(GetVisibleBegin() + 1) ) ; // but in any case refresh it as even if it was only partly visible // before we need to redraw it entirely as its background changed RefreshRow(lineNo); } } return true; }
bool wxVListBox::DoSetCurrent(int current) { wxASSERT_MSG( current == wxNOT_FOUND || (current >= 0 && (size_t)current < GetItemCount()), wxT("wxVListBox::DoSetCurrent(): invalid item index") ); if ( current == m_current ) { // nothing to do return false; } if ( m_current != wxNOT_FOUND ) RefreshRow(m_current); m_current = current; if ( m_current != wxNOT_FOUND ) { // if the line is not visible at all, we scroll it into view but we // don't need to refresh it -- it will be redrawn anyhow if ( !IsVisible(m_current) ) { ScrollToRow(m_current); } else // line is at least partly visible { // it is, indeed, only partly visible, so scroll it into view to // make it entirely visible // BUT scrolling down when m_current is first visible makes it // completely hidden, so that is even worse while ( (size_t)m_current + 1 == GetVisibleRowsEnd() && (size_t)m_current != GetVisibleRowsBegin() && ScrollToRow(GetVisibleBegin() + 1) ) ; // but in any case refresh it as even if it was only partly visible // before we need to redraw it entirely as its background changed RefreshRow(m_current); } } return true; }
/// Set selection for string int wxRichTextStyleListBox::SetStyleSelection(const wxString& name) { int i = GetIndexForStyle(name); if (i > -1) { SetSelection(i); if (!IsVisible(i)) ScrollToRow(i); } return i; }
bool ContentBoxCtrol::DoSetCurrent(int current) { wxASSERT_MSG( current == wxNOT_FOUND || (current >= 0 && (size_t)current < GetItemCount()), "ContentBoxCtrol::DoSetCurrent(): invalid item index" ); if ( current == m_current ) { // nothing to do return false; } if ( m_current != wxNOT_FOUND ) wxVScrolledWindow::RefreshRow(m_current); m_current = current; if ( m_current != wxNOT_FOUND ) { // if the line is not visible at all, we scroll it into view but we // don't need to refresh it -- it will be redrawn anyhow if ( !IsVisible(m_current) ) { ScrollToRow(m_current); } else // line is at least partly visible { // it is, indeed, only partly visible, so scroll it into view to // make it entirely visible while ( (size_t)m_current == GetVisibleRowsEnd() && ScrollToRow(GetVisibleBegin()+1) ) ; // but in any case refresh it as even if it was only partly visible // before we need to redraw it entirely as its background changed wxVScrolledWindow::RefreshRow(m_current); } } return true; }
// initialise control from current min/max values void wxSymbolListCtrl::SetupCtrl(bool scrollToSelection) { wxSize sz = GetClientSize(); m_symbolsPerLine = sz.x/(m_cellSize.x+m_ptMargins.x); int noLines = (1 + SymbolValueToLineNumber(m_maxSymbolValue)); SetRowCount(noLines); Refresh(); if (scrollToSelection && m_current != wxNOT_FOUND && m_current >= m_minSymbolValue && m_current <= m_maxSymbolValue) { ScrollToRow(SymbolValueToLineNumber(m_current)); } }
void ProperList::EnsureVisible(size_t n) { if(!IsRowVisible(n)) { size_t ve = GetVisibleRowsEnd(); if(n > ve) { ScrollRows(n - ve); } else { ScrollToRow(n); } } }
// -------------------------------------------------------------------------------- // void guAlListBox::ReloadItems( bool reset ) { wxArrayInt Selection; int FirstVisible = GetVisibleRowsBegin(); if( reset ) SetSelection( -1 ); else Selection = GetSelectedItems( false ); m_Items->Empty(); GetItemsList(); m_Items->Insert( new guAlbumItem( 0, wxString::Format( wxT( "%s (%lu)" ), _( "All" ), m_Items->Count() ) ), 0 ); SetItemCount( m_Items->Count() ); if( !reset ) { SetSelectedItems( Selection ); ScrollToRow( FirstVisible ); } RefreshAll(); }