summaryrefslogtreecommitdiff
path: root/UICaboodle/BrowserView.mm
diff options
context:
space:
mode:
authorGrant Paul <chpwn@chpwn.com>2010-09-23 16:32:04 -0700
committerJay Freeman <saurik@Jay-Freemans-MacBook-Pro.local>2010-10-04 00:12:20 -0700
commit2e6c1426b817fe8236e916ef74646b9e358173fd (patch)
tree681e1b52e164e1c577008e03eacc81dc250bf12f /UICaboodle/BrowserView.mm
parentbc1b51a30f9e62a3b5e4ebb397b36a74f32ad887 (diff)
actually add files
Diffstat (limited to 'UICaboodle/BrowserView.mm')
-rw-r--r--UICaboodle/BrowserView.mm82
1 files changed, 50 insertions, 32 deletions
diff --git a/UICaboodle/BrowserView.mm b/UICaboodle/BrowserView.mm
index 1adf247..793fe5d 100644
--- a/UICaboodle/BrowserView.mm
+++ b/UICaboodle/BrowserView.mm
@@ -279,6 +279,11 @@ static Class $UIWebBrowserView;
[sensitive_ release];
if (title_ != nil)
[title_ release];
+ if (reloaditem_ != nil)
+ [reloaditem_ release];
+ if (loadingitem_ != nil)
+ [loadingitem_ release];
+
[super dealloc];
}
@@ -1034,27 +1039,39 @@ static Class $UIWebBrowserView;
[self _startLoading];
}
+- (UINavigationButtonStyle) rightButtonStyle {
+ if (style_ == nil) normal:
+ return UINavigationButtonStyleNormal;
+ else if ([style_ isEqualToString:@"Normal"])
+ return UINavigationButtonStyleNormal;
+ else if ([style_ isEqualToString:@"Back"])
+ return UINavigationButtonStyleBack;
+ else if ([style_ isEqualToString:@"Highlighted"])
+ return UINavigationButtonStyleHighlighted;
+ else if ([style_ isEqualToString:@"Destructive"])
+ return UINavigationButtonStyleDestructive;
+ else goto normal;
+}
+
+- (UIBarButtonItem *) customButton {
+ UIBarButtonItem *customItem = [[UIBarButtonItem alloc]
+ initWithTitle:button_
+ style:[self rightButtonStyle]
+ target:self
+ action:@selector(customButtonClicked)
+ ];
+
+ return [customItem autorelease];
+}
+
- (void) applyRightButton {
if ([self isLoading]) {
- UIBarButtonItem *reloadItem = [[UIBarButtonItem alloc]
- initWithTitle:@" "
- style:UIBarButtonItemStylePlain
- target:self
- action:@selector(reloadButtonClicked)
- ];
- [[self navigationItem] setRightBarButtonItem:reloadItem];
- [[reloadItem view] addSubview:indicator_];
- [[self navigationItem] setTitle:UCLocalize("LOADING")];
- [reloadItem release];
+ [[self navigationItem] setRightBarButtonItem:loadingitem_ animated:YES];
+ [[self navigationItem] setTitle:UCLocalize("LOADING")];
+ } else if (button_) {
+ [[self navigationItem] setRightBarButtonItem:[self customButton] animated:YES];
} else {
- UIBarButtonItem *reloadItem = [[UIBarButtonItem alloc]
- initWithTitle:button_ ?: UCLocalize("RELOAD")
- style:[self rightButtonStyle]
- target:self
- action:button_ ? @selector(customButtonClicked) : @selector(reloadButtonClicked)
- ];
- [[self navigationItem] setRightBarButtonItem:reloadItem animated:YES];
- [reloadItem release];
+ [[self navigationItem] setRightBarButtonItem:reloaditem_ animated:YES];
}
}
@@ -1465,6 +1482,21 @@ static Class $UIWebBrowserView;
indicator_ = [[UIProgressIndicator alloc] initWithFrame:CGRectMake(15, 5, indsize.width, indsize.height)];
[indicator_ setStyle:UIProgressIndicatorStyleMediumWhite];
[indicator_ startAnimation];
+
+ reloaditem_ = [[UIBarButtonItem alloc]
+ initWithTitle:UCLocalize("RELOAD")
+ style:[self rightButtonStyle]
+ target:self
+ action:@selector(reloadButtonClicked)
+ ];
+
+ loadingitem_ = [[UIBarButtonItem alloc]
+ initWithTitle:@" "
+ style:UIBarButtonItemStylePlain
+ target:self
+ action:@selector(reloadButtonClicked)
+ ];
+ [[loadingitem_ view] addSubview:indicator_];
[scroller_ setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
[indicator_ setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin];
@@ -1543,20 +1575,6 @@ static Class $UIWebBrowserView;
[self reloadButtonClicked];
}
-- (UINavigationButtonStyle) rightButtonStyle {
- if (style_ == nil) normal:
- return UINavigationButtonStyleNormal;
- else if ([style_ isEqualToString:@"Normal"])
- return UINavigationButtonStyleNormal;
- else if ([style_ isEqualToString:@"Back"])
- return UINavigationButtonStyleBack;
- else if ([style_ isEqualToString:@"Highlighted"])
- return UINavigationButtonStyleHighlighted;
- else if ([style_ isEqualToString:@"Destructive"])
- return UINavigationButtonStyleDestructive;
- else goto normal;
-}
-
- (void) setPageActive:(BOOL)active {
if (!active)
[indicator_ removeFromSuperview];