]> git.saurik.com Git - cydia.git/blob - CyteKit/WebViewController.h
Do not attempt to suspend Cydia on iOS before 8.0.
[cydia.git] / CyteKit / WebViewController.h
1 /* Cydia - iPhone UIKit Front-End for Debian APT
2 * Copyright (C) 2008-2014 Jay Freeman (saurik)
3 */
4
5 /* GNU General Public License, Version 3 {{{ */
6 /*
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.
11 *
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.
16 *
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 **/
20 /* }}} */
21
22 #ifndef CyteKit_WebViewController_H
23 #define CyteKit_WebViewController_H
24
25 #include "CyteKit/ViewController.h"
26 #include "CyteKit/WebView.h"
27
28 #include <UIKit/UIKit.h>
29 #include <MessageUI/MessageUI.h>
30
31 #include <Menes/ObjectHandle.h>
32
33 @class IndirectDelegate;
34
35 @protocol CyteWebViewControllerDelegate
36 - (void) retainNetworkActivityIndicator;
37 - (void) releaseNetworkActivityIndicator;
38 - (CyteViewController *) pageForURL:(NSURL *)url forExternal:(BOOL)external withReferrer:(NSString *)referrer;
39 - (void) unloadData;
40 @end
41
42 @interface CyteWebViewController : CyteViewController <
43 CyteWebViewDelegate,
44 MFMailComposeViewControllerDelegate,
45 UIWebViewDelegate
46 > {
47 _H<CyteWebView, 1> webview_;
48 _transient UIScrollView *scroller_;
49
50 _H<UIActivityIndicatorView> indicator_;
51 _H<IndirectDelegate, 1> indirect_;
52 _H<NSURLAuthenticationChallenge> challenge_;
53
54 bool error_;
55 _H<NSURLRequest> request_;
56 bool ready_;
57
58 _transient NSNumber *sensitive_;
59
60 _H<NSString> title_;
61 _H<NSMutableSet> loading_;
62
63 _H<NSMutableSet> registered_;
64 _H<NSTimer> timer_;
65
66 // XXX: NSString * or UIImage *
67 _H<NSObject> custom_;
68 _H<NSString> style_;
69
70 _H<WebScriptObject> function_;
71
72 float width_;
73 Class class_;
74
75 _H<UIBarButtonItem> reloaditem_;
76 _H<UIBarButtonItem> loadingitem_;
77
78 bool visible_;
79 bool hidesNavigationBar_;
80 bool allowsNavigationAction_;
81 }
82
83 + (void) _initialize;
84
85 - (CyteWebView *) webView;
86
87 - (void) setRequest:(NSURLRequest *)request;
88 - (void) setURL:(NSURL *)url;
89 - (void) setURL:(NSURL *)url withReferrer:(NSString *)referrer;
90
91 - (void) loadURL:(NSURL *)url cachePolicy:(NSURLRequestCachePolicy)policy;
92 - (void) loadURL:(NSURL *)url;
93
94 - (void) loadRequest:(NSURLRequest *)request;
95 - (bool) isLoading;
96
97 - (id) init;
98
99 - (id) initWithURL:(NSURL *)url;
100 - (id) initWithRequest:(NSURLRequest *)request;
101
102 - (id) initWithWidth:(float)width;
103 - (id) initWithWidth:(float)width ofClass:(Class)_class;
104
105 - (void) callFunction:(WebScriptObject *)function;
106 - (void) reloadURLWithCache:(BOOL)cache;
107
108 - (void) webView:(WebView *)view didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame;
109 - (NSURLRequest *) webView:(WebView *)view resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)source;
110
111 + (float) defaultWidth;
112
113 - (void) setButtonImage:(NSString *)button withStyle:(NSString *)style toFunction:(id)function;
114 - (void) setButtonTitle:(NSString *)button withStyle:(NSString *)style toFunction:(id)function;
115 - (void) setHidesNavigationBar:(bool)value;
116
117 - (void) alertView:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)button;
118 - (void) customButtonClicked;
119
120 - (void) applyRightButton;
121 - (UIBarButtonItem *) customButton;
122 - (UIBarButtonItem *) rightButton;
123
124 - (void) applyLeftButton;
125 - (UIBarButtonItem *) leftButton;
126
127 - (void) removeButton;
128
129 - (void) _didStartLoading;
130 - (void) _didFinishLoading;
131
132 - (void) close;
133
134 - (void) dispatchEvent:(NSString *)event;
135
136 - (void) setViewportWidthOnMainThread:(float)value;
137
138 - (void) setScrollAlwaysBounceVertical:(bool)value;
139 - (void) setScrollIndicatorStyle:(UIScrollViewIndicatorStyle)style;
140
141 - (void) registerFrame:(WebFrame *)frame;
142
143 @end
144
145 #endif//CyteKit_WebViewController_H