Skip to content

Commit

Permalink
adding initial drag/drop methods
Browse files Browse the repository at this point in the history
  • Loading branch information
markhuot committed Jun 11, 2011
1 parent 70a98ca commit 4bf96af
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/MHOpenFiles.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -60,10 +60,13 @@ - (id)initForTabs:(id)theTabs
return self; return self;
} }


#define MyPrivateTableViewDataType @"MyPrivateTableViewDataType"

- (void)setOutlineView:(NSOutlineView *)theOutlineView - (void)setOutlineView:(NSOutlineView *)theOutlineView
{ {
outlineView = theOutlineView; outlineView = theOutlineView;
[outlineView setIndentationPerLevel:0.0]; [outlineView setIndentationPerLevel:0.0];
[outlineView registerForDraggedTypes: [NSArray arrayWithObject:MyPrivateTableViewDataType]];
[outlineView expandItem:[outlineView itemAtRow:0]]; [outlineView expandItem:[outlineView itemAtRow:0]];
} }


Expand Down Expand Up @@ -177,6 +180,29 @@ - (void)outlineViewSelectionDidChange:(NSNotification *)notification
[tabView selectTabWithIdentifier:item]; [tabView selectTabWithIdentifier:item];
} }


- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pasteboard
{
//NSData *data = [NSKeyedArchiver archivedDataWithRootObject:rowIndexes];
[pasteboard declareTypes:[NSArray arrayWithObject:MyPrivateTableViewDataType] owner:self];
//[pboard setData:data forType:MyPrivateTableViewDataType];
return YES;
}

- (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id<NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(NSInteger)index
{
if ([item isEqualToString:@"WORKSPACE"])
{
return NSDragOperationMove;
}

return NSDragOperationNone;
}

- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id<NSDraggingInfo>)info item:(id)item childIndex:(NSInteger)index
{
return YES;
}

- (void)resizeViews - (void)resizeViews
{ {
float neededHeight = ([outlineView numberOfRows] * [outlineView rowHeight]) + (6.0 * [outlineView numberOfRows]) + 2.0; float neededHeight = ([outlineView numberOfRows] * [outlineView rowHeight]) + (6.0 * [outlineView numberOfRows]) + 2.0;
Expand Down

0 comments on commit 4bf96af

Please sign in to comment.