forked from 0x68/TFPDFView
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AppController.j
56 lines (36 loc) · 1.62 KB
/
AppController.j
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* AppController.j
* TFPDFView
*
* Created by Tim Fiedler on June 2, 2012.
* Copyright 2012, 0x68 All rights reserved.
*/
@import <Foundation/CPObject.j>
@import "PDFViewController.j"
@implementation AppController : CPObject {
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView];
pdfViewController = [[PDFViewController alloc] initWithFrame:CGRectMake(150.0, 0.0, CGRectGetWidth([contentView bounds]) - 150.0, CGRectGetHeight([contentView bounds]))];
[contentView addSubview:pdfViewController];
[theWindow orderFront:self];
[CPMenu setMenuBarVisible:YES];
var myApplication = [CPApplication sharedApplication],
applicationMenu = [myApplication mainMenu];
pdfLoadMenuItem = [[CPMenuItem alloc] init];
[pdfLoadMenuItem setTitle:@"Load PDF"];
[pdfLoadMenuItem setTarget:pdfViewController];
[pdfLoadMenuItem setAction:@selector(loadData:)];
[applicationMenu insertItem:pdfLoadMenuItem atIndex:1];
//DO i have to unwind the default items ? Silly one !
var theIndex = [applicationMenu indexOfItemWithTitle: @"Edit"];
var theNewIndex = [applicationMenu indexOfItemWithTitle: @"New" ];
var theOpenIndex = [applicationMenu indexOfItemWithTitle: @"Open"];
var theSaveIndex = [applicationMenu indexOfItemWithTitle: @"Save"];
[applicationMenu removeItemAtIndex:theSaveIndex];
[applicationMenu removeItemAtIndex:theOpenIndex];
[applicationMenu removeItemAtIndex:theNewIndex];
}
@end