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:
@@ -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,
|
||||
|
@@ -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 =
|
||||
|
Reference in New Issue
Block a user