forked from DHowett/theos-nic-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dashboardx_widget.nic
executable file
·160 lines (137 loc) · 4.7 KB
/
dashboardx_widget.nic
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
nic 1
name "iphone/dashboardx_widget"
dir Resources
file 35 Resources/Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>@@PROJECTNAME@@</string>
<key>CFBundleIdentifier</key>
<string>@@PACKAGENAME@@</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>CFBundleDisplayName</key>
<string>@@FULLPROJECTNAME@@</string>
<key>MinimumOSVersion</key>
<string>5.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
</array>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>AppBundleID</key>
<string>@@PACKAGENAME@@</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
</dict>
</plist>
file 1 Resources/InfoPlist.strings
"@@PROJECTNAME@@" = "@@FULLPROJECTNAME@@";
file 21 BBWeeAppController-Protocol.h
@protocol BBWeeAppController <NSObject>
@required
- (id)view;
@optional
- (void)loadPlaceholderView;
- (void)loadFullView;
- (void)loadView;
- (void)unloadView;
- (void)clearShapshotImage;
- (id)launchURL;
- (id)launchURLForTapLocation:(CGPoint)tapLocation;
- (float)viewHeight;
- (float)viewWidth; //Dashboard X specific, optional.
- (void)viewWillAppear;
- (void)viewDidAppear;
- (void)viewWillDisappear;
- (void)viewDidDisappear;
- (void)willAnimateRotationToInterfaceOrientation:(int)interfaceOrientation;
- (void)willRotateToInterfaceOrientation:(int)interfaceOrientation;
- (void)didRotateFromInterfaceOrientation:(int)interfaceOrientation;
@end
file 11 Makefile
include theos/makefiles/common.mk
BUNDLE_NAME = @@PROJECTNAME@@
@@PROJECTNAME@@_FILES = @@PROJECTNAME@@Controller.m
@@PROJECTNAME@@_INSTALL_PATH = /Library/DashboardX/Widgets/
@@PROJECTNAME@@_FRAMEWORKS = UIKit CoreGraphics
include $(THEOS_MAKE_PATH)/bundle.mk
after-install::
install.exec "killall -9 SpringBoard"
file 9 control
Package: @@PACKAGENAME@@
Name: @@FULLPROJECTNAME@@
Depends: firmware (>= 5.0), com.saurik.substrate.safemode, com.orikad.dashboard
Version: 0.0.1
Architecture: iphoneos-arm
Description: An awesome widget for Dashboard X!
Maintainer: @@USER@@
Author: @@USER@@
Section: Addons (Dashboard X)
file 67 @@PROJECTNAME@@Controller.m
#import "BBWeeAppController-Protocol.h"
static NSBundle *_@@PROJECTNAME@@WeeAppBundle = nil;
@interface @@PROJECTNAME@@Controller: NSObject <BBWeeAppController> {
UIView *_view;
UIImageView *_backgroundView;
}
@property (nonatomic, retain) UIView *view;
@end
@implementation @@PROJECTNAME@@Controller
@synthesize view = _view;
+ (void)initialize { //note about how the icon for your widget is handled (the one that shows in the widgets' table view when adding a new one): 1st priority is icon.png file in your bundle, if that isn't present an app icon with the AppBundleID (in your bundle Info.plist) string as bundle ID is used and if that isn't present then a generic "?" icon is used.
_@@PROJECTNAME@@WeeAppBundle = [[NSBundle bundleForClass:[self class]] retain];
}
- (id)init {
if((self = [super init]) != nil) {
} return self;
}
- (void)dealloc {
[_view release];
[_backgroundView release];
[super dealloc];
}
- (void)loadFullView {
// Add subviews to _backgroundView (or _view) here.
}
- (void)loadPlaceholderView {
// This should only be a placeholder - it should not connect to any servers or perform any intense
// data loading operations.
//
// All widgets are 316 points wide. Image size calculations match those of the Stocks widget.
_view = [[UIView alloc] initWithFrame:(CGRect){CGPointZero, {[self viewWidth], [self viewHeight]}}];
_view.autoresizingMask = UIViewAutoresizingFlexibleWidth;
UIImage *bgImg = [UIImage imageWithContentsOfFile:@"/System/Library/WeeAppPlugins/StocksWeeApp.bundle/WeeAppBackground.png"];
UIImage *stretchableBgImg = [bgImg stretchableImageWithLeftCapWidth:floorf(bgImg.size.width / 2.f) topCapHeight:floorf(bgImg.size.height / 2.f)];
_backgroundView = [[UIImageView alloc] initWithImage:stretchableBgImg];
_backgroundView.frame = CGRectInset(_view.bounds, 2.f, 0.f);
_backgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[_view addSubview:_backgroundView];
}
- (void)unloadView {
[_view release];
_view = nil;
[_backgroundView release];
_backgroundView = nil;
// Destroy any additional subviews you added here. Don't waste memory :(.
}
- (float)viewHeight {
return 71.f;
}
- (float)viewWidth {
return 80.f;
//implement this method to set your widget's width to be something else than the 316 points default. Optional.
}
@end