Allow increasing the size of the last column in wxDataViewCtrl

Previously, the last column couldn't be effectively resized at all, as
its size was always automatically set to the remaining width of the
window after subtracting the widths of all the previous columns. Now
this is only done if this remaining width is greater than the width
given to the column by the user or by the program.

Effectively, this means that the user can now drag-resize the column to
increase its size (at the price of showing the horizontal scrollbar).

See #18295.
This commit is contained in:
Vadim Zeitlin
2018-12-15 14:27:52 +01:00
parent 68bb67c009
commit 2340a16d18
3 changed files with 24 additions and 6 deletions

View File

@@ -74,6 +74,11 @@ public:
// UpdateWidth() if the width didn't really change, even if we don't
// care about its return value.
(void)WXUpdateWidth(width);
// Do remember the last explicitly set width: this is used to prevent
// UpdateColumnSizes() from resizing the last column to be smaller than
// this size.
m_manuallySetWidth = width;
}
virtual int GetWidth() const wxOVERRIDE;
@@ -137,9 +142,15 @@ public:
m_width = width;
UpdateWidth();
// We must not update m_manuallySetWidth here as this method is called by
// UpdateColumnSizes() which resizes the column automatically, and not
// "manually".
return true;
}
int WXGetManuallySetWidth() const { return m_manuallySetWidth; }
private:
// common part of all ctors
void Init(int width, wxAlignment align, int flags);
@@ -152,6 +163,7 @@ private:
wxString m_title;
int m_width,
m_manuallySetWidth,
m_minWidth;
wxAlignment m_align;
int m_flags;