#define wxUSE_GENERIC_LIST_EXTENSIONS 1
#endif
+// ----------------------------------------------------------------------------
+// events
+// ----------------------------------------------------------------------------
+
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_DRAG)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_RDRAG)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_END_LABEL_EDIT)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ITEM)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_GET_INFO)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_SET_INFO)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_SELECTED)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_DESELECTED)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_KEY_DOWN)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_INSERT_ITEM)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_CLICK)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_ACTIVATED)
+
// ============================================================================
// private classes
// ============================================================================
void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
{
+#ifdef __WXGTK__
+ wxClientDC dc( this );
+#else
wxPaintDC dc( this );
+#endif
+
PrepareDC( dc );
AdjustDC( dc );
wxPaintDC dc( this );
PrepareDC( dc );
+ int dev_x = 0;
+ int dev_y = 0;
+ CalcScrolledPosition( 0, 0, &dev_x, &dev_y );
+
if (m_dirty) return;
if (m_lines.GetCount() == 0) return;
if (m_mode & wxLC_REPORT)
{
wxPen pen(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID);
- dc.SetPen(pen);
- dc.SetBrush(* wxTRANSPARENT_BRUSH);
-
wxSize clientSize = GetClientSize();
int lineSpacing = 0;
m_lines[i].Draw( &dc );
// Draw horizontal rule if required
if (GetWindowStyle() & wxLC_HRULES)
- dc.DrawLine(0, i*lineSpacing, clientSize.x, i*lineSpacing);
+ {
+ dc.SetPen(pen);
+ dc.SetBrush(* wxTRANSPARENT_BRUSH);
+ dc.DrawLine(0 - dev_x , i*lineSpacing , clientSize.x - dev_x , i*lineSpacing );
+ }
}
// Draw last horizontal rule
if ((i > (size_t) (y_s / lineSpacing)) && (GetWindowStyle() & wxLC_HRULES))
- dc.DrawLine(0, i*lineSpacing, clientSize.x, i*lineSpacing);
+ {
+ dc.SetPen(pen);
+ dc.SetBrush(* wxTRANSPARENT_BRUSH);
+ dc.DrawLine(0 - dev_x , i*lineSpacing , clientSize.x - dev_x , i*lineSpacing );
+ }
// Draw vertical rules if required
if ((GetWindowStyle() & wxLC_VRULES) && (GetItemCount() > 0))
GetItemRect(0, firstItemRect);
GetItemRect(GetItemCount() - 1, lastItemRect);
int x = firstItemRect.GetX();
+ dc.SetPen(pen);
+ dc.SetBrush(* wxTRANSPARENT_BRUSH);
for (col = 0; col < GetColumnCount(); col++)
{
int colWidth = GetColumnWidth(col);
x += colWidth ;
- dc.DrawLine(x, firstItemRect.GetY() - 1, x, lastItemRect.GetBottom() + 1);
+ dc.DrawLine(x - dev_x, firstItemRect.GetY() - 1 - dev_y, x - dev_x, lastItemRect.GetBottom() + 1 - dev_y);
}
}
}
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 );
}
if (item >= 0 && (size_t)item < m_lines.GetCount())
{
wxListLineData *line = &m_lines[(size_t)item];
- if (line->IsHilighted()) ret |= wxLIST_STATE_FOCUSED;
+ if (line->IsHilighted()) ret |= wxLIST_STATE_SELECTED;
}
}
return ret;
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;
#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 );
#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