Revert "Fix sizing of temporarily last columns in macOS wxDataViewCtrl"
This reverts commit c9221fd538
.
This commit is contained in:
@@ -86,7 +86,7 @@ class wxCocoaDataViewControl;
|
||||
class wxDataViewColumnNativeData
|
||||
{
|
||||
public:
|
||||
wxDataViewColumnNativeData() : m_NativeColumnPtr(NULL), m_isLast(false), m_prevWidth(0)
|
||||
wxDataViewColumnNativeData() : m_NativeColumnPtr(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -105,32 +105,9 @@ public:
|
||||
m_NativeColumnPtr = newNativeColumnPtr;
|
||||
}
|
||||
|
||||
bool GetIsLast() const
|
||||
{
|
||||
return m_isLast;
|
||||
}
|
||||
|
||||
void SetIsLast(bool isLast)
|
||||
{
|
||||
m_isLast = isLast;
|
||||
}
|
||||
|
||||
int GetPrevWidth() const
|
||||
{
|
||||
return m_prevWidth;
|
||||
}
|
||||
|
||||
void SetPrevWidth(int prevWidth)
|
||||
{
|
||||
m_prevWidth = prevWidth;
|
||||
}
|
||||
|
||||
private:
|
||||
// not owned by us
|
||||
NSTableColumn* m_NativeColumnPtr;
|
||||
|
||||
bool m_isLast;
|
||||
int m_prevWidth;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
@@ -2243,8 +2243,7 @@ bool wxCocoaDataViewControl::InsertColumn(unsigned int pos, wxDataViewColumn* co
|
||||
void wxCocoaDataViewControl::FitColumnWidthToContent(unsigned int pos)
|
||||
{
|
||||
const int count = GetCount();
|
||||
wxDataViewColumnNativeData *nativeData = GetColumn(pos)->GetNativeData();
|
||||
NSTableColumn *column = nativeData->GetNativeColumnPtr();
|
||||
NSTableColumn *column = GetColumn(pos)->GetNativeData()->GetNativeColumnPtr();
|
||||
UInt32 const noOfColumns = [[m_OutlineView tableColumns] count];
|
||||
|
||||
class MaxWidthCalculator
|
||||
@@ -2376,31 +2375,10 @@ void wxCocoaDataViewControl::FitColumnWidthToContent(unsigned int pos)
|
||||
if ( m_expanderWidth == 0 )
|
||||
m_expanderWidth = calculator.GetExpanderWidth();
|
||||
|
||||
const bool isLast = pos == noOfColumns - 1;
|
||||
|
||||
if ( isLast )
|
||||
{
|
||||
// Note that FitColumnWidthToContent() is called whenever a column is
|
||||
// added, so we might also just temporarily become the last column;
|
||||
// since we cannot know at this time whether we will just temporarily
|
||||
// be the last column, we store our current column width in order to
|
||||
// restore it later in case we suddenly are no longer the last column
|
||||
// because new columns have been added --> we need to restore our
|
||||
// previous width in that case because it must not get lost.
|
||||
nativeData->SetPrevWidth(GetColumn(pos)->GetWidth());
|
||||
|
||||
if ( pos == noOfColumns - 1 )
|
||||
[m_OutlineView sizeLastColumnToFit];
|
||||
}
|
||||
else if ( GetColumn(pos)->GetWidthVariable() == wxCOL_WIDTH_AUTOSIZE )
|
||||
{
|
||||
[column setWidth:calculator.GetMaxWidth() + m_expanderWidth];
|
||||
}
|
||||
else if ( nativeData->GetIsLast() )
|
||||
{
|
||||
[column setWidth:nativeData->GetPrevWidth()];
|
||||
}
|
||||
|
||||
nativeData->SetIsLast(isLast);
|
||||
|
||||
if ( !(GetDataViewCtrl()->GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT) )
|
||||
{
|
||||
|
@@ -438,9 +438,6 @@ bool wxDataViewCtrl::InsertColumn(unsigned int pos, wxDataViewColumn* columnPtr)
|
||||
// otherwise ask the control to 'update' the data in the newly appended column:
|
||||
if (GetColumnCount() == 1)
|
||||
SetExpanderColumn(columnPtr);
|
||||
|
||||
AdjustAutosizedColumns();
|
||||
|
||||
// done:
|
||||
return true;
|
||||
}
|
||||
@@ -482,8 +479,6 @@ bool wxDataViewCtrl::DeleteColumn(wxDataViewColumn* columnPtr)
|
||||
{
|
||||
m_ColumnPtrs.Remove(columnPtr);
|
||||
delete columnPtr;
|
||||
|
||||
AdjustAutosizedColumns();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user