CDVThemeableBrowser.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. Licensed to the Apache Software Foundation (ASF) under one
  3. or more contributor license agreements. See the NOTICE file
  4. distributed with this work for additional information
  5. regarding copyright ownership. The ASF licenses this file
  6. to you under the Apache License, Version 2.0 (the
  7. "License"); you may not use this file except in compliance
  8. with the License. You may obtain a copy of the License at
  9. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing,
  11. software distributed under the License is distributed on an
  12. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  13. KIND, either express or implied. See the License for the
  14. specific language governing permissions and limitations
  15. under the License.
  16. */
  17. #import <Cordova/CDVPlugin.h>
  18. #import <Cordova/CDVInvokedUrlCommand.h>
  19. #import <Cordova/CDVScreenOrientationDelegate.h>
  20. #ifdef __CORDOVA_4_0_0
  21. #import <Cordova/CDVUIWebViewDelegate.h>
  22. #else
  23. #import <Cordova/CDVWebViewDelegate.h>
  24. #endif
  25. @interface CDVThemeableBrowserOptions : NSObject {}
  26. @property (nonatomic) BOOL location;
  27. @property (nonatomic) NSString* closebuttoncaption;
  28. @property (nonatomic) NSString* toolbarposition;
  29. @property (nonatomic) BOOL clearcache;
  30. @property (nonatomic) BOOL clearsessioncache;
  31. @property (nonatomic) NSString* presentationstyle;
  32. @property (nonatomic) NSString* transitionstyle;
  33. @property (nonatomic) BOOL zoom;
  34. @property (nonatomic) BOOL mediaplaybackrequiresuseraction;
  35. @property (nonatomic) BOOL allowinlinemediaplayback;
  36. @property (nonatomic) BOOL keyboarddisplayrequiresuseraction;
  37. @property (nonatomic) BOOL suppressesincrementalrendering;
  38. @property (nonatomic) BOOL hidden;
  39. @property (nonatomic) BOOL disallowoverscroll;
  40. @property (nonatomic) NSDictionary* statusbar;
  41. @property (nonatomic) NSDictionary* toolbar;
  42. @property (nonatomic) NSDictionary* title;
  43. @property (nonatomic) NSDictionary* backButton;
  44. @property (nonatomic) NSDictionary* forwardButton;
  45. @property (nonatomic) NSDictionary* closeButton;
  46. @property (nonatomic) NSDictionary* menu;
  47. @property (nonatomic) NSArray* customButtons;
  48. @property (nonatomic) BOOL backButtonCanClose;
  49. @property (nonatomic) BOOL disableAnimation;
  50. @property (nonatomic) BOOL fullscreen;
  51. @end
  52. @class CDVThemeableBrowserViewController;
  53. @interface CDVThemeableBrowser : CDVPlugin {
  54. BOOL _injectedIframeBridge;
  55. }
  56. @property (nonatomic, retain) CDVThemeableBrowserViewController* themeableBrowserViewController;
  57. @property (nonatomic, copy) NSString* callbackId;
  58. @property (nonatomic, copy) NSRegularExpression *callbackIdPattern;
  59. - (CDVThemeableBrowserOptions*)parseOptions:(NSString*)options;
  60. - (void)open:(CDVInvokedUrlCommand*)command;
  61. - (void)close:(CDVInvokedUrlCommand*)command;
  62. - (void)injectScriptCode:(CDVInvokedUrlCommand*)command;
  63. - (void)show:(CDVInvokedUrlCommand*)command;
  64. - (void)show:(CDVInvokedUrlCommand*)command withAnimation:(BOOL)animated;
  65. - (void)reload:(CDVInvokedUrlCommand*)command;
  66. @end
  67. @interface CDVThemeableBrowserViewController : UIViewController <UIWebViewDelegate, CDVScreenOrientationDelegate, UIActionSheetDelegate>{
  68. @private
  69. NSString* _userAgent;
  70. NSString* _prevUserAgent;
  71. NSInteger _userAgentLockToken;
  72. UIStatusBarStyle _statusBarStyle;
  73. CDVThemeableBrowserOptions *_browserOptions;
  74. #ifdef __CORDOVA_4_0_0
  75. CDVUIWebViewDelegate* _webViewDelegate;
  76. #else
  77. CDVWebViewDelegate* _webViewDelegate;
  78. #endif
  79. }
  80. @property (nonatomic, strong) IBOutlet UIWebView* webView;
  81. @property (nonatomic, strong) IBOutlet UIButton* closeButton;
  82. @property (nonatomic, strong) IBOutlet UILabel* addressLabel;
  83. @property (nonatomic, strong) IBOutlet UILabel* titleLabel;
  84. @property (nonatomic, strong) IBOutlet UIButton* backButton;
  85. @property (nonatomic, strong) IBOutlet UIButton* forwardButton;
  86. @property (nonatomic, strong) IBOutlet UIButton* menuButton;
  87. @property (nonatomic, strong) IBOutlet UIActivityIndicatorView* spinner;
  88. @property (nonatomic, strong) IBOutlet UIView* toolbar;
  89. @property (nonatomic, strong) NSArray* leftButtons;
  90. @property (nonatomic, strong) NSArray* rightButtons;
  91. @property (nonatomic, weak) id <CDVScreenOrientationDelegate> orientationDelegate;
  92. @property (nonatomic, weak) CDVThemeableBrowser* navigationDelegate;
  93. @property (nonatomic) NSURL* currentURL;
  94. @property (nonatomic) CGFloat titleOffset;
  95. - (void)close;
  96. - (void)reload;
  97. - (void)navigateTo:(NSURL*)url;
  98. - (void)showLocationBar:(BOOL)show;
  99. - (void)showToolBar:(BOOL)show : (NSString*) toolbarPosition;
  100. - (void)setCloseButtonTitle:(NSString*)title;
  101. - (id)initWithUserAgent:(NSString*)userAgent prevUserAgent:(NSString*)prevUserAgent browserOptions: (CDVThemeableBrowserOptions*) browserOptions navigationDelete:(CDVThemeableBrowser*) navigationDelegate statusBarStyle:(UIStatusBarStyle) statusBarStyle;
  102. + (UIColor *)colorFromRGBA:(NSString *)rgba;
  103. @end
  104. @interface CDVThemeableBrowserNavigationController : UINavigationController
  105. @property (nonatomic, weak) id <CDVScreenOrientationDelegate> orientationDelegate;
  106. @end