Fix width of the wxDataViewTreeCtrl column under OSX/Cocoa.
Set the column resizing mode to "automatic" instead of "none" if the control doesn't show the header. This allows the native control to properly resize the only tree control column to always take up the entire window size (provided we don't explicitly create it resizeable, so don't do this). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2064,7 +2064,15 @@ bool wxDataViewTreeCtrl::Create( wxWindow *parent, wxWindowID id,
|
|||||||
AssociateModel( store );
|
AssociateModel( store );
|
||||||
store->DecRef();
|
store->DecRef();
|
||||||
|
|
||||||
AppendIconTextColumn(wxString(),0,wxDATAVIEW_CELL_EDITABLE,-1);
|
AppendIconTextColumn
|
||||||
|
(
|
||||||
|
wxString(), // no label (header is not shown anyhow)
|
||||||
|
0, // the only model column
|
||||||
|
wxDATAVIEW_CELL_EDITABLE,
|
||||||
|
-1, // default width
|
||||||
|
wxALIGN_NOT, // and alignment
|
||||||
|
0 // not resizeable
|
||||||
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -323,18 +323,24 @@ NSTableColumn* CreateNativeColumn(const wxDataViewColumn *column)
|
|||||||
|
|
||||||
// setting the size related parameters:
|
// setting the size related parameters:
|
||||||
const int width = column->GetWidthVariable();
|
const int width = column->GetWidthVariable();
|
||||||
|
int resizingMask;
|
||||||
if (column->IsResizeable())
|
if (column->IsResizeable())
|
||||||
{
|
{
|
||||||
[nativeColumn setResizingMask:NSTableColumnUserResizingMask];
|
resizingMask = NSTableColumnUserResizingMask;
|
||||||
[nativeColumn setMinWidth:column->GetMinWidth()];
|
[nativeColumn setMinWidth:column->GetMinWidth()];
|
||||||
[nativeColumn setMaxWidth:column->GetMaxWidth()];
|
[nativeColumn setMaxWidth:column->GetMaxWidth()];
|
||||||
}
|
}
|
||||||
else
|
else // column is not resizeable [by user]
|
||||||
{
|
{
|
||||||
[nativeColumn setResizingMask:NSTableColumnNoResizing];
|
// if the control doesn't show a header, make the columns resize
|
||||||
[nativeColumn setMinWidth:width];
|
// automatically, this is particularly important for the single column
|
||||||
[nativeColumn setMaxWidth:width];
|
// controls (such as wxDataViewTreeCtrl) as their unique column should
|
||||||
|
// always take up all the available splace
|
||||||
|
resizingMask = column->GetOwner()->HasFlag(wxDV_NO_HEADER)
|
||||||
|
? NSTableColumnAutoresizingMask
|
||||||
|
: NSTableColumnNoResizing;
|
||||||
}
|
}
|
||||||
|
[nativeColumn setResizingMask:resizingMask];
|
||||||
[nativeColumn setWidth:width];
|
[nativeColumn setWidth:width];
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||||
|
Reference in New Issue
Block a user