X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4219d8b027a351fb6c2d1580c292e639bd322f77..f8d0234d39c66f3d1d7fc2346562cb96c8c7be20:/src/osx/carbon/dataview.cpp diff --git a/src/osx/carbon/dataview.cpp b/src/osx/carbon/dataview.cpp index dd3cebff16..8eeeac29a9 100644 --- a/src/osx/carbon/dataview.cpp +++ b/src/osx/carbon/dataview.cpp @@ -1051,12 +1051,12 @@ bool wxDataViewCtrl::AssociateModel(wxDataViewModel* model) bool wxDataViewCtrl::AppendColumn(wxDataViewColumn* columnPtr) { - return InsertColumn( kDataBrowserListViewAppendColumn, columnPtr ); + return wxDataViewCtrl::InsertColumn( GetColumnCount(), columnPtr ); } bool wxDataViewCtrl::PrependColumn(wxDataViewColumn* columnPtr) { - return InsertColumn( 0, columnPtr ); + return wxDataViewCtrl::InsertColumn( 0, columnPtr ); } bool wxDataViewCtrl::InsertColumn(unsigned int pos, wxDataViewColumn* columnPtr) @@ -1083,7 +1083,7 @@ bool wxDataViewCtrl::InsertColumn(unsigned int pos, wxDataViewColumn* columnPtr) // full column variable initialization: columnPtr->SetPropertyID(NewPropertyID); // add column to wxWidget's internal structure: - wxCHECK_MSG(this->wxDataViewCtrlBase::AppendColumn(columnPtr) && + wxCHECK_MSG(this->wxDataViewCtrlBase::InsertColumn(pos,columnPtr) && m_ColumnPointers.insert(ColumnPointerHashMapType::value_type(NewPropertyID,columnPtr)).second,false,_("Could not add column to internal structures.")); // create a column description and add column to the native control: wxCHECK_MSG(::InitializeColumnDescription(columnDescription,columnPtr,NewPropertyID,title), false,_("Column description could not be initialized.")); @@ -1460,6 +1460,56 @@ void wxDataViewCtrl::DoSetIndent() } // event handling: +void wxDataViewCtrl::OnMouse(wxMouseEvent& event) +{ + event.Skip(); + + if (GetModel() == NULL) + return; + + wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast(m_peer)); + + int NoOfChildren; + wxDataViewItemArray items; + NoOfChildren = GetModel()->GetChildren( wxDataViewItem(), items); + if (NoOfChildren == 0) + return; + wxDataViewItem firstChild = items[0]; + + UInt16 headerHeight = 0; + MacDataViewListCtrlPtr->GetHeaderButtonHeight(&headerHeight); + + + if (event.GetY() < headerHeight) + { + unsigned int col_count = GetColumnCount(); + unsigned int col; + for (col = 0; col < col_count; col++) + { + wxDataViewColumn *column = GetColumn( col ); + if (column->IsHidden()) + continue; + + Rect itemrect; + ::GetDataBrowserItemPartBounds( MacDataViewListCtrlPtr->GetControlRef(), + reinterpret_cast(firstChild.GetID()), column->GetPropertyID(), + kDataBrowserPropertyEnclosingPart, &itemrect ); + + if (abs( event.GetX() - itemrect.right) < 3) + { + if (column->GetFlags() & wxDATAVIEW_COL_RESIZABLE) + SetCursor( wxCursor( wxCURSOR_SIZEWE ) ); + else + SetCursor( *wxSTANDARD_CURSOR ); + return; + } + } + + } + + SetCursor( *wxSTANDARD_CURSOR ); +} + void wxDataViewCtrl::OnSize(wxSizeEvent& event) { unsigned int const NoOfColumns = this->GetColumnCount(); @@ -1497,6 +1547,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxDataViewCtrl,wxDataViewCtrlBase) BEGIN_EVENT_TABLE(wxDataViewCtrl,wxDataViewCtrlBase) EVT_SIZE(wxDataViewCtrl::OnSize) + EVT_MOTION(wxDataViewCtrl::OnMouse) END_EVENT_TABLE() #endif // !wxUSE_GENERICDATAVIEWCTRL