mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Update to auto-generated instance variables
This commit is contained in:
@@ -6,19 +6,8 @@
|
||||
@end
|
||||
|
||||
@interface HOStatusBar : OakStatusBar
|
||||
{
|
||||
BOOL isBusy;
|
||||
NSString* statusText;
|
||||
BOOL canGoBack;
|
||||
BOOL canGoForward;
|
||||
|
||||
NSProgressIndicator* spinner;
|
||||
NSProgressIndicator* progressIndicator;
|
||||
|
||||
id delegate;
|
||||
}
|
||||
@property (nonatomic, assign) BOOL isBusy;
|
||||
@property (nonatomic, assign) double progress;
|
||||
@property (nonatomic, assign) CGFloat progress;
|
||||
@property (nonatomic, copy) NSString* statusText;
|
||||
@property (nonatomic, assign) BOOL canGoBack;
|
||||
@property (nonatomic, assign) BOOL canGoForward;
|
||||
|
||||
@@ -1,51 +1,51 @@
|
||||
#import "HOStatusBar.h"
|
||||
|
||||
@interface HOStatusBar ()
|
||||
@property (nonatomic, retain) NSProgressIndicator* spinner;
|
||||
@property (nonatomic, retain) NSProgressIndicator* progressIndicator;
|
||||
- (void)update;
|
||||
@end
|
||||
|
||||
@implementation HOStatusBar
|
||||
@synthesize isBusy, canGoBack, canGoForward, statusText, delegate;
|
||||
|
||||
- (id)initWithFrame:(NSRect)frame
|
||||
{
|
||||
if(self = [super initWithFrame:frame])
|
||||
{
|
||||
statusText = @"";
|
||||
self.statusText = @"";
|
||||
|
||||
progressIndicator = [NSProgressIndicator new];
|
||||
[progressIndicator setMaxValue:1.0];
|
||||
[progressIndicator setControlSize:NSSmallControlSize];
|
||||
[progressIndicator setIndeterminate:NO];
|
||||
[progressIndicator setDisplayedWhenStopped:NO];
|
||||
[progressIndicator setFrame:NSMakeRect(0, 5, 96, 12)];
|
||||
[progressIndicator setBezeled:NO];
|
||||
_progressIndicator = [NSProgressIndicator new];
|
||||
[_progressIndicator setMaxValue:1];
|
||||
[_progressIndicator setControlSize:NSSmallControlSize];
|
||||
[_progressIndicator setIndeterminate:NO];
|
||||
[_progressIndicator setDisplayedWhenStopped:NO];
|
||||
[_progressIndicator setFrame:NSMakeRect(0, 5, 96, 12)];
|
||||
[_progressIndicator setBezeled:NO];
|
||||
|
||||
spinner = [NSProgressIndicator new];
|
||||
[spinner setControlSize:NSSmallControlSize];
|
||||
[spinner setStyle:NSProgressIndicatorSpinningStyle];
|
||||
[spinner setDisplayedWhenStopped:NO];
|
||||
_spinner = [NSProgressIndicator new];
|
||||
[_spinner setControlSize:NSSmallControlSize];
|
||||
[_spinner setStyle:NSProgressIndicatorSpinningStyle];
|
||||
[_spinner setDisplayedWhenStopped:NO];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[progressIndicator release];
|
||||
[spinner release];
|
||||
[statusText release];
|
||||
self.statusText = nil;
|
||||
self.spinner = nil;
|
||||
self.progressIndicator = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)update
|
||||
{
|
||||
std::vector<sb::cell_t> newCells;
|
||||
newCells.push_back(sb::cell_t::button(sb::cell_t::template_image(NSImageNameGoLeftTemplate), @selector(goBack:), delegate).enabled(self.canGoBack).tool_tip("Go Back"));
|
||||
newCells.push_back(sb::cell_t::button(sb::cell_t::template_image(NSImageNameGoRightTemplate), @selector(goForward:), delegate).enabled(self.canGoForward).tool_tip("Go Forward"));
|
||||
newCells.push_back(sb::cell_t::info(statusText).size(20, CGFLOAT_MAX).no_separator());
|
||||
if(progressIndicator.doubleValue > 0)
|
||||
newCells.push_back(sb::cell_t::info(progressIndicator).size(50, 150));
|
||||
else newCells.push_back(sb::cell_t::info(spinner).size(16));
|
||||
newCells.push_back(sb::cell_t::button(sb::cell_t::template_image(NSImageNameGoLeftTemplate), @selector(goBack:), _delegate).enabled(self.canGoBack).tool_tip("Go Back"));
|
||||
newCells.push_back(sb::cell_t::button(sb::cell_t::template_image(NSImageNameGoRightTemplate), @selector(goForward:), _delegate).enabled(self.canGoForward).tool_tip("Go Forward"));
|
||||
newCells.push_back(sb::cell_t::info(_statusText).size(20, CGFLOAT_MAX).no_separator());
|
||||
if(_progressIndicator.doubleValue > 0)
|
||||
newCells.push_back(sb::cell_t::info(_progressIndicator).size(50, 150));
|
||||
else newCells.push_back(sb::cell_t::info(_spinner).size(16));
|
||||
newCells.push_back(sb::cell_t::info().size(30));
|
||||
|
||||
[self setCells:newCells];
|
||||
@@ -53,43 +53,43 @@
|
||||
|
||||
- (void)setStatusText:(NSString*)text
|
||||
{
|
||||
if(text != statusText)
|
||||
if(_statusText != text && ![_statusText isEqualToString:text])
|
||||
{
|
||||
[statusText release];
|
||||
statusText = [text retain] ?: @"";
|
||||
[_statusText release];
|
||||
_statusText = [text retain] ?: @"";
|
||||
[self update];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setIsBusy:(BOOL)flag
|
||||
{
|
||||
isBusy = flag;
|
||||
if(isBusy)
|
||||
[spinner startAnimation:nil];
|
||||
else [spinner stopAnimation:nil];
|
||||
_isBusy = flag;
|
||||
if(_isBusy)
|
||||
[_spinner startAnimation:nil];
|
||||
else [_spinner stopAnimation:nil];
|
||||
[self update];
|
||||
}
|
||||
|
||||
- (double)progress
|
||||
- (CGFloat)progress
|
||||
{
|
||||
return progressIndicator.doubleValue;
|
||||
return _progressIndicator.doubleValue;
|
||||
}
|
||||
|
||||
- (void)setProgress:(double)value
|
||||
- (void)setProgress:(CGFloat)value
|
||||
{
|
||||
progressIndicator.doubleValue = value;
|
||||
_progressIndicator.doubleValue = value;
|
||||
[self update];
|
||||
}
|
||||
|
||||
- (void)setCanGoBack:(BOOL)flag
|
||||
{
|
||||
canGoBack = flag;
|
||||
_canGoBack = flag;
|
||||
[self update];
|
||||
}
|
||||
|
||||
- (void)setCanGoForward:(BOOL)flag
|
||||
{
|
||||
canGoForward = flag;
|
||||
_canGoForward = flag;
|
||||
[self update];
|
||||
}
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user