compilation fixes for OS X Cocoa build
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60907 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/osx/cocoa/dataview.mm
|
// Name: src/osx/cocoa/dataview.mm
|
||||||
// Purpose: wxDataView
|
// Purpose: wxDataView
|
||||||
// Author:
|
// Author:
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 2009-01-31
|
// Created: 2009-01-31
|
||||||
// RCS-ID: $Id: dataview.mm$
|
// RCS-ID: $Id: dataview.mm$
|
||||||
// Copyright:
|
// Copyright:
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
NSTableColumn* tableColumn; // not owned by the class
|
NSTableColumn* tableColumn; // not owned by the class
|
||||||
|
|
||||||
wxDataViewCustomRenderer* customRenderer; // not owned by the class
|
wxDataViewCustomRenderer* customRenderer; // not owned by the class
|
||||||
|
|
||||||
wxPointerObject* item; // not owned by the class
|
wxPointerObject* item; // not owned by the class
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,8 +83,8 @@
|
|||||||
-(id) copyWithZone:(NSZone*)zone
|
-(id) copyWithZone:(NSZone*)zone
|
||||||
{
|
{
|
||||||
wxCustomRendererObject* copy;
|
wxCustomRendererObject* copy;
|
||||||
|
|
||||||
|
|
||||||
copy = [[[self class] allocWithZone:zone] init];
|
copy = [[[self class] allocWithZone:zone] init];
|
||||||
copy->customRenderer = customRenderer;
|
copy->customRenderer = customRenderer;
|
||||||
copy->item = item;
|
copy->item = item;
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
static NSInteger CompareItems(id item1, id item2, void* context)
|
static NSInteger CompareItems(id item1, id item2, void* context)
|
||||||
{
|
{
|
||||||
NSArray* const sortDescriptors = (NSArray*) context;
|
NSArray* const sortDescriptors = (NSArray*) context;
|
||||||
|
|
||||||
NSUInteger const noOfDescriptors = [sortDescriptors count];
|
NSUInteger const noOfDescriptors = [sortDescriptors count];
|
||||||
|
|
||||||
NSInteger result(NSOrderedAscending);
|
NSInteger result(NSOrderedAscending);
|
||||||
@@ -113,7 +113,7 @@ static NSInteger CompareItems(id item1, id item2, void* context)
|
|||||||
wxSortDescriptorObject* const sortDescriptor = (wxSortDescriptorObject*)[sortDescriptors objectAtIndex:i];
|
wxSortDescriptorObject* const sortDescriptor = (wxSortDescriptorObject*)[sortDescriptors objectAtIndex:i];
|
||||||
|
|
||||||
int wxComparisonResult;
|
int wxComparisonResult;
|
||||||
|
|
||||||
wxComparisonResult = [sortDescriptor modelPtr]->Compare(wxDataViewItem([((wxPointerObject*) item1) pointer]),
|
wxComparisonResult = [sortDescriptor modelPtr]->Compare(wxDataViewItem([((wxPointerObject*) item1) pointer]),
|
||||||
wxDataViewItem([((wxPointerObject*) item2) pointer]),
|
wxDataViewItem([((wxPointerObject*) item2) pointer]),
|
||||||
[sortDescriptor columnPtr]->GetModelColumn(),
|
[sortDescriptor columnPtr]->GetModelColumn(),
|
||||||
@@ -210,7 +210,7 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self != nil)
|
if (self != nil)
|
||||||
self.pointer = NULL;
|
self->pointer = NULL;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,7 +218,7 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self != nil)
|
if (self != nil)
|
||||||
self.pointer = initPointer;
|
self->pointer = initPointer;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,8 +282,8 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
-(id) copyWithZone:(NSZone*)zone
|
-(id) copyWithZone:(NSZone*)zone
|
||||||
{
|
{
|
||||||
wxSortDescriptorObject* copy;
|
wxSortDescriptorObject* copy;
|
||||||
|
|
||||||
|
|
||||||
copy = [super copyWithZone:zone];
|
copy = [super copyWithZone:zone];
|
||||||
copy->columnPtr = columnPtr;
|
copy->columnPtr = columnPtr;
|
||||||
copy->modelPtr = modelPtr;
|
copy->modelPtr = modelPtr;
|
||||||
@@ -346,7 +346,7 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
|
|
||||||
[children release];
|
[children release];
|
||||||
[items release];
|
[items release];
|
||||||
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,7 +363,7 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
|
|
||||||
NSString* bestType([pasteboard availableTypeFromArray:supportedTypes]);
|
NSString* bestType([pasteboard availableTypeFromArray:supportedTypes]);
|
||||||
|
|
||||||
|
|
||||||
if (bestType != nil)
|
if (bestType != nil)
|
||||||
{
|
{
|
||||||
wxDataViewCtrl* const dataViewCtrlPtr(implementation->GetDataViewCtrl());
|
wxDataViewCtrl* const dataViewCtrlPtr(implementation->GetDataViewCtrl());
|
||||||
@@ -380,7 +380,7 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
{
|
{
|
||||||
NSArray* dataArray((NSArray*)[pasteboard propertyListForType:DataViewPboardType]);
|
NSArray* dataArray((NSArray*)[pasteboard propertyListForType:DataViewPboardType]);
|
||||||
NSUInteger indexDraggedItem, noOfDraggedItems([dataArray count]);
|
NSUInteger indexDraggedItem, noOfDraggedItems([dataArray count]);
|
||||||
|
|
||||||
indexDraggedItem = 0;
|
indexDraggedItem = 0;
|
||||||
while (indexDraggedItem < noOfDraggedItems)
|
while (indexDraggedItem < noOfDraggedItems)
|
||||||
{
|
{
|
||||||
@@ -423,7 +423,7 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
CFDataRef osxData; // needed to convert internally used UTF-16 representation to a UTF-8 representation
|
CFDataRef osxData; // needed to convert internally used UTF-16 representation to a UTF-8 representation
|
||||||
wxDataObjectComposite* dataObjects (new wxDataObjectComposite());
|
wxDataObjectComposite* dataObjects (new wxDataObjectComposite());
|
||||||
wxTextDataObject* textDataObject(new wxTextDataObject());
|
wxTextDataObject* textDataObject(new wxTextDataObject());
|
||||||
|
|
||||||
osxData = ::CFStringCreateExternalRepresentation(kCFAllocatorDefault,(CFStringRef)[pasteboard stringForType:NSStringPboardType],kCFStringEncodingUTF8,32);
|
osxData = ::CFStringCreateExternalRepresentation(kCFAllocatorDefault,(CFStringRef)[pasteboard stringForType:NSStringPboardType],kCFStringEncodingUTF8,32);
|
||||||
if (textDataObject->SetData(::CFDataGetLength(osxData),::CFDataGetBytePtr(osxData)))
|
if (textDataObject->SetData(::CFDataGetLength(osxData),::CFDataGetBytePtr(osxData)))
|
||||||
dataObjects->Add(textDataObject);
|
dataObjects->Add(textDataObject);
|
||||||
@@ -560,7 +560,7 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
NSArray* newDescriptors;
|
NSArray* newDescriptors;
|
||||||
|
|
||||||
NSMutableArray* wxSortDescriptors;
|
NSMutableArray* wxSortDescriptors;
|
||||||
|
|
||||||
NSUInteger noOfDescriptors;
|
NSUInteger noOfDescriptors;
|
||||||
|
|
||||||
wxDataViewCtrl* const dataViewCtrlPtr = implementation->GetDataViewCtrl();
|
wxDataViewCtrl* const dataViewCtrlPtr = implementation->GetDataViewCtrl();
|
||||||
@@ -613,7 +613,7 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
|
|
||||||
NSString* bestType([pasteboard availableTypeFromArray:supportedTypes]);
|
NSString* bestType([pasteboard availableTypeFromArray:supportedTypes]);
|
||||||
|
|
||||||
|
|
||||||
if (bestType != nil)
|
if (bestType != nil)
|
||||||
{
|
{
|
||||||
wxDataViewCtrl* const dataViewCtrlPtr(implementation->GetDataViewCtrl());
|
wxDataViewCtrl* const dataViewCtrlPtr(implementation->GetDataViewCtrl());
|
||||||
@@ -630,7 +630,7 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
{
|
{
|
||||||
NSArray* dataArray((NSArray*)[pasteboard propertyListForType:DataViewPboardType]);
|
NSArray* dataArray((NSArray*)[pasteboard propertyListForType:DataViewPboardType]);
|
||||||
NSUInteger indexDraggedItem, noOfDraggedItems([dataArray count]);
|
NSUInteger indexDraggedItem, noOfDraggedItems([dataArray count]);
|
||||||
|
|
||||||
indexDraggedItem = 0;
|
indexDraggedItem = 0;
|
||||||
while (indexDraggedItem < noOfDraggedItems)
|
while (indexDraggedItem < noOfDraggedItems)
|
||||||
{
|
{
|
||||||
@@ -673,7 +673,7 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
CFDataRef osxData; // needed to convert internally used UTF-16 representation to a UTF-8 representation
|
CFDataRef osxData; // needed to convert internally used UTF-16 representation to a UTF-8 representation
|
||||||
wxDataObjectComposite* dataObjects (new wxDataObjectComposite());
|
wxDataObjectComposite* dataObjects (new wxDataObjectComposite());
|
||||||
wxTextDataObject* textDataObject(new wxTextDataObject());
|
wxTextDataObject* textDataObject(new wxTextDataObject());
|
||||||
|
|
||||||
osxData = ::CFStringCreateExternalRepresentation(kCFAllocatorDefault,(CFStringRef)[pasteboard stringForType:NSStringPboardType],kCFStringEncodingUTF8,32);
|
osxData = ::CFStringCreateExternalRepresentation(kCFAllocatorDefault,(CFStringRef)[pasteboard stringForType:NSStringPboardType],kCFStringEncodingUTF8,32);
|
||||||
if (textDataObject->SetData(::CFDataGetLength(osxData),::CFDataGetBytePtr(osxData)))
|
if (textDataObject->SetData(::CFDataGetLength(osxData),::CFDataGetBytePtr(osxData)))
|
||||||
dataObjects->Add(textDataObject);
|
dataObjects->Add(textDataObject);
|
||||||
@@ -707,7 +707,7 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
// string representation exists
|
// string representation exists
|
||||||
{
|
{
|
||||||
wxDataViewCtrl* const dataViewCtrlPtr = implementation->GetDataViewCtrl();
|
wxDataViewCtrl* const dataViewCtrlPtr = implementation->GetDataViewCtrl();
|
||||||
|
|
||||||
wxDataViewItemArray dataViewItems;
|
wxDataViewItemArray dataViewItems;
|
||||||
|
|
||||||
|
|
||||||
@@ -752,7 +752,7 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
size_t const dataBufferSize = sizeof(wxDataFormatId)+dataSize;
|
size_t const dataBufferSize = sizeof(wxDataFormatId)+dataSize;
|
||||||
// variable definitions (used in all case statements):
|
// variable definitions (used in all case statements):
|
||||||
wxMemoryBuffer dataBuffer(dataBufferSize);
|
wxMemoryBuffer dataBuffer(dataBufferSize);
|
||||||
|
|
||||||
dataBuffer.AppendData(&idDataFormat,sizeof(wxDataFormatId));
|
dataBuffer.AppendData(&idDataFormat,sizeof(wxDataFormatId));
|
||||||
switch (idDataFormat)
|
switch (idDataFormat)
|
||||||
{
|
{
|
||||||
@@ -806,7 +806,7 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
if (dataStringAvailable)
|
if (dataStringAvailable)
|
||||||
{
|
{
|
||||||
wxCFStringRef osxString(dataString);
|
wxCFStringRef osxString(dataString);
|
||||||
|
|
||||||
[pasteboard declareTypes:[NSArray arrayWithObjects:DataViewPboardType,NSStringPboardType,nil] owner:nil];
|
[pasteboard declareTypes:[NSArray arrayWithObjects:DataViewPboardType,NSStringPboardType,nil] owner:nil];
|
||||||
[pasteboard setPropertyList:dataArray forType:DataViewPboardType];
|
[pasteboard setPropertyList:dataArray forType:DataViewPboardType];
|
||||||
[pasteboard setString:osxString.AsNSString() forType:NSStringPboardType];
|
[pasteboard setString:osxString.AsNSString() forType:NSStringPboardType];
|
||||||
@@ -1064,8 +1064,8 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
-(id) copyWithZone:(NSZone*)zone
|
-(id) copyWithZone:(NSZone*)zone
|
||||||
{
|
{
|
||||||
wxImageTextCell* cell;
|
wxImageTextCell* cell;
|
||||||
|
|
||||||
|
|
||||||
cell = (wxImageTextCell*) [super copyWithZone:zone];
|
cell = (wxImageTextCell*) [super copyWithZone:zone];
|
||||||
cell->image = [image retain];
|
cell->image = [image retain];
|
||||||
cell->imageSize = imageSize;
|
cell->imageSize = imageSize;
|
||||||
@@ -1234,7 +1234,7 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
// to draw an image correctly the coordinate system has to be transformed to a bottom-top coordinate system, otherwise the image's
|
// to draw an image correctly the coordinate system has to be transformed to a bottom-top coordinate system, otherwise the image's
|
||||||
// content is flipped:
|
// content is flipped:
|
||||||
NSAffineTransform* coordinateTransform([NSAffineTransform transform]);
|
NSAffineTransform* coordinateTransform([NSAffineTransform transform]);
|
||||||
|
|
||||||
if ([controlView isFlipped])
|
if ([controlView isFlipped])
|
||||||
{
|
{
|
||||||
[coordinateTransform scaleXBy: 1.0 yBy:-1.0]; // first the coordinate system is brought back to bottom-top orientation
|
[coordinateTransform scaleXBy: 1.0 yBy:-1.0]; // first the coordinate system is brought back to bottom-top orientation
|
||||||
@@ -1296,7 +1296,7 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
// if the image was not hit let's try the text part:
|
// if the image was not hit let's try the text part:
|
||||||
if (textFrame.size.width > [self cellTextSize].width) // for unknown reasons the alignment of the text cell is ignored; therefore change the size so that
|
if (textFrame.size.width > [self cellTextSize].width) // for unknown reasons the alignment of the text cell is ignored; therefore change the size so that
|
||||||
textFrame.size.width = [self cellTextSize].width; // alignment does not influence the visualization anymore
|
textFrame.size.width = [self cellTextSize].width; // alignment does not influence the visualization anymore
|
||||||
return [super hitTestForEvent:event inRect:textFrame ofView:controlView];
|
return [super hitTestForEvent:event inRect:textFrame ofView:controlView];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1320,7 +1320,7 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
if (imageFrame.size.height > imageSize.height)
|
if (imageFrame.size.height > imageSize.height)
|
||||||
imageFrame.size.height = imageSize.height;
|
imageFrame.size.height = imageSize.height;
|
||||||
imageFrame.origin.y += ceil(0.5*(cellFrame.size.height-imageFrame.size.height));
|
imageFrame.origin.y += ceil(0.5*(cellFrame.size.height-imageFrame.size.height));
|
||||||
|
|
||||||
return imageFrame;
|
return imageFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1407,7 +1407,7 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
// has full control if a context menu should be shown or not
|
// has full control if a context menu should be shown or not
|
||||||
{
|
{
|
||||||
wxDataViewCtrl* const dataViewCtrlPtr = implementation->GetDataViewCtrl();
|
wxDataViewCtrl* const dataViewCtrlPtr = implementation->GetDataViewCtrl();
|
||||||
|
|
||||||
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU,dataViewCtrlPtr->GetId());
|
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU,dataViewCtrlPtr->GetId());
|
||||||
|
|
||||||
wxDataViewItemArray selectedItems;
|
wxDataViewItemArray selectedItems;
|
||||||
@@ -1433,7 +1433,7 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
wxDataViewColumn* const dataViewColumnPtr(reinterpret_cast<wxDataViewColumn*>([[tableColumn identifier] pointer]));
|
wxDataViewColumn* const dataViewColumnPtr(reinterpret_cast<wxDataViewColumn*>([[tableColumn identifier] pointer]));
|
||||||
|
|
||||||
wxDataViewCtrl* const dataViewCtrlPtr = implementation->GetDataViewCtrl();
|
wxDataViewCtrl* const dataViewCtrlPtr = implementation->GetDataViewCtrl();
|
||||||
|
|
||||||
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK,dataViewCtrlPtr->GetId());
|
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK,dataViewCtrlPtr->GetId());
|
||||||
|
|
||||||
|
|
||||||
@@ -1452,13 +1452,13 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
// remove the sort order from the previously sorted column table (it can also be that
|
// remove the sort order from the previously sorted column table (it can also be that
|
||||||
// no sorted column table exists):
|
// no sorted column table exists):
|
||||||
UInt32 const noOfColumns = [outlineView numberOfColumns];
|
UInt32 const noOfColumns = [outlineView numberOfColumns];
|
||||||
|
|
||||||
for (UInt32 i=0; i<noOfColumns; ++i)
|
for (UInt32 i=0; i<noOfColumns; ++i)
|
||||||
[[[outlineView tableColumns] objectAtIndex:i] setSortDescriptorPrototype:nil];
|
[[[outlineView tableColumns] objectAtIndex:i] setSortDescriptorPrototype:nil];
|
||||||
// make column table sortable:
|
// make column table sortable:
|
||||||
NSArray* sortDescriptors;
|
NSArray* sortDescriptors;
|
||||||
NSSortDescriptor* sortDescriptor;
|
NSSortDescriptor* sortDescriptor;
|
||||||
|
|
||||||
sortDescriptor = [[NSSortDescriptor alloc] initWithKey:[NSString stringWithFormat:@"%d",[outlineView columnWithIdentifier:[tableColumn identifier]]]
|
sortDescriptor = [[NSSortDescriptor alloc] initWithKey:[NSString stringWithFormat:@"%d",[outlineView columnWithIdentifier:[tableColumn identifier]]]
|
||||||
ascending:YES];
|
ascending:YES];
|
||||||
sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
|
sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
|
||||||
@@ -1471,7 +1471,7 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
-(BOOL) outlineView:(NSOutlineView*)outlineView shouldCollapseItem:(id)item
|
-(BOOL) outlineView:(NSOutlineView*)outlineView shouldCollapseItem:(id)item
|
||||||
{
|
{
|
||||||
wxDataViewCtrl* const dataViewCtrlPtr = implementation->GetDataViewCtrl();
|
wxDataViewCtrl* const dataViewCtrlPtr = implementation->GetDataViewCtrl();
|
||||||
|
|
||||||
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING,dataViewCtrlPtr->GetId()); // variable definition
|
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING,dataViewCtrlPtr->GetId()); // variable definition
|
||||||
|
|
||||||
|
|
||||||
@@ -1487,7 +1487,7 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
-(BOOL) outlineView:(NSOutlineView*)outlineView shouldExpandItem:(id)item
|
-(BOOL) outlineView:(NSOutlineView*)outlineView shouldExpandItem:(id)item
|
||||||
{
|
{
|
||||||
wxDataViewCtrl* const dataViewCtrlPtr = implementation->GetDataViewCtrl();
|
wxDataViewCtrl* const dataViewCtrlPtr = implementation->GetDataViewCtrl();
|
||||||
|
|
||||||
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING,dataViewCtrlPtr->GetId()); // variable definition
|
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING,dataViewCtrlPtr->GetId()); // variable definition
|
||||||
|
|
||||||
|
|
||||||
@@ -1526,7 +1526,7 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
wxDataViewColumn* const dataViewColumnPtr(reinterpret_cast<wxDataViewColumn*>([[[[self tableColumns] objectAtIndex:newColumnPosition] identifier] pointer]));
|
wxDataViewColumn* const dataViewColumnPtr(reinterpret_cast<wxDataViewColumn*>([[[[self tableColumns] objectAtIndex:newColumnPosition] identifier] pointer]));
|
||||||
|
|
||||||
wxDataViewCtrl* const dataViewCtrlPtr = implementation->GetDataViewCtrl();
|
wxDataViewCtrl* const dataViewCtrlPtr = implementation->GetDataViewCtrl();
|
||||||
|
|
||||||
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED,dataViewCtrlPtr->GetId());
|
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED,dataViewCtrlPtr->GetId());
|
||||||
|
|
||||||
|
|
||||||
@@ -1539,7 +1539,7 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
-(void) outlineViewItemDidCollapse:(NSNotification*)notification
|
-(void) outlineViewItemDidCollapse:(NSNotification*)notification
|
||||||
{
|
{
|
||||||
wxDataViewCtrl* const dataViewCtrlPtr = implementation->GetDataViewCtrl();
|
wxDataViewCtrl* const dataViewCtrlPtr = implementation->GetDataViewCtrl();
|
||||||
|
|
||||||
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED,dataViewCtrlPtr->GetId());
|
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED,dataViewCtrlPtr->GetId());
|
||||||
|
|
||||||
|
|
||||||
@@ -1551,7 +1551,7 @@ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(pare
|
|||||||
-(void) outlineViewItemDidExpand:(NSNotification*)notification
|
-(void) outlineViewItemDidExpand:(NSNotification*)notification
|
||||||
{
|
{
|
||||||
wxDataViewCtrl* const dataViewCtrlPtr = implementation->GetDataViewCtrl();
|
wxDataViewCtrl* const dataViewCtrlPtr = implementation->GetDataViewCtrl();
|
||||||
|
|
||||||
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED,dataViewCtrlPtr->GetId());
|
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED,dataViewCtrlPtr->GetId());
|
||||||
|
|
||||||
|
|
||||||
@@ -1644,7 +1644,7 @@ wxCocoaDataViewControl::wxCocoaDataViewControl(wxWindow* peer, wxPoint const& po
|
|||||||
{
|
{
|
||||||
// initialize scrollview (the outline view is part of a scrollview):
|
// initialize scrollview (the outline view is part of a scrollview):
|
||||||
NSScrollView* scrollview = (NSScrollView*) this->GetWXWidget(); // definition for abbreviational purposes
|
NSScrollView* scrollview = (NSScrollView*) this->GetWXWidget(); // definition for abbreviational purposes
|
||||||
|
|
||||||
|
|
||||||
[scrollview setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
[scrollview setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
||||||
[scrollview setBorderType:NSNoBorder];
|
[scrollview setBorderType:NSNoBorder];
|
||||||
@@ -1866,10 +1866,10 @@ bool wxCocoaDataViewControl::AssociateModel(wxDataViewModel* model)
|
|||||||
int wxCocoaDataViewControl::GetSelections(wxDataViewItemArray& sel) const
|
int wxCocoaDataViewControl::GetSelections(wxDataViewItemArray& sel) const
|
||||||
{
|
{
|
||||||
NSIndexSet* selectedRowIndexes([this->m_OutlineView selectedRowIndexes]);
|
NSIndexSet* selectedRowIndexes([this->m_OutlineView selectedRowIndexes]);
|
||||||
|
|
||||||
NSUInteger indexRow;
|
NSUInteger indexRow;
|
||||||
|
|
||||||
|
|
||||||
sel.Empty();
|
sel.Empty();
|
||||||
sel.Alloc([selectedRowIndexes count]);
|
sel.Alloc([selectedRowIndexes count]);
|
||||||
indexRow = [selectedRowIndexes firstIndex];
|
indexRow = [selectedRowIndexes firstIndex];
|
||||||
@@ -1946,7 +1946,7 @@ void wxCocoaDataViewControl::HitTest(wxPoint const& point, wxDataViewItem& item,
|
|||||||
int indexColumn;
|
int indexColumn;
|
||||||
int indexRow;
|
int indexRow;
|
||||||
|
|
||||||
|
|
||||||
indexColumn = [this->m_OutlineView columnAtPoint:nativePoint];
|
indexColumn = [this->m_OutlineView columnAtPoint:nativePoint];
|
||||||
indexRow = [this->m_OutlineView rowAtPoint: nativePoint];
|
indexRow = [this->m_OutlineView rowAtPoint: nativePoint];
|
||||||
if ((indexColumn >= 0) && (indexRow >= 0))
|
if ((indexColumn >= 0) && (indexRow >= 0))
|
||||||
@@ -1988,7 +1988,7 @@ wxDataFormat wxCocoaDataViewControl::GetDnDDataFormat(wxDataObjectComposite* dat
|
|||||||
size_t indexFormat;
|
size_t indexFormat;
|
||||||
|
|
||||||
wxDataFormat* formats;
|
wxDataFormat* formats;
|
||||||
|
|
||||||
// get all formats and check afterwards if the formats are compatible; if they are compatible the preferred format is returned otherwise
|
// get all formats and check afterwards if the formats are compatible; if they are compatible the preferred format is returned otherwise
|
||||||
// wxDF_INVALID is returned;
|
// wxDF_INVALID is returned;
|
||||||
// currently compatible types (ordered by priority are):
|
// currently compatible types (ordered by priority are):
|
||||||
@@ -2035,7 +2035,7 @@ wxDataObjectComposite* wxCocoaDataViewControl::GetDnDDataObjects(NSData* dataObj
|
|||||||
{
|
{
|
||||||
wxDataFormatId dataFormatID;
|
wxDataFormatId dataFormatID;
|
||||||
|
|
||||||
|
|
||||||
[dataObject getBytes:&dataFormatID length:sizeof(wxDataFormatId)];
|
[dataObject getBytes:&dataFormatID length:sizeof(wxDataFormatId)];
|
||||||
switch (dataFormatID)
|
switch (dataFormatID)
|
||||||
{
|
{
|
||||||
@@ -2043,7 +2043,7 @@ wxDataObjectComposite* wxCocoaDataViewControl::GetDnDDataObjects(NSData* dataObj
|
|||||||
case wxDF_UNICODETEXT:
|
case wxDF_UNICODETEXT:
|
||||||
{
|
{
|
||||||
wxTextDataObject* textDataObject(new wxTextDataObject());
|
wxTextDataObject* textDataObject(new wxTextDataObject());
|
||||||
|
|
||||||
if (textDataObject->SetData(wxDataFormat(dataFormatID),[dataObject length]-sizeof(wxDataFormatId),reinterpret_cast<char const*>([dataObject bytes])+sizeof(wxDataFormatId)))
|
if (textDataObject->SetData(wxDataFormat(dataFormatID),[dataObject length]-sizeof(wxDataFormatId),reinterpret_cast<char const*>([dataObject bytes])+sizeof(wxDataFormatId)))
|
||||||
{
|
{
|
||||||
wxDataObjectComposite* dataObjectComposite(new wxDataObjectComposite());
|
wxDataObjectComposite* dataObjectComposite(new wxDataObjectComposite());
|
||||||
@@ -2123,8 +2123,8 @@ wxDataViewTextRenderer::wxDataViewTextRenderer(wxString const& varianttype, wxDa
|
|||||||
:wxDataViewRenderer(varianttype,mode,align)
|
:wxDataViewRenderer(varianttype,mode,align)
|
||||||
{
|
{
|
||||||
NSTextFieldCell* cell;
|
NSTextFieldCell* cell;
|
||||||
|
|
||||||
|
|
||||||
cell = [[NSTextFieldCell alloc] init];
|
cell = [[NSTextFieldCell alloc] init];
|
||||||
[cell setAlignment:ConvertToNativeHorizontalTextAlignment(align)];
|
[cell setAlignment:ConvertToNativeHorizontalTextAlignment(align)];
|
||||||
[cell setLineBreakMode:NSLineBreakByTruncatingMiddle];
|
[cell setLineBreakMode:NSLineBreakByTruncatingMiddle];
|
||||||
@@ -2155,8 +2155,8 @@ wxDataViewBitmapRenderer::wxDataViewBitmapRenderer(wxString const& varianttype,
|
|||||||
:wxDataViewRenderer(varianttype,mode,align)
|
:wxDataViewRenderer(varianttype,mode,align)
|
||||||
{
|
{
|
||||||
NSImageCell* cell;
|
NSImageCell* cell;
|
||||||
|
|
||||||
|
|
||||||
cell = [[NSImageCell alloc] init];
|
cell = [[NSImageCell alloc] init];
|
||||||
this->SetNativeData(new wxDataViewRendererNativeData(cell));
|
this->SetNativeData(new wxDataViewRendererNativeData(cell));
|
||||||
[cell release];
|
[cell release];
|
||||||
@@ -2187,8 +2187,8 @@ wxDataViewChoiceRenderer::wxDataViewChoiceRenderer(wxArrayString const& choices,
|
|||||||
:wxDataViewRenderer(wxT("string"),mode,alignment), m_Choices(choices)
|
:wxDataViewRenderer(wxT("string"),mode,alignment), m_Choices(choices)
|
||||||
{
|
{
|
||||||
NSPopUpButtonCell* cell;
|
NSPopUpButtonCell* cell;
|
||||||
|
|
||||||
|
|
||||||
cell = [[NSPopUpButtonCell alloc] init];
|
cell = [[NSPopUpButtonCell alloc] init];
|
||||||
[cell setControlSize:NSMiniControlSize];
|
[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]] autorelease]];
|
||||||
@@ -2224,7 +2224,7 @@ wxDataViewDateRenderer::wxDataViewDateRenderer(wxString const& varianttype, wxDa
|
|||||||
|
|
||||||
NSDateFormatter* dateFormatter;
|
NSDateFormatter* dateFormatter;
|
||||||
|
|
||||||
|
|
||||||
dateFormatter = [[NSDateFormatter alloc] init];
|
dateFormatter = [[NSDateFormatter alloc] init];
|
||||||
[dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4];
|
[dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4];
|
||||||
[dateFormatter setDateStyle:NSDateFormatterShortStyle];
|
[dateFormatter setDateStyle:NSDateFormatterShortStyle];
|
||||||
@@ -2290,8 +2290,8 @@ wxDataViewIconTextRenderer::wxDataViewIconTextRenderer(wxString const& variantty
|
|||||||
:wxDataViewRenderer(varianttype,mode)
|
:wxDataViewRenderer(varianttype,mode)
|
||||||
{
|
{
|
||||||
wxImageTextCell* cell;
|
wxImageTextCell* cell;
|
||||||
|
|
||||||
|
|
||||||
cell = [[wxImageTextCell alloc] init];
|
cell = [[wxImageTextCell alloc] init];
|
||||||
[cell setAlignment:ConvertToNativeHorizontalTextAlignment(align)];
|
[cell setAlignment:ConvertToNativeHorizontalTextAlignment(align)];
|
||||||
this->SetNativeData(new wxDataViewRendererNativeData(cell));
|
this->SetNativeData(new wxDataViewRendererNativeData(cell));
|
||||||
@@ -2303,7 +2303,7 @@ bool wxDataViewIconTextRenderer::Render()
|
|||||||
if (this->GetValue().GetType() == this->GetVariantType())
|
if (this->GetValue().GetType() == this->GetVariantType())
|
||||||
{
|
{
|
||||||
wxDataViewIconText iconText;
|
wxDataViewIconText iconText;
|
||||||
|
|
||||||
wxImageTextCell* cell;
|
wxImageTextCell* cell;
|
||||||
|
|
||||||
cell = (wxImageTextCell*) this->GetNativeData()->GetItemCell();
|
cell = (wxImageTextCell*) this->GetNativeData()->GetItemCell();
|
||||||
@@ -2329,8 +2329,8 @@ wxDataViewToggleRenderer::wxDataViewToggleRenderer(wxString const& varianttype,
|
|||||||
:wxDataViewRenderer(varianttype,mode)
|
:wxDataViewRenderer(varianttype,mode)
|
||||||
{
|
{
|
||||||
NSButtonCell* cell;
|
NSButtonCell* cell;
|
||||||
|
|
||||||
|
|
||||||
cell = [[NSButtonCell alloc] init];
|
cell = [[NSButtonCell alloc] init];
|
||||||
[cell setAlignment:ConvertToNativeHorizontalTextAlignment(align)];
|
[cell setAlignment:ConvertToNativeHorizontalTextAlignment(align)];
|
||||||
[cell setButtonType:NSSwitchButton];
|
[cell setButtonType:NSSwitchButton];
|
||||||
@@ -2362,8 +2362,8 @@ wxDataViewProgressRenderer::wxDataViewProgressRenderer(wxString const& label, wx
|
|||||||
:wxDataViewRenderer(varianttype,mode,align)
|
:wxDataViewRenderer(varianttype,mode,align)
|
||||||
{
|
{
|
||||||
NSLevelIndicatorCell* cell;
|
NSLevelIndicatorCell* cell;
|
||||||
|
|
||||||
|
|
||||||
cell = [[NSLevelIndicatorCell alloc] initWithLevelIndicatorStyle:NSContinuousCapacityLevelIndicatorStyle];
|
cell = [[NSLevelIndicatorCell alloc] initWithLevelIndicatorStyle:NSContinuousCapacityLevelIndicatorStyle];
|
||||||
[cell setMinValue:0];
|
[cell setMinValue:0];
|
||||||
[cell setMaxValue:100];
|
[cell setMaxValue:100];
|
||||||
@@ -2473,7 +2473,7 @@ void wxDataViewColumn::SetSortOrder(bool ascending)
|
|||||||
NSArray* sortDescriptors;
|
NSArray* sortDescriptors;
|
||||||
NSSortDescriptor* sortDescriptor;
|
NSSortDescriptor* sortDescriptor;
|
||||||
NSTableColumn* tableColumn;
|
NSTableColumn* tableColumn;
|
||||||
|
|
||||||
tableColumn = this->m_NativeDataPtr->GetNativeColumnPtr();
|
tableColumn = this->m_NativeDataPtr->GetNativeColumnPtr();
|
||||||
sortDescriptor = [[NSSortDescriptor alloc] initWithKey:[[tableColumn sortDescriptorPrototype] key] ascending:m_ascending];
|
sortDescriptor = [[NSSortDescriptor alloc] initWithKey:[[tableColumn sortDescriptorPrototype] key] ascending:m_ascending];
|
||||||
sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
|
sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
|
||||||
|
@@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
#if (wxUSE_DATAVIEWCTRL != 0) && (!defined(wxUSE_GENERICDATAVIEWCTRL) || (wxUSE_GENERICDATAVIEWCTRL == 0))
|
#if (wxUSE_DATAVIEWCTRL != 0) && (!defined(wxUSE_GENERICDATAVIEWCTRL) || (wxUSE_GENERICDATAVIEWCTRL == 0))
|
||||||
|
|
||||||
#include <carbon/carbon.h>
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
@@ -38,7 +37,7 @@ wxString ConcatenateDataViewItemValues(wxDataViewCtrl const* dataViewCtrlPtr, wx
|
|||||||
{
|
{
|
||||||
// variable definition:
|
// variable definition:
|
||||||
wxVariant dataValue;
|
wxVariant dataValue;
|
||||||
|
|
||||||
dataViewCtrlPtr->GetModel()->GetValue(dataValue,dataViewItem,dataViewCtrlPtr->GetColumn(i)->GetModelColumn());
|
dataViewCtrlPtr->GetModel()->GetValue(dataValue,dataViewItem,dataViewCtrlPtr->GetColumn(i)->GetModelColumn());
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
dataString << wxT('\t');
|
dataString << wxT('\t');
|
||||||
@@ -239,7 +238,7 @@ void wxOSXDataViewModelNotifier::AdjustRowHeight(wxDataViewItem const& item)
|
|||||||
for (col = 0; col < num; col++)
|
for (col = 0; col < num; col++)
|
||||||
{
|
{
|
||||||
wxDataViewColumn* column(this->m_DataViewCtrlPtr->GetColumnPtr(col));
|
wxDataViewColumn* column(this->m_DataViewCtrlPtr->GetColumnPtr(col));
|
||||||
|
|
||||||
if (!(column->IsHidden()))
|
if (!(column->IsHidden()))
|
||||||
{
|
{
|
||||||
wxDataViewCustomRenderer *renderer = dynamic_cast<wxDataViewCustomRenderer*>(column->GetRenderer());
|
wxDataViewCustomRenderer *renderer = dynamic_cast<wxDataViewCustomRenderer*>(column->GetRenderer());
|
||||||
@@ -274,7 +273,7 @@ void wxOSXDataViewModelNotifier::AdjustRowHeights(wxDataViewItemArray const& ite
|
|||||||
for (col = 0; col < num; col++)
|
for (col = 0; col < num; col++)
|
||||||
{
|
{
|
||||||
wxDataViewColumn* column(this->m_DataViewCtrlPtr->GetColumnPtr(col));
|
wxDataViewColumn* column(this->m_DataViewCtrlPtr->GetColumnPtr(col));
|
||||||
|
|
||||||
if (!(column->IsHidden()))
|
if (!(column->IsHidden()))
|
||||||
{
|
{
|
||||||
wxDataViewCustomRenderer *renderer = dynamic_cast<wxDataViewCustomRenderer*>(column->GetRenderer());
|
wxDataViewCustomRenderer *renderer = dynamic_cast<wxDataViewCustomRenderer*>(column->GetRenderer());
|
||||||
@@ -680,14 +679,14 @@ wxSize wxDataViewCtrl::DoGetBestSize() const
|
|||||||
{
|
{
|
||||||
wxSize best = wxControl::DoGetBestSize();
|
wxSize best = wxControl::DoGetBestSize();
|
||||||
best.y = 80;
|
best.y = 80;
|
||||||
|
|
||||||
return best;
|
return best;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDataViewCtrl::OnMouse(wxMouseEvent& event)
|
void wxDataViewCtrl::OnMouse(wxMouseEvent& event)
|
||||||
{
|
{
|
||||||
event.Skip();
|
event.Skip();
|
||||||
|
|
||||||
if (GetModel() == NULL)
|
if (GetModel() == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -704,8 +703,8 @@ void wxDataViewCtrl::OnMouse(wxMouseEvent& event)
|
|||||||
|
|
||||||
UInt16 headerHeight = 0;
|
UInt16 headerHeight = 0;
|
||||||
MacDataViewListCtrlPtr->GetHeaderButtonHeight(&headerHeight);
|
MacDataViewListCtrlPtr->GetHeaderButtonHeight(&headerHeight);
|
||||||
|
|
||||||
|
|
||||||
if (event.GetY() < headerHeight)
|
if (event.GetY() < headerHeight)
|
||||||
{
|
{
|
||||||
unsigned int col_count = GetColumnCount();
|
unsigned int col_count = GetColumnCount();
|
||||||
@@ -715,12 +714,12 @@ void wxDataViewCtrl::OnMouse(wxMouseEvent& event)
|
|||||||
wxDataViewColumn *column = GetColumn( col );
|
wxDataViewColumn *column = GetColumn( col );
|
||||||
if (column->IsHidden())
|
if (column->IsHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Rect itemrect;
|
Rect itemrect;
|
||||||
::GetDataBrowserItemPartBounds( MacDataViewListCtrlPtr->GetControlRef(),
|
::GetDataBrowserItemPartBounds( MacDataViewListCtrlPtr->GetControlRef(),
|
||||||
reinterpret_cast<DataBrowserItemID>(firstChild.GetID()), column->GetPropertyID(),
|
reinterpret_cast<DataBrowserItemID>(firstChild.GetID()), column->GetPropertyID(),
|
||||||
kDataBrowserPropertyEnclosingPart, &itemrect );
|
kDataBrowserPropertyEnclosingPart, &itemrect );
|
||||||
|
|
||||||
if (abs( event.GetX() - itemrect.right) < 3)
|
if (abs( event.GetX() - itemrect.right) < 3)
|
||||||
{
|
{
|
||||||
if (column->GetFlags() & wxDATAVIEW_COL_RESIZABLE)
|
if (column->GetFlags() & wxDATAVIEW_COL_RESIZABLE)
|
||||||
@@ -730,9 +729,9 @@ void wxDataViewCtrl::OnMouse(wxMouseEvent& event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCursor( *wxSTANDARD_CURSOR );
|
SetCursor( *wxSTANDARD_CURSOR );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user