From 0eb456f08e7f6322232bfeb33c392a0c91913ea1 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 2 Dec 2017 23:07:46 +0100 Subject: [PATCH] Revert "Fix wxTreeListCtrl under wxOSX" This reverts commit 28f96bdff022da758beb802b34b5bcda77d8031d as it isn't necessary any more after the fix in the previous commit. See #17409. --- include/wx/osx/cocoa/dataview.h | 2 -- src/osx/cocoa/dataview.mm | 30 ++++++++---------------------- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/include/wx/osx/cocoa/dataview.h b/include/wx/osx/cocoa/dataview.h index 6587f97bd9..ffe1ac2e5d 100644 --- a/include/wx/osx/cocoa/dataview.h +++ b/include/wx/osx/cocoa/dataview.h @@ -551,8 +551,6 @@ private: wxCocoaOutlineDataSource* m_DataSource; wxCocoaOutlineView* m_OutlineView; - - bool m_removeIndentIfNecessary; }; #endif // _WX_DATAVIEWCTRL_COCOOA_H_ diff --git a/src/osx/cocoa/dataview.mm b/src/osx/cocoa/dataview.mm index 9b0207eb92..c48c9c976e 100644 --- a/src/osx/cocoa/dataview.mm +++ b/src/osx/cocoa/dataview.mm @@ -2033,8 +2033,7 @@ wxCocoaDataViewControl::wxCocoaDataViewControl(wxWindow* peer, [[NSScrollView alloc] initWithFrame:wxOSXGetFrameForControl(peer,pos,size)] ), m_DataSource(NULL), - m_OutlineView([[wxCocoaOutlineView alloc] init]), - m_removeIndentIfNecessary(false) + m_OutlineView([[wxCocoaOutlineView alloc] init]) { // initialize scrollview (the outline view is part of a scrollview): NSScrollView* scrollview = (NSScrollView*) GetWXWidget(); @@ -2408,11 +2407,13 @@ bool wxCocoaDataViewControl::AssociateModel(wxDataViewModel* model) m_DataSource = NULL; [m_OutlineView setDataSource:m_DataSource]; // if there is a data source the data is immediately going to be requested - // Set this to true to check if we need to remove the indent in the next - // OnSize() call: we can't do it directly here because the model might not - // be fully initialized yet and so might not know whether it has any items - // with children or not. - m_removeIndentIfNecessary = true; + // By default, the first column is indented to leave enough place for the + // expanders, but this looks bad if there are no expanders, so don't use + // indent in this case. + if ( model && model->IsListModel() ) + { + DoSetIndent(0); + } return true; } @@ -2577,21 +2578,6 @@ void wxCocoaDataViewControl::SetRowHeight(const wxDataViewItem& WXUNUSED(item), void wxCocoaDataViewControl::OnSize() { - if ( m_removeIndentIfNecessary ) - { - m_removeIndentIfNecessary = false; - - const wxDataViewModel* const model = GetDataViewCtrl()->GetModel(); - - // By default, the first column is indented to leave enough place for the - // expanders, but this looks bad if there are no expanders, so don't use - // indent in this case. - if ( model && model->IsListModel() ) - { - DoSetIndent(0); - } - } - if ([m_OutlineView numberOfColumns] == 1) [m_OutlineView sizeLastColumnToFit]; }