X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a5fb925380c924f2e34dd3de0dc2fa8bb2391ee3..9d46359178b28cd86e189e877015a8e69ff5bbaa:/src/mac/carbon/dataview.cpp diff --git a/src/mac/carbon/dataview.cpp b/src/mac/carbon/dataview.cpp index 4e71562398..d3500bd746 100644 --- a/src/mac/carbon/dataview.cpp +++ b/src/mac/carbon/dataview.cpp @@ -22,6 +22,8 @@ #ifndef WX_PRECOMP #include "wx/timer.h" + #include "wx/settings.h" + #include "wx/dcclient.h" #endif #include "wx/icon.h" @@ -379,6 +381,16 @@ wxDataViewCustomRenderer::~wxDataViewCustomRenderer(void) delete this->m_DCPtr; } /* wxDataViewCustomRenderer::~wxDataViewCustomRenderer(void) */ +void wxDataViewCustomRenderer::RenderText( const wxString &text, int xoffset, wxRect cell, wxDC *dc, int state ) +{ + wxDataViewCtrl *view = GetOwner()->GetOwner(); + wxColour col = (state & wxDATAVIEW_CELL_SELECTED) ? + wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT) : + view->GetForegroundColour(); + dc->SetTextForeground(col); + dc->DrawText( text, cell.x + xoffset, cell.y + ((cell.height - dc->GetCharHeight()) / 2)); +} + wxDC* wxDataViewCustomRenderer::GetDC(void) { if (this->m_DCPtr == NULL) @@ -401,6 +413,10 @@ void wxDataViewCustomRenderer::SetDC(wxDC* newDCPtr) this->m_DCPtr = newDCPtr; } /* wxDataViewCustomRenderer::SetDC(wxDC*) */ +WXDataBrowserPropertyType wxDataViewCustomRenderer::GetPropertyType() const +{ + return kDataBrowserCustomType; +} IMPLEMENT_ABSTRACT_CLASS(wxDataViewCustomRenderer, wxDataViewRenderer) @@ -426,6 +442,11 @@ bool wxDataViewTextRenderer::Render(void) return false; } /* wxDataViewTextRenderer::Render(void) */ +WXDataBrowserPropertyType wxDataViewTextRenderer::GetPropertyType() const +{ + return kDataBrowserTextType; +} + IMPLEMENT_CLASS(wxDataViewTextRenderer,wxDataViewRenderer) // --------------------------------------------------------- @@ -453,6 +474,11 @@ bool wxDataViewBitmapRenderer::Render(void) return false; } /* wxDataViewBitmapRenderer::Render(void) */ +WXDataBrowserPropertyType wxDataViewBitmapRenderer::GetPropertyType() const +{ + return kDataBrowserIconType; +} + IMPLEMENT_CLASS(wxDataViewBitmapRenderer,wxDataViewRenderer) // --------------------------------------------------------- @@ -483,6 +509,11 @@ bool wxDataViewIconTextRenderer::Render(void) return false; } /* wxDataViewIconTextRenderer::Render(void) */ +WXDataBrowserPropertyType wxDataViewIconTextRenderer::GetPropertyType() const +{ + return kDataBrowserIconAndTextType; +} + IMPLEMENT_ABSTRACT_CLASS(wxDataViewIconTextRenderer,wxDataViewRenderer) @@ -503,6 +534,11 @@ bool wxDataViewToggleRenderer::Render(void) return false; } /* wxDataViewToggleRenderer::Render(void) */ +WXDataBrowserPropertyType wxDataViewToggleRenderer::GetPropertyType() const +{ + return kDataBrowserCheckboxType; +} + IMPLEMENT_ABSTRACT_CLASS(wxDataViewToggleRenderer,wxDataViewRenderer) // --------------------------------------------------------- @@ -524,6 +560,11 @@ bool wxDataViewProgressRenderer::Render(void) return false; } /* wxDataViewProgressRenderer::Render(void) */ +WXDataBrowserPropertyType wxDataViewProgressRenderer::GetPropertyType() const +{ + return kDataBrowserProgressBarType; +} + IMPLEMENT_ABSTRACT_CLASS(wxDataViewProgressRenderer,wxDataViewRenderer) // --------------------------------------------------------- @@ -543,6 +584,11 @@ bool wxDataViewDateRenderer::Render(void) return false; } /* wxDataViewDateRenderer::Render(void) */ +WXDataBrowserPropertyType wxDataViewDateRenderer::GetPropertyType() const +{ + return kDataBrowserDateTimeType; +} + IMPLEMENT_ABSTRACT_CLASS(wxDataViewDateRenderer,wxDataViewRenderer) // --------------------------------------------------------- @@ -851,7 +897,7 @@ bool wxDataViewCtrl::AppendColumn(wxDataViewColumn* dataViewColumnPtr) // initialize column description: dataViewColumnPtr->SetPropertyID(NewPropertyID); columnDescription.propertyDesc.propertyID = NewPropertyID; - columnDescription.propertyDesc.propertyType = dataViewColumnPtr->GetRenderer()->GetPropertyType(); + columnDescription.propertyDesc.propertyType = DataBrowserPropertyType(dataViewColumnPtr->GetRenderer()->GetPropertyType()); columnDescription.propertyDesc.propertyFlags = kDataBrowserListViewSelectionColumn; // make the column selectable if (dataViewColumnPtr->IsSortable()) columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewSortableColumn; @@ -861,12 +907,12 @@ bool wxDataViewCtrl::AppendColumn(wxDataViewColumn* dataViewColumnPtr) #endif if (dataViewColumnPtr->GetRenderer()->GetMode() == wxDATAVIEW_CELL_EDITABLE) columnDescription.propertyDesc.propertyFlags |= kDataBrowserPropertyIsEditable; -#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2 + if ((columnDescription.propertyDesc.propertyType == kDataBrowserTextType) || (columnDescription.propertyDesc.propertyType == kDataBrowserIconAndTextType) || (columnDescription.propertyDesc.propertyType == kDataBrowserDateTimeType)) columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn; -#endif + #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewNoGapForIconInHeaderButton; #endif @@ -1217,7 +1263,7 @@ void wxDataViewCtrl::AddChildrenLevel(wxDataViewItem const& parentItem) #endif } /* wxDataViewCtrl::AddChildrenLevel(wxDataViewItem const&) */ -wxDataViewColumn* wxDataViewCtrl::GetColumnPtr(DataBrowserPropertyID propertyID) const +wxDataViewColumn* wxDataViewCtrl::GetColumnPtr(WXDataBrowserPropertyID propertyID) const { // variable definition: ColumnPointerHashMapType::const_iterator Result(this->m_ColumnPointers.find(propertyID));