Save specified, not actual, col width in wxPersistentDataViewCtrl

This is more correct as saving the current width of the last column
would prevent the user from shrinking it under the last automatically
set size, i.e. the UI behaviour would change after restarting the
program, which shouldn't be the case.

Doing this required making WXGetManuallySetWidth(), which previously
existed in the generic version only, available in all ports, so do it
and also rename it to WXGetSpecifiedWidth() in the process, as this
seems a somewhat better name (it doesn't have to be manually specified,
i.e. it could also be done by the program itself or even implicitly by
wxPersistentDataViewCtrl).

Don't make this function public, at least for now, because it's not
clear how could it be useful and it might still need to be changed to
behave differently in the other ports.
This commit is contained in:
Vadim Zeitlin
2020-05-01 03:34:44 +02:00
parent 44578b883c
commit aacd26c27b
4 changed files with 19 additions and 5 deletions

View File

@@ -514,6 +514,12 @@ public:
virtual void SetBitmap( const wxBitmap& bitmap ) wxOVERRIDE { m_bitmap = bitmap; }
virtual wxBitmap GetBitmap() const wxOVERRIDE { return m_bitmap; }
// Special accessor for use by wxWidgets only returning the width that was
// explicitly set, either by the application, using SetWidth(), or by the
// user, resizing the column interactively. It is usually the same as
// GetWidth(), but can be different for the last column.
virtual int WXGetSpecifiedWidth() const { return GetWidth(); }
protected:
wxDataViewRenderer *m_renderer;
int m_model_column;