Rename wxListCtrl::HasCheckboxes() and EnableCheckboxes()

Rename them to HasCheckBoxes and EnableCheckBoxes for consistency with
wxCheckBox naming.

See also PR https://github.com/wxWidgets/wxWidgets/pull/153
This commit is contained in:
Dimitri Schoolwerth
2016-04-21 15:23:21 +00:00
parent deb162fc5a
commit 602111f2b3
9 changed files with 37 additions and 30 deletions

View File

@@ -55,6 +55,13 @@ Changes in behaviour which may result in build errors
3.1.1: (not released yet) 3.1.1: (not released yet)
---------------------------- ----------------------------
INCOMPATIBLE CHANGES SINCE 3.1.0:
- wxListCtrl::HasCheckboxes() and EnableCheckboxes(), which were added in
3.1.0, have been renamed to HasCheckBoxes and EnableCheckBoxes respectively
for consistency with wxCheckBox naming.
All: All:
- Add support for the micro version (third component) to OS and toolkit version - Add support for the micro version (third component) to OS and toolkit version

View File

@@ -101,8 +101,8 @@ public:
void SetTextColour(const wxColour& col); void SetTextColour(const wxColour& col);
long GetTopItem() const; long GetTopItem() const;
virtual bool HasCheckboxes() const wxOVERRIDE; virtual bool HasCheckBoxes() const wxOVERRIDE;
virtual bool EnableCheckboxes(bool enable = true) wxOVERRIDE; virtual bool EnableCheckBoxes(bool enable = true) wxOVERRIDE;
virtual bool IsItemChecked(long item) const wxOVERRIDE; virtual bool IsItemChecked(long item) const wxOVERRIDE;
virtual void CheckItem(long item, bool check) wxOVERRIDE; virtual void CheckItem(long item, bool check) wxOVERRIDE;

View File

@@ -641,8 +641,8 @@ public:
bool GetItemPosition( long item, wxPoint& pos ) const; bool GetItemPosition( long item, wxPoint& pos ) const;
int GetSelectedItemCount() const; int GetSelectedItemCount() const;
bool HasCheckboxes() const; bool HasCheckBoxes() const;
bool EnableCheckboxes(bool enable = true); bool EnableCheckBoxes(bool enable = true);
bool IsItemChecked(long item) const; bool IsItemChecked(long item) const;
void CheckItem(long item, bool check); void CheckItem(long item, bool check);
@@ -789,7 +789,7 @@ protected:
m_lineBeforeLastClicked, m_lineBeforeLastClicked,
m_lineSelectSingleOnUp; m_lineSelectSingleOnUp;
bool m_hasCheckboxes; bool m_hasCheckBoxes;
protected: protected:
wxWindow *GetMainWindowOfCompositeControl() wxOVERRIDE { return GetParent(); } wxWindow *GetMainWindowOfCompositeControl() wxOVERRIDE { return GetParent(); }

View File

@@ -461,8 +461,8 @@ public:
wxColour GetAlternateRowColour() const { return m_alternateRowColour.GetBackgroundColour(); } wxColour GetAlternateRowColour() const { return m_alternateRowColour.GetBackgroundColour(); }
// Checkboxes support: only implemented in wxMSW currently. // Checkboxes support: only implemented in wxMSW currently.
virtual bool HasCheckboxes() const { return false; } virtual bool HasCheckBoxes() const { return false; }
virtual bool EnableCheckboxes(bool WXUNUSED(enable) = true) { return false; } virtual bool EnableCheckBoxes(bool WXUNUSED(enable) = true) { return false; }
virtual bool IsItemChecked(long WXUNUSED(item)) const { return false; } virtual bool IsItemChecked(long WXUNUSED(item)) const { return false; }
virtual void CheckItem(long WXUNUSED(item), bool WXUNUSED(check)) { } virtual void CheckItem(long WXUNUSED(item), bool WXUNUSED(check)) { }

View File

