This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation BorderlessWindow | |
- (id)initWithContentRect:(NSRect)contentRect | |
styleMask:(unsigned int)aStyle | |
backing:(NSBackingStoreType)bufferingType | |
defer:(BOOL)flag { | |
self = [super initWithContentRect:contentRect | |
styleMask:CPBorderlessBridgeWindowMask]; | |
return self; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)performDragOperation:(CPDraggingInfo)aSender | |
{ | |
var data = [[aSender draggingPasteboard] dataForType:WidgetDragType]; | |
var widget = [CPKeyedUnarchiver unarchiveObjectWithData:data]; | |
var dropLocationX = [aSender draggedViewLocation].x - [[aSender draggingSource] frame].size.width; | |
var dropLocationY = [aSender draggedViewLocation].y - [[aSender draggedView] frame].size.height; | |
[widget setFrameOrigin:CGPointMake (dropLocationX, dropLocationY)]; | |
[self addSubview:widget]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation WidgetView : CPView | |
{ | |
Widget _widget; | |
} | |
- (void)setSelected:(BOOL)isSelected | |
{ | |
[self setBackgroundColor:isSelected ? [CPColor grayColor] : nil]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation WidgetView : CPView | |
{ | |
Widget _widget; | |
} | |
- (void)setSelected:(BOOL)isSelected | |
{ | |
[self setBackgroundColor:isSelected ? [CPColor grayColor] : nil]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation WidgetView : CPView | |
{ | |
Widget _widget; | |
} | |
- (void)setSelected:(BOOL)isSelected | |
{ | |
[self setBackgroundColor:isSelected ? [CPColor grayColor] : nil]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
widgetsCollection = [[CPCollectionView alloc] initWithFrame:bounds]; | |
[widgetsCollection setMinItemSize:CGSizeMake(100, 100)]; | |
[widgetsCollection setMaxItemSize:CGSizeMake(100, 100)]; | |
[widgetsCollection setAutoresizingMask:CPViewWidthSizable]; | |
[widgetsCollection setDelegate:self]; | |
var itemPrototype = [[CPCollectionViewItem alloc] init]; | |
[itemPrototype setView:[[WidgetView alloc] initWithFrame:CGRectMakeZero()]]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
widgetsCollection = [[CPCollectionView alloc] initWithFrame:bounds]; | |
[widgetsCollection setMinItemSize:CGSizeMake(100, 100)]; | |
[widgetsCollection setMaxItemSize:CGSizeMake(100, 100)]; | |
[widgetsCollection setAutoresizingMask:CPViewWidthSizable]; | |
[widgetsCollection setDelegate:self]; | |
var itemPrototype = [[CPCollectionViewItem alloc] init]; | |
[itemPrototype setView:[[WidgetView alloc] initWithFrame:CGRectMakeZero()]]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (i = 0; i < [[self subviews] count]; i++) { | |
[[self subviews][i] removeFromSuperview]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[screensCollectionView reloadContent]; | |
var screenName = [[[screensCollectionView items][0] view] screenName]; | |
[screenName setEditable:YES]; | |
[screenName setBackgroundColor:[CPColor whiteColor]]; | |
[[screenName window] makeFirstResponder:screenName]; | |
[screenName selectText:self]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var newScreen = [[ScreenService sharedScreenService] addScreenWithName:"New Screen"]; | |
[screensCollectionView reloadContent]; | |
var index = [[[ScreenService sharedScreenService] screens] count] - 1; | |
var screenName = [[[screensCollectionView items][index] view] screenName]; | |
[screenName setEditable:YES]; | |
[screenName setBackgroundColor:[CPColor whiteColor]]; | |
[[screenName window] makeFirstResponder:screenName]; | |
[screenName selectText:self]; | |
OlderNewer