void VListWin::SetItemSize( int h, int w ) { if ( itemHeight != h || itemWidth != w ) { itemHeight = h; itemWidth = w; CalcScroll(); Invalidate(); } }
void VListWin::MoveXOffset( int n ) { if ( n + listRect.Width() >= itemWidth ) { n = itemWidth - listRect.Width(); } if ( n < 0 ) { n = 0; } if ( xOffset != n ) { xOffset = n; CalcScroll(); Invalidate(); } }
void VListWin::MoveCurrent( int n, bool mustVisible ) { if ( selectType == NO_SELECT ) { return; } int f = first; if ( n < 0 ) { n = 0; } //count-1; if ( n >= count ) { n = count - 1; //n = 0; } if ( mustVisible ) { if ( n - f >= pageSize ) { f = n - pageSize + 1; } if ( f > n ) { f = n; } if ( f < 0 ) { f = 0; } } bool redraw = ( f != first || n != current ); first = f; bool curChanged = ( n != current ); current = n; if ( redraw ) { CalcScroll(); Invalidate(); } if ( curChanged ) { Command( CMD_ITEM_CHANGED, GetCurrent(), this, 0 ); } }
void VListWin::MoveFirst( int n ) { if ( n + pageSize >= count ) { n = count - pageSize; } if ( n < 0 ) { n = 0; } if ( first != n ) { first = n; CalcScroll(); Invalidate(); } }
void TextList::DataRefresh() { if ( !valid ) { valid = true; GC gc( this ); gc.Set( GetFont() ); int X = 0; int cnt = list.count(); for ( int i = 0; i < cnt; i++ ) { if ( list[i].pixelWidth < 0 ) { list[i].pixelWidth = gc.GetTextExtents( list[i].str.data() ).x; } if ( list[i].pixelWidth > X ) { X = list[i].pixelWidth; } } if ( GetCount() != list.count() ) { SetCount( list.count() ); } if ( X != this->GetItemWidth() ) { SetItemSize( GetItemHeight(), X ); } CalcScroll(); Invalidate(); } }