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:
@@ -61,7 +61,15 @@ public:
|
||||
SaveValue(columnPrefix + wxPERSIST_DVC_HIDDEN, column->IsHidden());
|
||||
SaveValue(columnPrefix + wxPERSIST_DVC_POS,
|
||||
control->GetColumnPosition(column));
|
||||
SaveValue(columnPrefix + wxPERSIST_DVC_WIDTH, column->GetWidth());
|
||||
|
||||
// We take special care to save only the specified width instead of
|
||||
// the currently used one. Usually they're one and the same, but
|
||||
// they can be different for the last column, whose size can be
|
||||
// greater than specified, as it's always expanded to fill the
|
||||
// entire control width.
|
||||
const int width = column->WXGetSpecifiedWidth();
|
||||
if ( width > 0 )
|
||||
SaveValue(columnPrefix + wxPERSIST_DVC_WIDTH, width);
|
||||
|
||||
// Check if this column is the current sort key.
|
||||
if ( column->IsSortKey() )
|
||||
|
Reference in New Issue
Block a user