#import <JavaScriptCore/JavaScriptCore.h>
+#include "substrate.h"
+
@class NSMutableArray;
@class NSString;
@class NSURL;
NSMutableSet *loading_;
// XXX: NSString * or UIImage *
- id custom_;
- NSString *style_;
+ _H<NSObject> custom_;
+ _H<NSString> style_;
- WebScriptObject *function_;
+ _H<WebScriptObject> function_;
WebScriptObject *closer_;
float width_;
if (request_ != nil)
[request_ release];
- if (custom_ != nil)
- [custom_ release];
- if (style_ != nil)
- [style_ release];
-
- if (function_ != nil)
- [function_ release];
if (closer_ != nil)
[closer_ release];
}
- (void) setButtonImage:(NSString *)button withStyle:(NSString *)style toFunction:(id)function {
- if (custom_ != nil)
- [custom_ autorelease];
- if (button == nil)
- custom_ = nil;
- else
- custom_ = [[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:button]]] retain];
-
- if (style_ != nil)
- [style_ autorelease];
- if (style == nil)
- style_ = nil;
- else
- style_ = [style retain];
-
- if (function_ != nil)
- [function_ autorelease];
- if (function == nil)
- function_ = nil;
- else
- function_ = [function retain];
+ custom_ = button;
+ style_ = style;
+ function_ = function;
[self performSelectorOnMainThread:@selector(applyRightButton) withObject:nil waitUntilDone:NO];
}
- (void) setButtonTitle:(NSString *)button withStyle:(NSString *)style toFunction:(id)function {
- if (custom_ != nil)
- [custom_ autorelease];
- if (button == nil)
- custom_ = nil;
- else
- custom_ = [button retain];
-
- if (style_ != nil)
- [style_ autorelease];
- if (style == nil)
- style_ = nil;
- else
- style_ = [style retain];
+ custom_ = button;
+ style_ = style;
+ function_ = function;
- if (function_ != nil)
- [function_ autorelease];
- if (function == nil)
- function_ = nil;
- else
- function_ = [function retain];
[self performSelectorOnMainThread:@selector(applyRightButton) withObject:nil waitUntilDone:NO];
}
if ([frame parentFrame] == nil) {
CYRelease(title_);
- CYRelease(custom_);
- CYRelease(style_);
- CYRelease(function_);
+ custom_ = nil;
+ style_ = nil;
+ function_ = nil;
CYRelease(closer_);
// XXX: do we still need to do this?