Refactor generic wxDataViewColumn to use DoGetEffectiveWidth()

This function will be used for m_manuallySetWidth too, in addition to
m_width, in the next commit.

No changes yet in this one.
This commit is contained in:
Vadim Zeitlin
2020-05-01 03:25:52 +02:00
parent ecc58e5211
commit 6c5f3f8929
2 changed files with 13 additions and 3 deletions

View File

@@ -166,6 +166,11 @@ private:
void UpdateDisplay();
void UpdateWidth();
// Return the effective value corresponding to the given width, handling
// its negative values such as wxCOL_WIDTH_DEFAULT.
int DoGetEffectiveWidth(int width) const;
wxString m_title;
int m_width,
m_manuallySetWidth,

View File

@@ -188,9 +188,9 @@ void wxDataViewColumn::Init(int width, wxAlignment align, int flags)
m_sortAscending = true;
}
int wxDataViewColumn::GetWidth() const
int wxDataViewColumn::DoGetEffectiveWidth(int width) const
{
switch ( m_width )
switch ( width )
{
case wxCOL_WIDTH_DEFAULT:
return wxWindow::FromDIP(wxDVC_DEFAULT_WIDTH, m_owner);
@@ -200,10 +200,15 @@ int wxDataViewColumn::GetWidth() const
return m_owner->GetBestColumnWidth(m_owner->GetColumnIndex(this));
default:
return m_width;
return width;
}
}
int wxDataViewColumn::GetWidth() const
{
return DoGetEffectiveWidth(m_width);
}
void wxDataViewColumn::WXOnResize(int width)
{
m_width =