Implemented logic.
This commit is contained in:
@@ -101,6 +101,11 @@ public:
|
||||
void SetTextColour(const wxColour& col);
|
||||
long GetTopItem() const;
|
||||
|
||||
virtual bool HasCheckboxes() const wxOVERRIDE;
|
||||
virtual bool EnableCheckboxes(bool enable = true) wxOVERRIDE;
|
||||
virtual bool IsItemChecked(long item) const wxOVERRIDE;
|
||||
virtual void CheckItem(long item, bool check) wxOVERRIDE;
|
||||
|
||||
void SetSingleStyle( long style, bool add = true ) ;
|
||||
void SetWindowStyleFlag( long style ) wxOVERRIDE;
|
||||
void RecreateWindow() {}
|
||||
|
@@ -200,6 +200,8 @@ public:
|
||||
// is this item selected? [NB: not used in virtual mode]
|
||||
bool m_highlighted;
|
||||
|
||||
bool m_checked;
|
||||
|
||||
// back pointer to the list ctrl
|
||||
wxListMainWindow *m_owner;
|
||||
|
||||
@@ -249,6 +251,9 @@ public:
|
||||
void SetImage( int index, int image );
|
||||
int GetImage( int index ) const;
|
||||
|
||||
void Check(bool check) {m_checked = check; }
|
||||
bool IsChecked() { return m_checked; }
|
||||
|
||||
bool HasImage() const { return GetImage() != -1; }
|
||||
bool HasText() const { return !GetText(0).empty(); }
|
||||
|
||||
@@ -636,6 +641,11 @@ public:
|
||||
bool GetItemPosition( long item, wxPoint& pos ) const;
|
||||
int GetSelectedItemCount() const;
|
||||
|
||||
bool HasCheckboxes() const;
|
||||
bool EnableCheckboxes(bool enable = true);
|
||||
bool IsItemChecked(long item) const;
|
||||
void CheckItem(long item, bool check);
|
||||
|
||||
wxString GetItemText(long item, int col = 0) const
|
||||
{
|
||||
wxListItem info;
|
||||
@@ -779,6 +789,8 @@ protected:
|
||||
m_lineBeforeLastClicked,
|
||||
m_lineSelectSingleOnUp;
|
||||
|
||||
bool m_hasCheckboxes;
|
||||
|
||||
protected:
|
||||
wxWindow *GetMainWindowOfCompositeControl() wxOVERRIDE { return GetParent(); }
|
||||
|
||||
|
@@ -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),
|
||||
|
Reference in New Issue
Block a user