@@ -217,8 +217,8 @@ public:
wxFont GetItemFont( long item ) const; wxFont GetItemFont( long item ) const;
// Checkbox state of an item // Checkbox state of an item
virtual bool HasCheckboxes() const wxOVERRIDE; virtual bool HasCheckBoxes() const wxOVERRIDE;
virtual bool EnableCheckboxes(bool enable = true) wxOVERRIDE; virtual bool EnableCheckBoxes(bool enable = true) wxOVERRIDE;
virtual bool IsItemChecked(long item) const wxOVERRIDE; virtual bool IsItemChecked(long item) const wxOVERRIDE;
virtual void CheckItem(long item, bool check) wxOVERRIDE; virtual void CheckItem(long item, bool check) wxOVERRIDE;

View File

@@ -1230,11 +1230,11 @@ public:
/** /**
Returns true if checkboxes are enabled for list items. Returns true if checkboxes are enabled for list items.
@see EnableCheckboxes() @see EnableCheckBoxes()
@since 3.1.0 @since 3.1.0
*/ */
bool HasCheckboxes() const; bool HasCheckBoxes() const;
/** /**
Enable or disable checkboxes for list items. Enable or disable checkboxes for list items.
@@ -1244,7 +1244,7 @@ public:
@since 3.1.0 @since 3.1.0
*/ */
bool EnableCheckboxes(bool enable = true); bool EnableCheckBoxes(bool enable = true);
/** /**
Return true if the checkbox for the given wxListItem is checked. Return true if the checkbox for the given wxListItem is checked.
@@ -1261,7 +1261,7 @@ public:
Check or uncheck a wxListItem in a control using checkboxes. Check or uncheck a wxListItem in a control using checkboxes.
This method only works if checkboxes support had been successfully This method only works if checkboxes support had been successfully
enabled using EnableCheckboxes(). enabled using EnableCheckBoxes().
@param item Item (zero-based) index. @param item Item (zero-based) index.
@param check If @true, check the item, otherwise uncheck. @param check If @true, check the item, otherwise uncheck.

View File

@@ -847,20 +847,20 @@ void MyFrame::OnUpdateToggleMultiSel(wxUpdateUIEvent& event)
void MyFrame::OnToggleCheckboxes(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnToggleCheckboxes(wxCommandEvent& WXUNUSED(event))
{ {
if ( !m_listCtrl->EnableCheckboxes(!m_listCtrl->HasCheckboxes()) ) if ( !m_listCtrl->EnableCheckBoxes(!m_listCtrl->HasCheckBoxes()) )
{ {
wxLogMessage("Failed to toggle checkboxes (not supported?)"); wxLogMessage("Failed to toggle checkboxes (not supported?)");
} }
else else
{ {
wxLogMessage("Checkboxes are now %s", wxLogMessage("Checkboxes are now %s",
m_listCtrl->HasCheckboxes() ? "enabled" : "disabled"); m_listCtrl->HasCheckBoxes() ? "enabled" : "disabled");
} }
} }
void MyFrame::OnUpdateToggleCheckboxes(wxUpdateUIEvent& event) void MyFrame::OnUpdateToggleCheckboxes(wxUpdateUIEvent& event)
{ {
bool cbEnabled = m_listCtrl->HasCheckboxes(); bool cbEnabled = m_listCtrl->HasCheckBoxes();
event.Check(cbEnabled); event.Check(cbEnabled);
GetMenuBar()->Enable(LIST_TOGGLE_CHECKBOX, cbEnabled); GetMenuBar()->Enable(LIST_TOGGLE_CHECKBOX, cbEnabled);
GetMenuBar()->Enable(LIST_GET_CHECKBOX, cbEnabled); GetMenuBar()->Enable(LIST_GET_CHECKBOX, cbEnabled);

View File

@@ -797,7 +797,7 @@ void wxListLineData::DrawInReportMode( wxDC *dc,
x += 2; x += 2;
#endif #endif
if ( m_owner->HasCheckboxes() ) if ( m_owner->HasCheckBoxes() )
{ {
wxSize cbSize = wxRendererNative::Get().GetCheckBoxSize(m_owner); wxSize cbSize = wxRendererNative::Get().GetCheckBoxSize(m_owner);
int yOffset = (rect.height - cbSize.GetHeight()) / 2; int yOffset = (rect.height - cbSize.GetHeight()) / 2;
@@ -820,7 +820,7 @@ void wxListLineData::DrawInReportMode( wxDC *dc,
wxListItemData *item = node->GetData(); wxListItemData *item = node->GetData();
int width = m_owner->GetColumnWidth(col); int width = m_owner->GetColumnWidth(col);
if (col == 0 && m_owner->HasCheckboxes()) if (col == 0 && m_owner->HasCheckBoxes())
width -= x; width -= x;
int xOld = x; int xOld = x;
x += width; x += width;
@@ -1609,7 +1609,7 @@ void wxListMainWindow::Init()
m_lineSelectSingleOnUp = m_lineSelectSingleOnUp =
m_lineBeforeLastClicked = (size_t)-1; m_lineBeforeLastClicked = (size_t)-1;
m_hasCheckboxes = false; m_hasCheckBoxes = false;
} }
wxListMainWindow::wxListMainWindow() wxListMainWindow::wxListMainWindow()
@@ -3703,14 +3703,14 @@ bool wxListMainWindow::GetItemPosition(long item, wxPoint& pos) const
// checkboxes // checkboxes
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
bool wxListMainWindow::HasCheckboxes() const bool wxListMainWindow::HasCheckBoxes() const
{ {
return m_hasCheckboxes; return m_hasCheckBoxes;
} }
bool wxListMainWindow::EnableCheckboxes(bool enable) bool wxListMainWindow::EnableCheckBoxes(bool enable)
{ {
m_hasCheckboxes = enable; m_hasCheckBoxes = enable;
m_dirty = true; m_dirty = true;
m_headerWidth = 0; m_headerWidth = 0;
@@ -3738,7 +3738,7 @@ bool wxListMainWindow::IsItemChecked(long item) const
bool wxListMainWindow::IsInsideCheckbox(long item, int x, int y) bool wxListMainWindow::IsInsideCheckbox(long item, int x, int y)
{ {
if ( HasCheckboxes() ) if ( HasCheckBoxes() )
{ {
wxRect lineRect = GetLineRect(item); wxRect lineRect = GetLineRect(item);
wxSize cbSize = wxRendererNative::Get().GetCheckBoxSize(this); wxSize cbSize = wxRendererNative::Get().GetCheckBoxSize(this);
@@ -4769,20 +4769,20 @@ void wxGenericListCtrl::OnScroll(wxScrollWinEvent& event)
event.Skip(); event.Skip();
} }
bool wxGenericListCtrl::HasCheckboxes() const bool wxGenericListCtrl::HasCheckBoxes() const
{ {
if (!InReportView()) if (!InReportView())
return false; return false;
return m_mainWin->HasCheckboxes(); return m_mainWin->HasCheckBoxes();
} }
bool wxGenericListCtrl::EnableCheckboxes(bool enable) bool wxGenericListCtrl::EnableCheckBoxes(bool enable)
{ {
if (!InReportView()) if (!InReportView())
return false; return false;
return m_mainWin->EnableCheckboxes(enable); return m_mainWin->EnableCheckBoxes(enable);
} }
void wxGenericListCtrl::CheckItem(long item, bool state) void wxGenericListCtrl::CheckItem(long item, bool state)

View File

@@ -1211,13 +1211,13 @@ wxFont wxListCtrl::GetItemFont( long item ) const
return f; return f;
} }
bool wxListCtrl::HasCheckboxes() const bool wxListCtrl::HasCheckBoxes() const
{ {
const DWORD currStyle = ListView_GetExtendedListViewStyle(GetHwnd()); const DWORD currStyle = ListView_GetExtendedListViewStyle(GetHwnd());
return (currStyle & LVS_EX_CHECKBOXES) != 0; return (currStyle & LVS_EX_CHECKBOXES) != 0;
} }
bool wxListCtrl::EnableCheckboxes(bool enable) bool wxListCtrl::EnableCheckBoxes(bool enable)
{ {
(void)ListView_SetExtendedListViewStyleEx(GetHwnd(), LVS_EX_CHECKBOXES, (void)ListView_SetExtendedListViewStyleEx(GetHwnd(), LVS_EX_CHECKBOXES,
enable ? LVS_EX_CHECKBOXES : 0); enable ? LVS_EX_CHECKBOXES : 0);