X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/465eba14839fd5c8752d0642f77d525a3407ebca..33820d94285c0004acce756e7d10d9698e6387d1:/src/osx/dataview_osx.cpp diff --git a/src/osx/dataview_osx.cpp b/src/osx/dataview_osx.cpp index f8a6889e1e..f2140e4e36 100644 --- a/src/osx/dataview_osx.cpp +++ b/src/osx/dataview_osx.cpp @@ -12,7 +12,6 @@ #if (wxUSE_DATAVIEWCTRL != 0) && (!defined(wxUSE_GENERICDATAVIEWCTRL) || (wxUSE_GENERICDATAVIEWCTRL == 0)) -#include #include #ifndef WX_PRECOMP @@ -38,7 +37,7 @@ wxString ConcatenateDataViewItemValues(wxDataViewCtrl const* dataViewCtrlPtr, wx { // variable definition: wxVariant dataValue; - + dataViewCtrlPtr->GetModel()->GetValue(dataValue,dataViewItem,dataViewCtrlPtr->GetColumn(i)->GetModelColumn()); if (i > 0) dataString << wxT('\t'); @@ -239,7 +238,7 @@ void wxOSXDataViewModelNotifier::AdjustRowHeight(wxDataViewItem const& item) for (col = 0; col < num; col++) { wxDataViewColumn* column(this->m_DataViewCtrlPtr->GetColumnPtr(col)); - + if (!(column->IsHidden())) { wxDataViewCustomRenderer *renderer = dynamic_cast(column->GetRenderer()); @@ -274,7 +273,7 @@ void wxOSXDataViewModelNotifier::AdjustRowHeights(wxDataViewItemArray const& ite for (col = 0; col < num; col++) { wxDataViewColumn* column(this->m_DataViewCtrlPtr->GetColumnPtr(col)); - + if (!(column->IsHidden())) { wxDataViewCustomRenderer *renderer = dynamic_cast(column->GetRenderer()); @@ -627,7 +626,8 @@ void wxDataViewCtrl::FinishCustomItemEditing(void) } /*static*/ -wxVisualAttributes wxDataViewCtrl::GetClassDefaultAttributes(wxWindowVariant variant) +wxVisualAttributes +wxDataViewCtrl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) { wxVisualAttributes attr; @@ -676,10 +676,72 @@ void wxDataViewCtrl::OnSize(wxSizeEvent& event) event.Skip(); } +wxSize wxDataViewCtrl::DoGetBestSize() const +{ + wxSize best = wxControl::DoGetBestSize(); + best.y = 80; + + return best; +} + +void wxDataViewCtrl::OnMouse(wxMouseEvent& event) +{ + event.Skip(); + + if (GetModel() == NULL) + return; + +#if 0 + // Doesn't compile anymore + 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 ); +#endif +} + IMPLEMENT_DYNAMIC_CLASS(wxDataViewCtrl,wxDataViewCtrlBase) BEGIN_EVENT_TABLE(wxDataViewCtrl,wxDataViewCtrlBase) EVT_SIZE(wxDataViewCtrl::OnSize) + EVT_MOTION(wxDataViewCtrl::OnMouse) END_EVENT_TABLE() #endif // (wxUSE_DATAVIEWCTRL != 0) && (!defined(wxUSE_GENERICDATAVIEWCTRL) || (wxUSE_GENERICDATAVIEWCTRL == 0))