diff options
Diffstat (limited to 'CyteKit')
-rw-r--r-- | CyteKit/TabBarController.h | 7 | ||||
-rw-r--r-- | CyteKit/TabBarController.mm | 6 | ||||
-rw-r--r-- | CyteKit/TableViewCell.h | 16 | ||||
-rw-r--r-- | CyteKit/TableViewCell.mm | 22 | ||||
-rw-r--r-- | CyteKit/ViewController.h | 9 | ||||
-rw-r--r-- | CyteKit/ViewController.mm | 11 | ||||
-rw-r--r-- | CyteKit/WebView.h | 3 | ||||
-rw-r--r-- | CyteKit/WebView.mm | 3 | ||||
-rw-r--r-- | CyteKit/WebViewController.h | 43 | ||||
-rw-r--r-- | CyteKit/WebViewController.mm | 69 | ||||
-rw-r--r-- | CyteKit/WebViewTableViewCell.h | 6 | ||||
-rw-r--r-- | CyteKit/WebViewTableViewCell.mm | 6 |
12 files changed, 115 insertions, 86 deletions
diff --git a/CyteKit/TabBarController.h b/CyteKit/TabBarController.h index 2849b4b..7aee767 100644 --- a/CyteKit/TabBarController.h +++ b/CyteKit/TabBarController.h @@ -26,15 +26,10 @@ #include <UIKit/UIKit.h> -#include <Menes/ObjectHandle.h> - @interface UITabBarController (Cydia) @end -@interface CyteTabBarController : UITabBarController { - _transient UIViewController *transient_; - _H<UIViewController> remembered_; -} +@interface CyteTabBarController : UITabBarController - (UIViewController *) unselectedViewController; - (void) setUnselectedViewController:(UIViewController *)transient; diff --git a/CyteKit/TabBarController.mm b/CyteKit/TabBarController.mm index 27a8000..7a4ead3 100644 --- a/CyteKit/TabBarController.mm +++ b/CyteKit/TabBarController.mm @@ -24,12 +24,16 @@ #include "CyteKit/TabBarController.h" #include "iPhonePrivate.h" +#include <Menes/ObjectHandle.h> @implementation UITabBarController (Cydia) @end -@implementation CyteTabBarController +@implementation CyteTabBarController { + _transient UIViewController *transient_; + _H<UIViewController> remembered_; +} - (void) didReceiveMemoryWarning { [super didReceiveMemoryWarning]; diff --git a/CyteKit/TableViewCell.h b/CyteKit/TableViewCell.h index f97a592..f435f01 100644 --- a/CyteKit/TableViewCell.h +++ b/CyteKit/TableViewCell.h @@ -24,25 +24,23 @@ #include <UIKit/UIKit.h> -#include <Menes/ObjectHandle.h> - @protocol CyteTableViewCellDelegate - (void) drawContentRect:(CGRect)rect; @end -@interface CyteTableViewCellContentView : UIView { - _transient id<CyteTableViewCellDelegate> delegate_; -} +@interface CyteTableViewCellContentView : UIView - (id) delegate; - (void) setDelegate:(id<CyteTableViewCellDelegate>)delegate; @end -@interface CyteTableViewCell : UITableViewCell { - _H<CyteTableViewCellContentView, 1> content_; - bool highlighted_; -} +@interface CyteTableViewCell : UITableViewCell + +- (void) setContent:(CyteTableViewCellContentView *)content; +- (CyteTableViewCellContentView *) content; + +- (bool) highlighted; @end diff --git a/CyteKit/TableViewCell.mm b/CyteKit/TableViewCell.mm index ce61ad5..827440b 100644 --- a/CyteKit/TableViewCell.mm +++ b/CyteKit/TableViewCell.mm @@ -24,8 +24,11 @@ #include "CyteKit/TableViewCell.h" #include "iPhonePrivate.h" +#include <Menes/ObjectHandle.h> -@implementation CyteTableViewCellContentView +@implementation CyteTableViewCellContentView { + _transient id<CyteTableViewCellDelegate> delegate_; +} - (id) initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame]) != nil) { @@ -48,7 +51,10 @@ @end -@implementation CyteTableViewCell +@implementation CyteTableViewCell { + _H<CyteTableViewCellContentView, 1> content_; + bool highlighted_; +} - (void) _updateHighlightColorsForView:(UIView *)view highlighted:(BOOL)highlighted { if (view == (UIView *) content_) @@ -64,4 +70,16 @@ [content_ setNeedsDisplay]; } +- (void) setContent:(CyteTableViewCellContentView *)content { + content_ = content; +} + +- (CyteTableViewCellContentView *) content { + return content_; +} + +- (bool) highlighted { + return highlighted_; +} + @end diff --git a/CyteKit/ViewController.h b/CyteKit/ViewController.h index f724837..3b637f0 100644 --- a/CyteKit/ViewController.h +++ b/CyteKit/ViewController.h @@ -24,8 +24,6 @@ #include <UIKit/UIKit.h> -#include <Menes/ObjectHandle.h> - @interface UIViewController (Cydia) - (BOOL) hasLoaded; - (void) reloadData; @@ -33,11 +31,7 @@ - (UIViewController *) parentOrPresentingViewController; @end -@interface CyteViewController : UIViewController { - _transient id delegate_; - BOOL loaded_; - _H<UIColor> color_; -} +@interface CyteViewController : UIViewController // The default implementation of this method is essentially a no-op, // but calling the superclass implementation is *required*. @@ -64,6 +58,7 @@ - (void) releaseSubviews; - (void) setPageColor:(UIColor *)color; +- (UIColor *) pageColor; @end diff --git a/CyteKit/ViewController.mm b/CyteKit/ViewController.mm index 3bf9c41..52c925d 100644 --- a/CyteKit/ViewController.mm +++ b/CyteKit/ViewController.mm @@ -27,6 +27,7 @@ #include "CyteKit/ViewController.h" #include "iPhonePrivate.h" +#include <Menes/ObjectHandle.h> @implementation UIViewController (Cydia) @@ -53,7 +54,11 @@ @end -@implementation CyteViewController +@implementation CyteViewController { + _transient id delegate_; + BOOL loaded_; + _H<UIColor> color_; +} - (void) setDelegate:(id)delegate { delegate_ = delegate; @@ -114,6 +119,10 @@ color_ = color; } +- (UIColor *) pageColor { + return color_; +} + #include "InterfaceOrientation.h" @end diff --git a/CyteKit/WebView.h b/CyteKit/WebView.h index ddf4391..20e162a 100644 --- a/CyteKit/WebView.h +++ b/CyteKit/WebView.h @@ -62,8 +62,7 @@ enum CYWebPolicyDecision { - (void) webViewUpdateViewSettings:(UIWebView *)view; @end -@interface CyteWebView : UIWebView { -} +@interface CyteWebView : UIWebView - (id<CyteWebViewDelegate>) delegate; - (void) setDelegate:(id<CyteWebViewDelegate>)delegate; diff --git a/CyteKit/WebView.mm b/CyteKit/WebView.mm index 38f6a4f..3711587 100644 --- a/CyteKit/WebView.mm +++ b/CyteKit/WebView.mm @@ -90,7 +90,8 @@ @end // }}} -@implementation CyteWebView : UIWebView +@implementation CyteWebView : UIWebView { +} #if ShowInternals #include "CyteKit/UCInternal.h" diff --git a/CyteKit/WebViewController.h b/CyteKit/WebViewController.h index 20fe475..61c4c1a 100644 --- a/CyteKit/WebViewController.h +++ b/CyteKit/WebViewController.h @@ -28,8 +28,6 @@ #include <UIKit/UIKit.h> #include <MessageUI/MessageUI.h> -#include <Menes/ObjectHandle.h> - @class IndirectDelegate; @protocol CyteWebViewControllerDelegate @@ -43,49 +41,16 @@ CyteWebViewDelegate, MFMailComposeViewControllerDelegate, UIWebViewDelegate -> { - _H<CyteWebView, 1> webview_; - _transient UIScrollView *scroller_; - - _H<UIActivityIndicatorView> indicator_; - _H<IndirectDelegate, 1> indirect_; - _H<NSURLAuthenticationChallenge> challenge_; - - bool error_; - _H<NSURLRequest> request_; - bool ready_; - - _transient NSNumber *sensitive_; - _H<NSURL> appstore_; - - _H<NSString> title_; - _H<NSMutableSet> loading_; - - _H<NSMutableSet> registered_; - _H<NSTimer> timer_; - - // XXX: NSString * or UIImage * - _H<NSObject> custom_; - _H<NSString> style_; - - _H<WebScriptObject> function_; - - float width_; - Class class_; - - _H<UIBarButtonItem> reloaditem_; - _H<UIBarButtonItem> loadingitem_; - - bool visible_; - bool hidesNavigationBar_; - bool allowsNavigationAction_; -} +> + (void) _initialize; - (CyteWebView *) webView; +- (CyteWebViewController *) indirect; - (void) setRequest:(NSURLRequest *)request; +- (NSURLRequest *) request; + - (void) setURL:(NSURL *)url; - (void) setURL:(NSURL *)url withReferrer:(NSString *)referrer; diff --git a/CyteKit/WebViewController.mm b/CyteKit/WebViewController.mm index 7d9bd80..20838bf 100644 --- a/CyteKit/WebViewController.mm +++ b/CyteKit/WebViewController.mm @@ -8,6 +8,7 @@ #include "CyteKit/WebViewController.h" #include "iPhonePrivate.h" +#include <Menes/ObjectHandle.h> //#include <QuartzCore/CALayer.h> // XXX: fix the minimum requirement @@ -115,7 +116,43 @@ float CYScrollViewDecelerationRateNormal; @end /* }}} */ -@implementation CyteWebViewController +@implementation CyteWebViewController { + _H<CyteWebView, 1> webview_; + _transient UIScrollView *scroller_; + + _H<UIActivityIndicatorView> indicator_; + _H<IndirectDelegate, 1> indirect_; + _H<NSURLAuthenticationChallenge> challenge_; + + bool error_; + _H<NSURLRequest> request_; + bool ready_; + + _transient NSNumber *sensitive_; + _H<NSURL> appstore_; + + _H<NSString> title_; + _H<NSMutableSet> loading_; + + _H<NSMutableSet> registered_; + _H<NSTimer> timer_; + + // XXX: NSString * or UIImage * + _H<NSObject> custom_; + _H<NSString> style_; + + _H<WebScriptObject> function_; + + float width_; + Class class_; + + _H<UIBarButtonItem> reloaditem_; + _H<UIBarButtonItem> loadingitem_; + + bool visible_; + bool hidesNavigationBar_; + bool allowsNavigationAction_; +} #if ShowInternals #include "CyteKit/UCInternal.h" @@ -150,7 +187,7 @@ float CYScrollViewDecelerationRateNormal; [loading_ removeAllObjects]; if ([self retainsNetworkActivityIndicator]) - [delegate_ releaseNetworkActivityIndicator]; + [self.delegate releaseNetworkActivityIndicator]; } } @@ -172,6 +209,10 @@ float CYScrollViewDecelerationRateNormal; return (CyteWebView *) [self view]; } +- (CyteWebViewController *) indirect { + return (CyteWebViewController *) (IndirectDelegate *) indirect_; +} + - (NSURL *) URLWithURL:(NSURL *)url { return url; } @@ -193,6 +234,10 @@ float CYScrollViewDecelerationRateNormal; request_ = request; } +- (NSURLRequest *) request { + return request_; +} + - (void) setURL:(NSURL *)url { [self setURL:url withReferrer:nil]; } @@ -398,7 +443,7 @@ float CYScrollViewDecelerationRateNormal; NSURL *url([request URL]); // XXX: filter to internal usage? - CyteViewController *page([delegate_ pageForURL:url forExternal:NO withReferrer:referrer]); + CyteViewController *page([self.delegate pageForURL:url forExternal:NO withReferrer:referrer]); if (page == nil) { CyteWebViewController *browser([[[class_ alloc] init] autorelease]); @@ -406,8 +451,8 @@ float CYScrollViewDecelerationRateNormal; page = browser; } - [page setDelegate:delegate_]; - [page setPageColor:color_]; + [page setDelegate:self.delegate]; + [page setPageColor:self.pageColor]; if (!pop) { [[self navigationItem] setTitle:title_]; @@ -416,7 +461,7 @@ float CYScrollViewDecelerationRateNormal; } else { UINavigationController *navigation([[[UINavigationController alloc] initWithRootViewController:page] autorelease]); - [navigation setDelegate:delegate_]; + [navigation setDelegate:self.delegate]; [[page navigationItem] setLeftBarButtonItem:[[[UIBarButtonItem alloc] initWithTitle:UCLocalize("CLOSE") @@ -525,7 +570,7 @@ float CYScrollViewDecelerationRateNormal; return; if ([name isEqualToString:@"_open"]) - [delegate_ openURL:url]; + [self.delegate openURL:url]; else { NSString *scheme([[url scheme] lowercaseString]); if ([scheme isEqualToString:@"mailto"]) @@ -602,7 +647,7 @@ float CYScrollViewDecelerationRateNormal; } [super setPageColor:uic]; - [scroller_ setBackgroundColor:color_]; + [scroller_ setBackgroundColor:self.pageColor]; break; } } @@ -763,7 +808,7 @@ float CYScrollViewDecelerationRateNormal; } else if ([context isEqualToString:@"itmsappss"]) { if (button == [alert cancelButtonIndex]) { } else if (button == [alert firstOtherButtonIndex]) { - [delegate_ openURL:appstore_]; + [self.delegate openURL:appstore_]; } [alert dismissWithClickedButtonIndex:-1 animated:YES]; @@ -862,7 +907,7 @@ float CYScrollViewDecelerationRateNormal; return; if ([self retainsNetworkActivityIndicator]) - [delegate_ retainNetworkActivityIndicator]; + [self.delegate retainNetworkActivityIndicator]; [self didStartLoading]; } @@ -879,7 +924,7 @@ float CYScrollViewDecelerationRateNormal; [[self navigationItem] setTitle:title_]; if ([self retainsNetworkActivityIndicator]) - [delegate_ releaseNetworkActivityIndicator]; + [self.delegate releaseNetworkActivityIndicator]; [self didFinishLoading]; } @@ -1015,7 +1060,7 @@ float CYScrollViewDecelerationRateNormal; [webview_ setBackgroundColor:nil]; [scroller_ setFixedBackgroundPattern:YES]; - [scroller_ setBackgroundColor:color_]; + [scroller_ setBackgroundColor:self.pageColor]; [scroller_ setClipsSubviews:YES]; [scroller_ setBounces:YES]; diff --git a/CyteKit/WebViewTableViewCell.h b/CyteKit/WebViewTableViewCell.h index 83a3311..1af7835 100644 --- a/CyteKit/WebViewTableViewCell.h +++ b/CyteKit/WebViewTableViewCell.h @@ -24,15 +24,11 @@ #include <UIKit/UIKit.h> -#include "Menes/ObjectHandle.h" #include "CyteKit/WebView.h" @interface CyteWebViewTableViewCell : UITableViewCell < CyteWebViewDelegate -> { - // XXX: I'm not really the delegate here: fix this! - _H<CyteWebView, 1> webview_; -} +> + (CyteWebViewTableViewCell *) cellWithRequest:(NSURLRequest *)request; - (id) initWithRequest:(NSURLRequest *)request; diff --git a/CyteKit/WebViewTableViewCell.mm b/CyteKit/WebViewTableViewCell.mm index 3756a0f..7515b47 100644 --- a/CyteKit/WebViewTableViewCell.mm +++ b/CyteKit/WebViewTableViewCell.mm @@ -24,8 +24,12 @@ #include "CyteKit/WebViewTableViewCell.h" #include "iPhonePrivate.h" +#include <Menes/ObjectHandle.h> -@implementation CyteWebViewTableViewCell +@implementation CyteWebViewTableViewCell { + // XXX: I'm not really the delegate here: fix this! + _H<CyteWebView, 1> webview_; +} + (CyteWebViewTableViewCell *) cellWithRequest:(NSURLRequest *)request { CyteWebViewTableViewCell *cell([[[self alloc] initWithRequest:request] autorelease]); |