wxListCtrl scrolls more gracefully in report mode now.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@8463 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1195,15 +1195,6 @@ wxListHeaderWindow::~wxListHeaderWindow( void )
|
||||
|
||||
void wxListHeaderWindow::DoDrawRect( wxDC *dc, int x, int y, int w, int h )
|
||||
{
|
||||
#ifdef __WXGTK__
|
||||
GtkStateType state = GTK_STATE_NORMAL;
|
||||
if (!m_parent->IsEnabled()) state = GTK_STATE_INSENSITIVE;
|
||||
|
||||
x = dc->XLOG2DEV( x );
|
||||
|
||||
gtk_paint_box (m_wxwindow->style, GTK_PIZZA(m_wxwindow)->bin_window, state, GTK_SHADOW_OUT,
|
||||
(GdkRectangle*) NULL, m_wxwindow, "button", x-1, y-1, w+2, h+2);
|
||||
#else
|
||||
const int m_corner = 1;
|
||||
|
||||
dc->SetBrush( *wxTRANSPARENT_BRUSH );
|
||||
@@ -1223,7 +1214,6 @@ void wxListHeaderWindow::DoDrawRect( wxDC *dc, int x, int y, int w, int h )
|
||||
dc->DrawRectangle( x, y, 1, h ); // left (outer)
|
||||
dc->DrawLine( x, y+h-1, x+1, y+h-1 );
|
||||
dc->DrawLine( x+w-1, y, x+w-1, y+1 );
|
||||
#endif
|
||||
}
|
||||
|
||||
// shift the DC origin to match the position of the main window horz
|
||||
@@ -1274,24 +1264,40 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
{
|
||||
m_owner->GetColumn( i, item );
|
||||
int wCol = item.m_width;
|
||||
int cw = wCol - 2; // the width of the rect to draw
|
||||
|
||||
int xEnd = x + wCol;
|
||||
|
||||
// VZ: no, draw it normally - this is better now as we allow resizing
|
||||
// of the last column as well
|
||||
#if 0
|
||||
// let the last column occupy all available space
|
||||
if ( i == numColumns - 1 )
|
||||
cw = w-x-1;
|
||||
#endif // 0
|
||||
#ifdef __WXGTK__
|
||||
int cw = wCol; // the width of the rect to draw
|
||||
int ch = h;
|
||||
GtkStateType state = GTK_STATE_NORMAL;
|
||||
if (!m_parent->IsEnabled()) state = GTK_STATE_INSENSITIVE;
|
||||
|
||||
int xx = dc.XLOG2DEV( x );
|
||||
|
||||
gtk_paint_box (m_wxwindow->style, GTK_PIZZA(m_wxwindow)->bin_window, state, GTK_SHADOW_OUT,
|
||||
(GdkRectangle*) NULL, m_wxwindow, "button", xx-1, y-1, cw, ch);
|
||||
|
||||
// The +6 is a guess, I don' t know how GTK figures out
|
||||
// where to draw lables.
|
||||
int cy = y+6 + gdk_char_height( m_wxwindow->style->font, 'H' );
|
||||
GdkRectangle clip;
|
||||
clip.x = xx+4;
|
||||
clip.y = 2;
|
||||
clip.width = cw-6;
|
||||
clip.height = ch-4;
|
||||
gtk_paint_string (m_wxwindow->style, GTK_PIZZA(m_wxwindow)->bin_window, state,
|
||||
&clip, m_wxwindow, "label", xx+4, cy, item.m_text.c_str() );
|
||||
#else
|
||||
int cw = wCol - 2; // the width of the rect to draw
|
||||
int ch = h - 2;
|
||||
dc.SetPen( *wxWHITE_PEN );
|
||||
|
||||
DoDrawRect( &dc, x, y, cw, h-2 );
|
||||
dc.SetClippingRegion( x, y, cw-5, h-4 );
|
||||
DoDrawRect( &dc, x, y, cw, ch );
|
||||
dc.SetClippingRegion( x, y, cw-5, ch-2 );
|
||||
dc.DrawText( item.m_text, x+4, y+3 );
|
||||
dc.DestroyClippingRegion();
|
||||
#endif
|
||||
|
||||
x += wCol;
|
||||
|
||||
if (xEnd > w+5)
|
||||
@@ -1996,8 +2002,8 @@ void wxListMainWindow::MoveToFocus()
|
||||
|
||||
if (m_mode & wxLC_REPORT)
|
||||
{
|
||||
if (item_y-5 < view_y )
|
||||
Scroll( -1, (item_y-5)/m_yScroll );
|
||||
if (item_y < view_y )
|
||||
Scroll( -1, (item_y)/m_yScroll );
|
||||
if (item_y+item_h+5 > view_y+client_h)
|
||||
Scroll( -1, (item_y+item_h-client_h+15)/m_yScroll );
|
||||
}
|
||||
@@ -2709,6 +2715,9 @@ void wxListMainWindow::CalculatePositions()
|
||||
|
||||
if (m_mode & wxLC_REPORT)
|
||||
{
|
||||
// scroll one line per step
|
||||
m_yScroll = lineSpacing;
|
||||
|
||||
int x = 4;
|
||||
int y = 1;
|
||||
int entireHeight = m_lines.GetCount() * lineSpacing + 2;
|
||||
@@ -2716,7 +2725,7 @@ void wxListMainWindow::CalculatePositions()
|
||||
#if wxUSE_GENERIC_LIST_EXTENSIONS
|
||||
int x_scroll_pos = GetScrollPos( wxHORIZONTAL );
|
||||
#else
|
||||
SetScrollbars( m_xScroll, m_yScroll, 0, (entireHeight+15) / m_yScroll, 0, scroll_pos, TRUE );
|
||||
SetScrollbars( m_xScroll, m_yScroll, 0, entireHeight/m_yScroll + 1, 0, scroll_pos, TRUE );
|
||||
#endif
|
||||
GetClientSize( &clientWidth, &clientHeight );
|
||||
|
||||
@@ -2738,9 +2747,9 @@ void wxListMainWindow::CalculatePositions()
|
||||
#endif
|
||||
y += lineSpacing; // one pixel blank line between items
|
||||
}
|
||||
m_visibleLines = clientHeight / lineSpacing;
|
||||
m_visibleLines = clientHeight / lineSpacing;
|
||||
#if wxUSE_GENERIC_LIST_EXTENSIONS
|
||||
SetScrollbars( m_xScroll, m_yScroll, entireWidth / m_xScroll , (entireHeight+15) / m_yScroll, x_scroll_pos , scroll_pos, TRUE );
|
||||
SetScrollbars( m_xScroll, m_yScroll, entireWidth/m_xScroll+1 , entireHeight/m_yScroll+1, x_scroll_pos , scroll_pos, TRUE );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user