X-Git-Url: https://git.saurik.com/cydia.git/blobdiff_plain/7b0ce2dae1de402fa371933b3254bf19b81a89eb..45447dc330ae258caf674d1895fe2db6d38cff02:/UICaboodle/RVPage.mm diff --git a/UICaboodle/RVPage.mm b/UICaboodle/RVPage.mm index ee85a7ed..1f366c1b 100644 --- a/UICaboodle/RVPage.mm +++ b/UICaboodle/RVPage.mm @@ -1,79 +1,70 @@ #import "RVPage.h" #import -#import +#import #import "RVBook.h" -@implementation RVPage +extern bool IsWildcat_; -- (NSString *) title { - [self doesNotRecognizeSelector:_cmd]; - return nil; -} - -- (NSString *) backButtonTitle { - return nil; -} +@implementation UIViewController (Cydia) -- (NSString *) leftButtonTitle { - return nil; +- (BOOL) hasLoaded { + return YES; } -- (NSString *) rightButtonTitle { - return nil; -} - -- (RVUINavBarButtonStyle) leftButtonStyle { - return [self leftButtonTitle] == nil ? RVUINavBarButtonStyleBack : RVUINavBarButtonStyleNormal; -} +@end -- (RVUINavBarButtonStyle) rightButtonStyle { - return RVUINavBarButtonStyleNormal; -} +@implementation CYViewController -- (void) _rightButtonClicked { - [self doesNotRecognizeSelector:_cmd]; +- (void) setDelegate:(id)delegate { + delegate_ = delegate; } -- (void) _leftButtonClicked { - [self doesNotRecognizeSelector:_cmd]; +- (id) delegate { + return delegate_; } -- (UIView *) accessoryView { - return nil; -} +- (void) viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; -- (void) setPageActive:(BOOL)active { + // Load on first appearance. We don't need to set the loaded flag here + // because it is set for us the first time -reloadData is called. + if (![self hasLoaded]) + [self reloadData]; } -- (void) resetViewAnimated:(BOOL)animated { - [self doesNotRecognizeSelector:_cmd]; +- (BOOL) hasLoaded { + return loaded_; } -- (void) setTitle:(NSString *)title { - [book_ setTitle:title forPage:self]; +- (void) releaseSubviews { + // Do nothing. } -- (void) setBackButtonTitle:(NSString *)title { - [book_ setBackButtonTitle:title forPage:self]; -} +- (void) setView:(UIView *)view { + // Nasty hack for 2.x-compatibility. In 3.0+, we can and + // should just override -viewDidUnload instead. + if (view == nil) + [self releaseSubviews]; -- (void) reloadButtons { - [book_ reloadButtonsForPage:self]; + [super setView:view]; } - (void) reloadData { + // This is called automatically on the first appearance of a controller, + // or any other time it needs to reload the information shown. However (!), + // this is not called by any tab bar or navigation controller's -reloadData + // method unless this controller returns YES from -hadLoaded. + loaded_ = YES; } -- (id) initWithBook:(RVBook *)book { - if ((self = [super initWithFrame:[book pageBounds]]) != nil) { - book_ = book; - } return self; +- (NSURL *) navigationURL { + return nil; } -- (void) setDelegate:(id)delegate { - delegate_ = delegate; +- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation { + return IsWildcat_ || orientation == UIInterfaceOrientationPortrait; } @end