mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Add ‘visible’ property to OakHTMLOutputView
This can be observed to learn when the view is hidden, either because the window it is in closes or when it is removed from its superview.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
@property (nonatomic) NSUUID* commandIdentifier; // UUID from initial load request
|
||||
@property (nonatomic, getter = isRunningCommand, readonly) BOOL runningCommand;
|
||||
@property (nonatomic, getter = isVisible, readonly) BOOL visible;
|
||||
|
||||
// Read-only access to the webview is given to allow reading page title, etc.
|
||||
@property (nonatomic, readonly) WebView* webView;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
@property (nonatomic) HOAutoScroll* autoScrollHelper;
|
||||
@property (nonatomic) std::map<std::string, std::string> environment;
|
||||
@property (nonatomic) NSRect pendingVisibleRect;
|
||||
@property (nonatomic, getter = isVisible) BOOL visible;
|
||||
@end
|
||||
|
||||
@implementation OakHTMLOutputView
|
||||
@@ -100,6 +101,19 @@
|
||||
return self.webView.mainFrameTitle;
|
||||
}
|
||||
|
||||
- (void)viewDidMoveToWindow
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowWillCloseNotification object:nil];
|
||||
if(self.window)
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowWillClose:) name:NSWindowWillCloseNotification object:self.window];
|
||||
self.visible = self.window ? YES : NO;
|
||||
}
|
||||
|
||||
- (void)windowWillClose:(NSNotification*)aNotification
|
||||
{
|
||||
self.visible = NO;
|
||||
}
|
||||
|
||||
// =======================
|
||||
// = Frame Load Delegate =
|
||||
// =======================
|
||||
|
||||
Reference in New Issue
Block a user