]> git.saurik.com Git - cydia.git/blob - UICaboodle/RVPage.mm
Add cydia.setBadgeValue() for tab badges.
[cydia.git] / UICaboodle / RVPage.mm
1 #import "RVPage.h"
2
3 #import <Foundation/Foundation.h>
4 #import <UIKit/UIKit.h>
5
6 extern bool IsWildcat_;
7
8 @implementation UIViewController (Cydia)
9
10 - (BOOL) hasLoaded {
11 return YES;
12 }
13
14 - (void) reloadData {
15 }
16
17 - (void) unloadData {
18 }
19
20 @end
21
22 @implementation CYViewController
23
24 - (void) setDelegate:(id)delegate {
25 delegate_ = delegate;
26 }
27
28 - (id) delegate {
29 return delegate_;
30 }
31
32 - (void) viewWillAppear:(BOOL)animated {
33 [super viewWillAppear:animated];
34
35 // Load on first appearance. We don't need to set the loaded flag here
36 // because it is set for us the first time -reloadData is called.
37 if (![self hasLoaded])
38 [self reloadData];
39 }
40
41 - (BOOL) hasLoaded {
42 return loaded_;
43 }
44
45 - (void) releaseSubviews {
46 // Do nothing.
47 }
48
49 - (void) setView:(UIView *)view {
50 // Nasty hack for 2.x-compatibility. In 3.0+, we can and
51 // should just override -viewDidUnload instead.
52 if (view == nil)
53 [self releaseSubviews];
54
55 [super setView:view];
56 }
57
58 - (void) reloadData {
59 [super reloadData];
60
61 // This is called automatically on the first appearance of a controller,
62 // or any other time it needs to reload the information shown. However (!),
63 // this is not called by any tab bar or navigation controller's -reloadData
64 // method unless this controller returns YES from -hadLoaded.
65 loaded_ = YES;
66 }
67
68 - (void) unloadData {
69 loaded_ = NO;
70 [super unloadData];
71 }
72
73 - (NSURL *) navigationURL {
74 return nil;
75 }
76
77 - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {
78 return IsWildcat_ || orientation == UIInterfaceOrientationPortrait;
79 }
80
81 @end