From 602111f2b3b4720d2676e2ed3256fc5fcea9763b Mon Sep 17 00:00:00 2001 From: Dimitri Schoolwerth Date: Thu, 21 Apr 2016 15:23:21 +0000 Subject: [PATCH] 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 --- docs/changes.txt | 7 +++++++ include/wx/generic/listctrl.h | 4 ++-- include/wx/generic/private/listctrl.h | 6 +++--- include/wx/listbase.h | 4 ++-- include/wx/msw/listctrl.h | 4 ++-- interface/wx/listctrl.h | 8 ++++---- samples/listctrl/listtest.cpp | 6 +++--- src/generic/listctrl.cpp | 24 ++++++++++++------------ src/msw/listctrl.cpp | 4 ++-- 9 files changed, 37 insertions(+), 30 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 8bf63bcef4..34ae4ae0aa 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -55,6 +55,13 @@ Changes in behaviour which may result in build errors 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: - Add support for the micro version (third component) to OS and toolkit version diff --git a/include/wx/generic/listctrl.h b/include/wx/generic/listctrl.h index d706cb813e..0bbe5d2cbb 100644 --- a/include/wx/generic/listctrl.h +++ b/include/wx/generic/listctrl.h @@ -101,8 +101,8 @@ public: void SetTextColour(const wxColour& col); long GetTopItem() const; - virtual bool HasCheckboxes() const wxOVERRIDE; - virtual bool EnableCheckboxes(bool enable = true) wxOVERRIDE; + 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; diff --git a/include/wx/generic/private/listctrl.h b/include/wx/generic/private/listctrl.h index 9cd50707a8..8cf57a455a 100644 --- a/include/wx/generic/private/listctrl.h +++ b/include/wx/generic/private/listctrl.h @@ -641,8 +641,8 @@ public: bool GetItemPosition( long item, wxPoint& pos ) const; int GetSelectedItemCount() const; - bool HasCheckboxes() const; - bool EnableCheckboxes(bool enable = true); + bool HasCheckBoxes() const; + bool EnableCheckBoxes(bool enable = true); bool IsItemChecked(long item) const; void CheckItem(long item, bool check); @@ -789,7 +789,7 @@ protected: m_lineBeforeLastClicked, m_lineSelectSingleOnUp; - bool m_hasCheckboxes; + bool m_hasCheckBoxes; protected: wxWindow *GetMainWindowOfCompositeControl() wxOVERRIDE { return GetParent(); } diff --git a/include/wx/listbase.h b/include/wx/listbase.h index 1c79de0084..ddc6678bf3 100644 --- a/include/wx/listbase.h +++ b/include/wx/listbase.h @@ -461,8 +461,8 @@ public: wxColour GetAlternateRowColour() const { return m_alternateRowColour.GetBackgroundColour(); } // Checkboxes support: only implemented in wxMSW currently. - virtual bool HasCheckboxes() const { return false; } - virtual bool EnableCheckboxes(bool WXUNUSED(enable) = true) { return false; } + virtual bool HasCheckBoxes() const { return false; } + virtual bool EnableCheckBoxes(bool WXUNUSED(enable) = true) { return false; } virtual bool IsItemChecked(long WXUNUSED(item)) const { return false; } virtual void CheckItem(long WXUNUSED(item), bool WXUNUSED(check)) { } diff --git a/include/wx/msw/listctrl.h b/include/wx/msw/listctrl.h index 1b8beaed63..998ed0dac4 100644 --- a/include/wx/msw/listctrl.h +++ b/include/wx/msw/listctrl.h @@ -217,8 +217,8 @@ public: wxFont GetItemFont( long item ) const; // Checkbox state of an item - virtual bool HasCheckboxes() const wxOVERRIDE; - virtual bool EnableCheckboxes(bool enable = true) wxOVERRIDE; + 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; diff --git a/interface/wx/listctrl.h b/interface/wx/listctrl.h index cfe47e97df..0f4c3fa266 100644 --- a/interface/wx/listctrl.h +++ b/interface/wx/listctrl.h @@ -1230,11 +1230,11 @@ public: /** Returns true if checkboxes are enabled for list items. - @see EnableCheckboxes() + @see EnableCheckBoxes() @since 3.1.0 */ - bool HasCheckboxes() const; + bool HasCheckBoxes() const; /** Enable or disable checkboxes for list items. @@ -1244,7 +1244,7 @@ public: @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. @@ -1261,7 +1261,7 @@ public: Check or uncheck a wxListItem in a control using checkboxes. This method only works if checkboxes support had been successfully - enabled using EnableCheckboxes(). + enabled using EnableCheckBoxes(). @param item Item (zero-based) index. @param check If @true, check the item, otherwise uncheck. diff --git a/samples/listctrl/listtest.cpp b/samples/listctrl/listtest.cpp index c96eab1366..10dac9d20a 100644 --- a/samples/listctrl/listtest.cpp +++ b/samples/listctrl/listtest.cpp @@ -847,20 +847,20 @@ void MyFrame::OnUpdateToggleMultiSel(wxUpdateUIEvent& 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?)"); } else { wxLogMessage("Checkboxes are now %s", - m_listCtrl->HasCheckboxes() ? "enabled" : "disabled"); + m_listCtrl->HasCheckBoxes() ? "enabled" : "disabled"); } } void MyFrame::OnUpdateToggleCheckboxes(wxUpdateUIEvent& event) { - bool cbEnabled = m_listCtrl->HasCheckboxes(); + bool cbEnabled = m_listCtrl->HasCheckBoxes(); event.Check(cbEnabled); GetMenuBar()->Enable(LIST_TOGGLE_CHECKBOX, cbEnabled); GetMenuBar()->Enable(LIST_GET_CHECKBOX, cbEnabled); diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index ef7aa27c6c..70bdefab95 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -797,7 +797,7 @@ void wxListLineData::DrawInReportMode( wxDC *dc, x += 2; #endif - if ( m_owner->HasCheckboxes() ) + if ( m_owner->HasCheckBoxes() ) { wxSize cbSize = wxRendererNative::Get().GetCheckBoxSize(m_owner); int yOffset = (rect.height - cbSize.GetHeight()) / 2; @@ -820,7 +820,7 @@ void wxListLineData::DrawInReportMode( wxDC *dc, wxListItemData *item = node->GetData(); int width = m_owner->GetColumnWidth(col); - if (col == 0 && m_owner->HasCheckboxes()) + if (col == 0 && m_owner->HasCheckBoxes()) width -= x; int xOld = x; x += width; @@ -1609,7 +1609,7 @@ void wxListMainWindow::Init() m_lineSelectSingleOnUp = m_lineBeforeLastClicked = (size_t)-1; - m_hasCheckboxes = false; + m_hasCheckBoxes = false; } wxListMainWindow::wxListMainWindow() @@ -3703,14 +3703,14 @@ bool wxListMainWindow::GetItemPosition(long item, wxPoint& pos) const // 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_headerWidth = 0; @@ -3738,7 +3738,7 @@ bool wxListMainWindow::IsItemChecked(long item) const bool wxListMainWindow::IsInsideCheckbox(long item, int x, int y) { - if ( HasCheckboxes() ) + if ( HasCheckBoxes() ) { wxRect lineRect = GetLineRect(item); wxSize cbSize = wxRendererNative::Get().GetCheckBoxSize(this); @@ -4769,20 +4769,20 @@ void wxGenericListCtrl::OnScroll(wxScrollWinEvent& event) event.Skip(); } -bool wxGenericListCtrl::HasCheckboxes() const +bool wxGenericListCtrl::HasCheckBoxes() const { if (!InReportView()) return false; - return m_mainWin->HasCheckboxes(); + return m_mainWin->HasCheckBoxes(); } -bool wxGenericListCtrl::EnableCheckboxes(bool enable) +bool wxGenericListCtrl::EnableCheckBoxes(bool enable) { if (!InReportView()) return false; - return m_mainWin->EnableCheckboxes(enable); + return m_mainWin->EnableCheckBoxes(enable); } void wxGenericListCtrl::CheckItem(long item, bool state) diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index e37f779da2..419ec54aa2 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -1211,13 +1211,13 @@ wxFont wxListCtrl::GetItemFont( long item ) const return f; } -bool wxListCtrl::HasCheckboxes() const +bool wxListCtrl::HasCheckBoxes() const { const DWORD currStyle = ListView_GetExtendedListViewStyle(GetHwnd()); return (currStyle & LVS_EX_CHECKBOXES) != 0; } -bool wxListCtrl::EnableCheckboxes(bool enable) +bool wxListCtrl::EnableCheckBoxes(bool enable) { (void)ListView_SetExtendedListViewStyleEx(GetHwnd(), LVS_EX_CHECKBOXES, enable ? LVS_EX_CHECKBOXES : 0);