]> git.saurik.com Git - cydia.git/blame - CyteKit/WebViewController.h
Rewrite error handling in APT to make it saner :/.
[cydia.git] / CyteKit / WebViewController.h
CommitLineData
819a0ab1 1/* Cydia - iPhone UIKit Front-End for Debian APT
4c66fad9 2 * Copyright (C) 2008-2015 Jay Freeman (saurik)
819a0ab1
JF
3*/
4
6d9696a5 5/* GNU General Public License, Version 3 {{{ */
819a0ab1 6/*
6d9696a5
JF
7 * Cydia is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published
9 * by the Free Software Foundation, either version 3 of the License,
10 * or (at your option) any later version.
819a0ab1 11 *
6d9696a5
JF
12 * Cydia is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
819a0ab1 16 *
6d9696a5
JF
17 * You should have received a copy of the GNU General Public License
18 * along with Cydia. If not, see <http://www.gnu.org/licenses/>.
19**/
819a0ab1
JF
20/* }}} */
21
d458596e
JF
22#ifndef CyteKit_WebViewController_H
23#define CyteKit_WebViewController_H
819a0ab1 24
d458596e
JF
25#include "CyteKit/ViewController.h"
26#include "CyteKit/WebView.h"
819a0ab1
JF
27
28#include <UIKit/UIKit.h>
2b2a4e33 29#include <MessageUI/MessageUI.h>
ab398adf 30
bf7c998c 31#include <Menes/ObjectHandle.h>
46d3a5cf 32
facbc56d 33@class IndirectDelegate;
43f3d7f6 34
09e89a8a 35@protocol CyteWebViewControllerDelegate
54043703
JF
36- (void) retainNetworkActivityIndicator;
37- (void) releaseNetworkActivityIndicator;
f050e4d9 38- (CyteViewController *) pageForURL:(NSURL *)url forExternal:(BOOL)external withReferrer:(NSString *)referrer;
302bf91c 39- (void) unloadData;
43f3d7f6 40@end
ab398adf 41
cd79e8cf 42@interface CyteWebViewController : CyteViewController <
1ee69bb4 43 CyteWebViewDelegate,
2b2a4e33 44 MFMailComposeViewControllerDelegate,
2634b249 45 UIWebViewDelegate
c21004b9 46> {
bf7c998c 47 _H<CyteWebView, 1> webview_;
3931b718 48 _transient UIScrollView *scroller_;
2634b249 49
7b33d201 50 _H<UIActivityIndicatorView> indicator_;
bf7c998c 51 _H<IndirectDelegate, 1> indirect_;
7b33d201 52 _H<NSURLAuthenticationChallenge> challenge_;
fe468f45
JF
53
54 bool error_;
a374f380 55 _H<NSURLRequest> request_;
d9fc1d37 56 bool ready_;
ab398adf 57
3931b718 58 _transient NSNumber *sensitive_;
1002f4d9 59 _H<NSURL> appstore_;
2634b249 60
7b33d201
JF
61 _H<NSString> title_;
62 _H<NSMutableSet> loading_;
a0376fc1 63
aa1e1906
JF
64 _H<NSMutableSet> registered_;
65 _H<NSTimer> timer_;
66
2634b249 67 // XXX: NSString * or UIImage *
46d3a5cf
JF
68 _H<NSObject> custom_;
69 _H<NSString> style_;
caa427d1 70
46d3a5cf 71 _H<WebScriptObject> function_;
3e9c9e85
JF
72
73 float width_;
245cce8a 74 Class class_;
bc11cf5b 75
7b33d201
JF
76 _H<UIBarButtonItem> reloaditem_;
77 _H<UIBarButtonItem> loadingitem_;
5cdfcd6f
JF
78
79 bool visible_;
80 bool hidesNavigationBar_;
8366df5e 81 bool allowsNavigationAction_;
ab398adf
JF
82}
83
ea173384
JF
84+ (void) _initialize;
85
6f837280
JF
86- (CyteWebView *) webView;
87
e8eda555 88- (void) setRequest:(NSURLRequest *)request;
eb09425a 89- (void) setURL:(NSURL *)url;
f050e4d9 90- (void) setURL:(NSURL *)url withReferrer:(NSString *)referrer;
eb09425a 91
ab398adf
JF
92- (void) loadURL:(NSURL *)url cachePolicy:(NSURLRequestCachePolicy)policy;
93- (void) loadURL:(NSURL *)url;
94
95- (void) loadRequest:(NSURLRequest *)request;
12b59862 96- (bool) isLoading;
ab398adf 97
b5e7eebb 98- (id) init;
68bd7c60 99
eb09425a 100- (id) initWithURL:(NSURL *)url;
68bd7c60
JF
101- (id) initWithRequest:(NSURLRequest *)request;
102
b5e7eebb
GP
103- (id) initWithWidth:(float)width;
104- (id) initWithWidth:(float)width ofClass:(Class)_class;
ab398adf 105
caa427d1 106- (void) callFunction:(WebScriptObject *)function;
fedd38fe 107- (void) reloadURLWithCache:(BOOL)cache;
caa427d1 108
2634b249 109- (void) webView:(WebView *)view didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame;
92de61aa 110
2634b249 111- (NSURLRequest *) webView:(WebView *)view resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)source;
92de61aa 112- (NSURLRequest *) webThreadWebView:(WebView *)view resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)source;
43f3d7f6 113
3e9c9e85
JF
114+ (float) defaultWidth;
115
caa427d1
JF
116- (void) setButtonImage:(NSString *)button withStyle:(NSString *)style toFunction:(id)function;
117- (void) setButtonTitle:(NSString *)button withStyle:(NSString *)style toFunction:(id)function;
5cdfcd6f 118- (void) setHidesNavigationBar:(bool)value;
caa427d1 119
c21004b9 120- (void) alertView:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)button;
a5938ea5 121- (void) customButtonClicked;
d53628b6 122
c21004b9 123- (void) applyRightButton;
29756674 124- (UIBarButtonItem *) customButton;
d53628b6 125- (UIBarButtonItem *) rightButton;
c21004b9 126
e6124cb6
JF
127- (void) applyLeftButton;
128- (UIBarButtonItem *) leftButton;
129
4cc9e99a
JF
130- (void) removeButton;
131
2634b249
JF
132- (void) _didStartLoading;
133- (void) _didFinishLoading;
134
c21004b9
JF
135- (void) close;
136
f196b921
JF
137- (void) dispatchEvent:(NSString *)event;
138
8dbdaafa
JF
139- (void) setViewportWidthOnMainThread:(float)value;
140
db698f42 141- (void) setScrollAlwaysBounceVertical:(bool)value;
4886cc81
JF
142- (void) setScrollIndicatorStyle:(UIScrollViewIndicatorStyle)style;
143
aa1e1906
JF
144- (void) registerFrame:(WebFrame *)frame;
145
a5938ea5 146@end
819a0ab1 147
d458596e 148#endif//CyteKit_WebViewController_H