]> git.saurik.com Git - cydia.git/blob - UICaboodle/BrowserView.h
Check respondsToSelector: for CYWebViewDelegate::JavaScript*Panel.
[cydia.git] / UICaboodle / BrowserView.h
1 #import <UICaboodle/RVPage.h>
2 #import <UICaboodle/RVBook.h>
3
4 #import <UIKit/UIKit.h>
5
6 #include <WebKit/DOMNodeList.h>
7 #include <WebKit/WebFrame.h>
8 #include <WebKit/WebScriptObject.h>
9 #include <WebKit/WebView.h>
10
11 #import <JavaScriptCore/JavaScriptCore.h>
12
13 @class NSMutableArray;
14 @class NSString;
15 @class NSURL;
16 @class NSURLRequest;
17
18 @class UIProgressIndicator;
19 @class UIScroller;
20 @class UIDocumentWebView;
21
22 @class WebView;
23
24 @class Database;
25 @class IndirectDelegate;
26
27 @protocol CYWebViewDelegate <UIWebViewDelegate>
28 - (void) webView:(WebView *)view decidePolicyForNavigationAction:(NSDictionary *)action request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id<WebPolicyDecisionListener>)listener;
29 - (void) webView:(WebView *)view decidePolicyForNewWindowAction:(NSDictionary *)action request:(NSURLRequest *)request newFrameName:(NSString *)name decisionListener:(id<WebPolicyDecisionListener>)listener;
30 - (void) webView:(WebView *)view didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame;
31 - (void) webView:(WebView *)view didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
32 - (void) webView:(WebView *)view didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
33 - (void) webView:(WebView *)view didFinishLoadForFrame:(WebFrame *)frame;
34 - (void) webView:(WebView *)view didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame;
35 - (void) webView:(WebView *)view didStartProvisionalLoadForFrame:(WebFrame *)frame;
36 - (NSURLRequest *) webView:(WebView *)view resource:(id)resource willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)source;
37 - (void) webViewClose:(WebView *)view;
38 - (bool) webView:(WebView *)view shouldRunJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame;
39 - (bool) webView:(WebView *)view shouldRunJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame;
40 - (bool) webView:(WebView *)view shouldRunJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)text initiatedByFrame:(WebFrame *)frame;
41 - (void) webViewUpdateViewSettings:(UIWebView *)view;
42 @end
43
44 @interface CYWebView : UIWebView
45 - (id<CYWebViewDelegate>) delegate;
46 @end
47
48 @interface WebScriptObject (UICaboodle)
49 - (NSUInteger) count;
50 - (id) objectAtIndex:(unsigned)index;
51 @end
52
53 @protocol BrowserControllerDelegate
54 - (CYViewController *) pageForURL:(NSURL *)url hasTag:(int *)tag;
55 @end
56
57 @interface BrowserController : CYViewController <
58 CYWebViewDelegate,
59 HookProtocol,
60 UIWebViewDelegate
61 > {
62 _transient CYWebView *webview_;
63 _transient UIScrollView *scroller_;
64
65 UIProgressIndicator *indicator_;
66 IndirectDelegate *indirect_;
67 NSURLAuthenticationChallenge *challenge_;
68
69 bool error_;
70 NSURLRequest *request_;
71
72 _transient NSNumber *sensitive_;
73
74 NSString *title_;
75 NSMutableSet *loading_;
76
77 // XXX: NSString * or UIImage *
78 id custom_;
79 NSString *style_;
80
81 WebScriptObject *function_;
82 WebScriptObject *closer_;
83
84 float width_;
85 Class class_;
86
87 UIBarButtonItem *reloaditem_;
88 UIBarButtonItem *loadingitem_;
89 }
90
91 + (void) _initialize;
92
93 - (void) loadURL:(NSURL *)url cachePolicy:(NSURLRequestCachePolicy)policy;
94 - (void) loadURL:(NSURL *)url;
95
96 - (void) loadRequest:(NSURLRequest *)request;
97 - (void) reloadURL;
98 - (bool) isLoading;
99
100 - (id) init;
101 - (id) initWithWidth:(float)width;
102 - (id) initWithWidth:(float)width ofClass:(Class)_class;
103
104 - (void) callFunction:(WebScriptObject *)function;
105
106 - (void) webView:(WebView *)view didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame;
107 - (NSURLRequest *) webView:(WebView *)view resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)source;
108
109 + (float) defaultWidth;
110
111 - (void) setButtonImage:(NSString *)button withStyle:(NSString *)style toFunction:(id)function;
112 - (void) setButtonTitle:(NSString *)button withStyle:(NSString *)style toFunction:(id)function;
113 - (void) setPopupHook:(id)function;
114
115 - (void) alertView:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)button;
116 - (void) customButtonClicked;
117 - (void) applyRightButton;
118
119 - (void) _didStartLoading;
120 - (void) _didFinishLoading;
121
122 - (void) close;
123
124 @end