Add support for wxDV_NO_HEADER to OS X/Cocoa wxDataViewCtrl.
Also use this flag with the tree control in the sample to test it and also because it doesn't make much sense to have a single column without title anyhow. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62601 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -502,6 +502,8 @@ public:
|
|||||||
id GetItemAtRow(int row) const;
|
id GetItemAtRow(int row) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void InitOutlineView(long style);
|
||||||
|
|
||||||
wxCocoaOutlineDataSource* m_DataSource;
|
wxCocoaOutlineDataSource* m_DataSource;
|
||||||
|
|
||||||
wxCocoaOutlineView* m_OutlineView;
|
wxCocoaOutlineView* m_OutlineView;
|
||||||
|
@@ -604,7 +604,7 @@ void MyFrame::BuildDataViewCtrl(wxPanel* parent, unsigned int nPanel, unsigned l
|
|||||||
wxASSERT(!m_ctrl[3]);
|
wxASSERT(!m_ctrl[3]);
|
||||||
wxDataViewTreeCtrl* tc =
|
wxDataViewTreeCtrl* tc =
|
||||||
new wxDataViewTreeCtrl( parent, wxID_ANY, wxDefaultPosition,
|
new wxDataViewTreeCtrl( parent, wxID_ANY, wxDefaultPosition,
|
||||||
wxDefaultSize, style );
|
wxDefaultSize, style | wxDV_NO_HEADER );
|
||||||
m_ctrl[3] = tc;
|
m_ctrl[3] = tc;
|
||||||
|
|
||||||
wxImageList *ilist = new wxImageList( 16, 16 );
|
wxImageList *ilist = new wxImageList( 16, 16 );
|
||||||
|
@@ -1818,12 +1818,16 @@ wxCocoaDataViewControl::wxCocoaDataViewControl(wxWindow* peer,
|
|||||||
[scrollview setAutohidesScrollers:YES];
|
[scrollview setAutohidesScrollers:YES];
|
||||||
[scrollview setDocumentView:m_OutlineView];
|
[scrollview setDocumentView:m_OutlineView];
|
||||||
|
|
||||||
// setting up the native control itself
|
// initialize the native control itself too
|
||||||
NSUInteger maskGridStyle(NSTableViewGridNone);
|
InitOutlineView(style);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxCocoaDataViewControl::InitOutlineView(long style)
|
||||||
|
{
|
||||||
[m_OutlineView setImplementation:this];
|
[m_OutlineView setImplementation:this];
|
||||||
[m_OutlineView setColumnAutoresizingStyle:NSTableViewSequentialColumnAutoresizingStyle];
|
[m_OutlineView setColumnAutoresizingStyle:NSTableViewSequentialColumnAutoresizingStyle];
|
||||||
[m_OutlineView setIndentationPerLevel:GetDataViewCtrl()->GetIndent()];
|
[m_OutlineView setIndentationPerLevel:GetDataViewCtrl()->GetIndent()];
|
||||||
|
NSUInteger maskGridStyle(NSTableViewGridNone);
|
||||||
if (style & wxDV_HORIZ_RULES)
|
if (style & wxDV_HORIZ_RULES)
|
||||||
maskGridStyle |= NSTableViewSolidHorizontalGridLineMask;
|
maskGridStyle |= NSTableViewSolidHorizontalGridLineMask;
|
||||||
if (style & wxDV_VERT_RULES)
|
if (style & wxDV_VERT_RULES)
|
||||||
@@ -1831,6 +1835,9 @@ wxCocoaDataViewControl::wxCocoaDataViewControl(wxWindow* peer,
|
|||||||
[m_OutlineView setGridStyleMask:maskGridStyle];
|
[m_OutlineView setGridStyleMask:maskGridStyle];
|
||||||
[m_OutlineView setAllowsMultipleSelection: (style & wxDV_MULTIPLE) != 0];
|
[m_OutlineView setAllowsMultipleSelection: (style & wxDV_MULTIPLE) != 0];
|
||||||
[m_OutlineView setUsesAlternatingRowBackgroundColors:(style & wxDV_ROW_LINES) != 0];
|
[m_OutlineView setUsesAlternatingRowBackgroundColors:(style & wxDV_ROW_LINES) != 0];
|
||||||
|
|
||||||
|
if ( style & wxDV_NO_HEADER )
|
||||||
|
[m_OutlineView setHeaderView:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCocoaDataViewControl::~wxCocoaDataViewControl()
|
wxCocoaDataViewControl::~wxCocoaDataViewControl()
|
||||||
@@ -1844,24 +1851,16 @@ wxCocoaDataViewControl::~wxCocoaDataViewControl()
|
|||||||
//
|
//
|
||||||
bool wxCocoaDataViewControl::ClearColumns()
|
bool wxCocoaDataViewControl::ClearColumns()
|
||||||
{
|
{
|
||||||
bool const bufAllowsMultipleSelection = [m_OutlineView allowsMultipleSelection];
|
|
||||||
|
|
||||||
|
|
||||||
// as there is a bug in NSOutlineView version (OSX 10.5.6 #6555162) the
|
// as there is a bug in NSOutlineView version (OSX 10.5.6 #6555162) the
|
||||||
// columns cannot be deleted if there is an outline column in the view;
|
// columns cannot be deleted if there is an outline column in the view;
|
||||||
// therefore, the whole view is deleted and newly constructed:
|
// therefore, the whole view is deleted and newly constructed:
|
||||||
[m_OutlineView release];
|
[m_OutlineView release];
|
||||||
m_OutlineView = [[wxCocoaOutlineView alloc] init];
|
m_OutlineView = [[wxCocoaOutlineView alloc] init];
|
||||||
[((NSScrollView*) GetWXWidget()) setDocumentView:m_OutlineView];
|
[((NSScrollView*) GetWXWidget()) setDocumentView:m_OutlineView];
|
||||||
|
|
||||||
// setting up the native control itself
|
|
||||||
[m_OutlineView setImplementation:this];
|
|
||||||
[m_OutlineView setColumnAutoresizingStyle:NSTableViewSequentialColumnAutoresizingStyle];
|
|
||||||
[m_OutlineView setIndentationPerLevel:GetDataViewCtrl()->GetIndent()];
|
|
||||||
if (bufAllowsMultipleSelection)
|
|
||||||
[m_OutlineView setAllowsMultipleSelection:YES];
|
|
||||||
[m_OutlineView setDataSource:m_DataSource];
|
[m_OutlineView setDataSource:m_DataSource];
|
||||||
// done:
|
|
||||||
|
InitOutlineView(GetDataViewCtrl()->GetWindowStyle());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user