SHARE
TWEET

Untitled

a guest Apr 27th, 2018 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. + (_CPStandardWindowView)themedStandardWindowView
  2. {
  3.     var windowView = [[_CPStandardWindowView alloc] initWithFrame:CGRectMake(0,0,150,150) styleMask:CPTitledWindowMask | CPResizableWindowMask | CPClosableWindowMask];
  4.     [windowView setTitle:@"Standard"];
  5.    
  6.     var backgroundColor = [CPColor colorWithPatternImage:[[CPNinePartImage alloc] initWithImageSlices:
  7.             [        
  8.                 [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/window-title-0.png" size:CPSizeMake(6.0, 26.0)],
  9.                 [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/window-title-1.png" size:CPSizeMake(1.0, 26.0)],
  10.                 [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/window-title-2.png" size:CPSizeMake(6.0, 26.0)],
  11.  
  12.                 [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/window-center.png" size:CPSizeMake(6.0, 1.0)],
  13.                 [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/window-center.png" size:CPSizeMake(1.0, 1.0)],
  14.                 [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/window-center.png" size:CPSizeMake(6.0, 1.0)],
  15.  
  16.                 [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/window-center.png" size:CPSizeMake(6.0, 1.0)],
  17.                 [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/window-center.png" size:CPSizeMake(1.0, 1.0)],
  18.                 [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/window-center.png" size:CPSizeMake(6.0, 1.0)]
  19.             ]]],
  20.         backgroundColorToolbar = [CPColor colorWithPatternImage:[[CPNinePartImage alloc] initWithImageSlices:
  21.             [        
  22.                 [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/window-toolbar-0.png" size:CPSizeMake(6.0, 85.0)],
  23.                 [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/window-toolbar-1.png" size:CPSizeMake(1.0, 85.0)],
  24.                 [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/window-toolbar-2.png" size:CPSizeMake(6.0, 85.0)],
  25.  
  26.                 [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/window-center.png" size:CPSizeMake(6.0, 1.0)],
  27.                 [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/window-center.png" size:CPSizeMake(1.0, 1.0)],
  28.                 [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/window-center.png" size:CPSizeMake(6.0, 1.0)],
  29.  
  30.                 [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/window-center.png" size:CPSizeMake(6.0, 1.0)],
  31.                 [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/window-center.png" size:CPSizeMake(1.0, 1.0)],
  32.                 [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/window-center.png" size:CPSizeMake(6.0, 1.0)]
  33.             ]]];
  34.    
  35.     // Frame
  36.     [windowView setValue:backgroundColor forThemeAttribute:@"background-color"];
  37.     [windowView setValue:backgroundColorToolbar forThemeAttribute:@"background-color" inState:CPWindowToolbarState];
  38.    
  39.     // Close Button
  40.     var closeButtonImage = [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/CPWindowStandardCloseButton.png" size:CGSizeMake(16.0, 16.0)],
  41.         closeButtonHighlightedImage = [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/CPWindowStandardCloseButtonHighlighted.png" size:CGSizeMake(16.0, 16.0)],
  42.         closeButtonUnsavedImage = [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/CPWindowStandardCloseButtonUnsaved.png" size:CGSizeMake(16.0, 16.0)],
  43.         closeButtonUnsavedHighlightedImage = [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/CPWindowStandardCloseButtonUnsavedHighlighted.png" size:CGSizeMake(16.0, 16.0)];
  44.        
  45.     [windowView setValue:CGRectMake(8.0, 7.0, 16.0, 16.0) forThemeAttribute:@"close-button-frame"];
  46.     [windowView setValue:closeButtonImage forThemeAttribute:@"close-button-image"];
  47.     [windowView setValue:closeButtonHighlightedImage forThemeAttribute:@"close-button-highlighted-image"];
  48.     [windowView setValue:closeButtonUnsavedImage forThemeAttribute:@"close-button-image" inState:CPWindowUnsavedDocumentState];
  49.     [windowView setValue:closeButtonUnsavedHighlightedImage forThemeAttribute:@"close-button-highlighted-image" inState:CPWindowUnsavedDocumentState];
  50.    
  51.     // Minimize Button
  52.     var minimizeButtonImage = [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/CPWindowStandardMinimizeButton.png" size:CGSizeMake(16.0, 16.0)],
  53.         minimizeButtonHighlightedImage = [_CPCibCustomResource imageResourceWithName:@"CPWindow/Standard/CPWindowStandardMinimizeButtonHighlighted.png" size:CGSizeMake(16.0, 16.0)];
  54.        
  55.     [windowView setValue:CGRectMake(27.0, 7.0, 16.0, 16.0) forThemeAttribute:@"minimize-button-frame"];
  56.     [windowView setValue:minimizeButtonImage forThemeAttribute:@"minimize-button-image"];
  57.     [windowView setValue:minimizeButtonHighlightedImage forThemeAttribute:@"minimize-button-highlighted-image"];
  58.    
  59.     // Title
  60.     [windowView setValue:CGInsetMake(5.0, 8.0, 0.0, 8.0) forThemeAttribute:@"title-inset"];
  61.     [windowView setValue:[CPColor blackColor] forThemeAttribute:@"title-text-color"];
  62.     [windowView setValue:[CPFont boldSystemFontOfSize:12.0] forThemeAttribute:@"title-font"];
  63.    
  64.     // FIXME: Make this to CPLineBreakByTruncatingMiddle once it's implemented.
  65.     [windowView setValue:CPLineBreakByTruncatingTail forThemeAttribute:@"title-line-break-mode"];
  66.     [windowView setValue:CPCenterTextAlignment forThemeAttribute:@"title-vertical-alignment"];
  67.     [windowView setValue:[CPColor whiteColor] forThemeAttribute:@"title-text-shadow-color"];
  68.     [windowView setValue:CGSizeMake(0.0, 1.0) forThemeAttribute:@"title-text-shadow-offset"];
  69.    
  70.     // Offsets
  71.     [windowView setValue:CGSizeMake(0.0, 25.0) forThemeAttribute:@"toolbar-offset"];
  72.     [windowView setValue:CGSizeMake(2.0, 2.0) forThemeAttribute:@"resize-indicator-offset"];
  73.    
  74.     return windowView;
  75. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top