| 1 |
masaki |
16 |
// |
| 2 |
|
|
// XspfMCollectionViewController.m |
| 3 |
|
|
// XspfManager |
| 4 |
|
|
// |
| 5 |
|
|
// Created by Hori,Masaki on 09/11/05. |
| 6 |
|
|
// Copyright 2009 masakih. All rights reserved. |
| 7 |
|
|
// |
| 8 |
|
|
|
| 9 |
|
|
#import "XspfMCollectionViewController.h" |
| 10 |
|
|
|
| 11 |
masaki |
175 |
#import "XspfMCollectionViewItem.h" |
| 12 |
masaki |
238 |
#import "XspfMXspfObject.h" |
| 13 |
masaki |
16 |
|
| 14 |
masaki |
175 |
|
| 15 |
masaki |
16 |
@implementation XspfMCollectionViewController |
| 16 |
|
|
|
| 17 |
|
|
- (id)init |
| 18 |
|
|
{ |
| 19 |
|
|
[super initWithNibName:@"CollectionView" bundle:nil]; |
| 20 |
|
|
|
| 21 |
|
|
return self; |
| 22 |
|
|
} |
| 23 |
|
|
|
| 24 |
masaki |
82 |
- (void)awakeFromNib |
| 25 |
|
|
{ |
| 26 |
|
|
NSView *view = [collectionViewItem view]; |
| 27 |
|
|
|
| 28 |
|
|
[scrollView setVerticalLineScroll:[view frame].size.height]; |
| 29 |
|
|
} |
| 30 |
|
|
|
| 31 |
masaki |
190 |
- (void)setCollectionItem:(XspfMCollectionViewItem *)newItem |
| 32 |
masaki |
175 |
{ |
| 33 |
|
|
[collectionView setItemPrototype:newItem]; |
| 34 |
|
|
NSSize viewSize = [[newItem view] frame].size; |
| 35 |
|
|
[collectionView setMinItemSize:viewSize]; |
| 36 |
|
|
[collectionView setMaxItemSize:viewSize]; |
| 37 |
|
|
[scrollView setVerticalLineScroll:viewSize.height]; |
| 38 |
masaki |
190 |
collectionViewItem = newItem; |
| 39 |
masaki |
175 |
} |
| 40 |
masaki |
229 |
|
| 41 |
|
|
- (IBAction)changeLabel:(id)sender |
| 42 |
|
|
{ |
| 43 |
masaki |
238 |
XspfMXspfObject *object = [sender representedObject]; |
| 44 |
masaki |
229 |
object.label = [sender objectValue]; |
| 45 |
|
|
} |
| 46 |
|
|
|
| 47 |
masaki |
175 |
- (IBAction)collectionViewItemViewRegular:(id)sender |
| 48 |
|
|
{ |
| 49 |
|
|
[self setCollectionItem:regularItem]; |
| 50 |
|
|
} |
| 51 |
|
|
- (IBAction)collectionViewItemViewSmall:(id)sender |
| 52 |
|
|
{ |
| 53 |
|
|
[self setCollectionItem:smallItem]; |
| 54 |
|
|
} |
| 55 |
|
|
|
| 56 |
masaki |
190 |
- (XspfMCollectionItemType)collectionItemType |
| 57 |
|
|
{ |
| 58 |
|
|
if(collectionViewItem == regularItem) return typeXspfMRegularItem; |
| 59 |
|
|
if(collectionViewItem == smallItem) return typeXSpfMSmallItem; |
| 60 |
|
|
|
| 61 |
|
|
return typeXspfMUnknownItem; |
| 62 |
|
|
} |
| 63 |
|
|
|
| 64 |
masaki |
16 |
#pragma mark#### XspfMCollectionView Delegate #### |
| 65 |
|
|
- (void)enterAction:(XspfMCollectionView *)view |
| 66 |
|
|
{ |
| 67 |
masaki |
74 |
[NSApp sendAction:@selector(openXspf:) to:nil from:self]; |
| 68 |
masaki |
16 |
} |
| 69 |
|
|
|
| 70 |
|
|
#pragma mark#### Test #### |
| 71 |
|
|
- (void)test01:(id)sender |
| 72 |
|
|
{ |
| 73 |
masaki |
188 |
HMLog(HMLogLevelError, @"hoge"); |
| 74 |
masaki |
16 |
} |
| 75 |
|
|
|
| 76 |
|
|
|
| 77 |
|
|
@end |