Implemented logic.

This commit is contained in:
Maarten Bent
2016-02-06 17:12:56 +01:00
parent 47794945b5
commit 415292c614
3 changed files with 85 additions and 0 deletions

View File

@@ -410,6 +410,7 @@ wxListLineData::wxListLineData( wxListMainWindow *owner )
m_gi = new GeometryInfo;
m_highlighted = false;
m_checked = false;
InitItems( GetMode() == wxLC_REPORT ? m_owner->GetColumnCount() : 1 );
}
@@ -1588,6 +1589,8 @@ void wxListMainWindow::Init()
m_lineLastClicked =
m_lineSelectSingleOnUp =
m_lineBeforeLastClicked = (size_t)-1;
m_hasCheckboxes = false;
}
wxListMainWindow::wxListMainWindow()
@@ -3673,6 +3676,41 @@ bool wxListMainWindow::GetItemPosition(long item, wxPoint& pos) const
return true;
}
// ----------------------------------------------------------------------------
// checkboxes
// ----------------------------------------------------------------------------
bool wxListMainWindow::HasCheckboxes() const
{
return m_hasCheckboxes;
}
bool wxListMainWindow::EnableCheckboxes(bool enable)
{
m_hasCheckboxes = enable;
Refresh();
return true;
}
void wxListMainWindow::CheckItem(long item, bool state)
{
wxListLineData *line = GetLine((size_t)item);
line->Check(state);
RefreshLine(item);
SendNotify(item, state ? wxEVT_LIST_ITEM_CHECKED
: wxEVT_LIST_ITEM_UNCHECKED);
}
bool wxListMainWindow::IsItemChecked(long item) const
{
wxListLineData *line = GetLine((size_t)item);
return line->IsChecked();
}
// ----------------------------------------------------------------------------
// geometry calculation
// ----------------------------------------------------------------------------
@@ -4691,6 +4729,36 @@ void wxGenericListCtrl::OnScroll(wxScrollWinEvent& event)
event.Skip();
}
bool wxGenericListCtrl::HasCheckboxes() const
{
if (!InReportView())
return false;
return m_mainWin->HasCheckboxes();
}
bool wxGenericListCtrl::EnableCheckboxes(bool enable)
{
if (!InReportView())
return false;
return m_mainWin->EnableCheckboxes(enable);
}
void wxGenericListCtrl::CheckItem(long item, bool state)
{
if (InReportView())
m_mainWin->CheckItem(item, state);
}
bool wxGenericListCtrl::IsItemChecked(long item) const
{
if (!InReportView())
return false;
return m_mainWin->IsItemChecked(item);
}
void wxGenericListCtrl::SetSingleStyle( long style, bool add )
{
wxASSERT_MSG( !(style & wxLC_VIRTUAL),