X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/07edda049fbe3b6ae08daff5ce864543f155bab0..d5363c04ac7bfd5409b369746a67b83fd10cfdbc:/src/osx/cocoa/dataview.mm diff --git a/src/osx/cocoa/dataview.mm b/src/osx/cocoa/dataview.mm index 57e4927750..16ce4c8fab 100644 --- a/src/osx/cocoa/dataview.mm +++ b/src/osx/cocoa/dataview.mm @@ -521,7 +521,7 @@ outlineView:(NSOutlineView*)outlineView event.SetItem(wxDataViewItemFromItem(item)); event.SetModel(dvc->GetModel()); - BOOL dragSuccessful; + BOOL dragSuccessful = false; if ( [bestType compare:DataViewPboardType] == NSOrderedSame ) { NSArray* dataArray((NSArray*) @@ -757,7 +757,7 @@ outlineView:(NSOutlineView*)outlineView if (bestType == nil) return NSDragOperationNone; - NSDragOperation dragOperation; + NSDragOperation dragOperation = NSDragOperationNone; wxDataViewCtrl* const dvc(implementation->GetDataViewCtrl()); wxCHECK_MSG(dvc, false, "Pointer to data view control not set correctly."); @@ -863,7 +863,7 @@ outlineView:(NSOutlineView*)outlineView if ([writeItems count] > 0) { bool dataStringAvailable(true); // a flag indicating if for all items a data string is available - NSMutableArray* dataArray = [[NSMutableArray arrayWithCapacity:[writeItems count]] retain]; // data of all items + NSMutableArray* dataArray = [NSMutableArray arrayWithCapacity:[writeItems count]]; // data of all items wxString dataString; // contains the string data of all items // send a begin drag event for all selected items and proceed with @@ -1165,6 +1165,7 @@ outlineView:(NSOutlineView*)outlineView wxDataViewCustomRenderer * const renderer = obj->customRenderer; + // if this method is called everything is already setup correctly, CGContextRef context = (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort]; CGContextSaveGState( context ); @@ -1174,14 +1175,17 @@ outlineView:(NSOutlineView*)outlineView CGContextScaleCTM( context, 1, -1 ); } - // wxDC * const dc = renderer->GetDC(); - wxGraphicsContext* gc = wxGraphicsContext::CreateFromNative(context); wxGCDC dc; + wxGraphicsContext* gc = wxGraphicsContext::CreateFromNative(context); dc.SetGraphicsContext(gc); - renderer->WXCallRender(wxFromNSRect(controlView, cellFrame), &dc, 0); + + int state = 0; + if ( [self isHighlighted] ) + state |= wxDATAVIEW_CELL_SELECTED; + + renderer->WXCallRender(wxFromNSRect(controlView, cellFrame), &dc, state); CGContextRestoreGState( context ); - // renderer->SetDC(NULL); } -(NSRect) imageRectForBounds:(NSRect)cellFrame @@ -2180,9 +2184,9 @@ bool wxCocoaDataViewControl::IsExpanded(const wxDataViewItem& item) const bool wxCocoaDataViewControl::Reload() { [m_DataSource clearBuffers]; + [m_OutlineView reloadData]; [m_OutlineView scrollColumnToVisible:0]; [m_OutlineView scrollRowToVisible:0]; - [m_OutlineView reloadData]; return true; } @@ -2261,6 +2265,11 @@ void wxCocoaDataViewControl::SetCurrentItem(const wxDataViewItem& item) Select(item); } +int wxCocoaDataViewControl::GetSelectedItemsCount() const +{ + return [m_OutlineView numberOfSelectedRows]; +} + int wxCocoaDataViewControl::GetSelections(wxDataViewItemArray& sel) const { NSIndexSet* selectedRowIndexes([m_OutlineView selectedRowIndexes]); @@ -2800,9 +2809,9 @@ wxDataViewChoiceRenderer::wxDataViewChoiceRenderer(const wxArrayString& choices, cell = [[NSPopUpButtonCell alloc] init]; [cell setControlSize:NSMiniControlSize]; - [cell setFont:[[NSFont fontWithName:[[cell font] fontName] size:[NSFont systemFontSizeForControlSize:NSMiniControlSize]] autorelease]]; + [cell setFont:[NSFont fontWithName:[[cell font] fontName] size:[NSFont systemFontSizeForControlSize:NSMiniControlSize]]]; for (size_t i=0; i