summaryrefslogtreecommitdiff
path: root/cocoa/BrowserWindowController.m
diff options
context:
space:
mode:
Diffstat (limited to 'cocoa/BrowserWindowController.m')
-rw-r--r--cocoa/BrowserWindowController.m35
1 files changed, 35 insertions, 0 deletions
diff --git a/cocoa/BrowserWindowController.m b/cocoa/BrowserWindowController.m
index 84be95c56..ff40bf094 100644
--- a/cocoa/BrowserWindowController.m
+++ b/cocoa/BrowserWindowController.m
@@ -48,6 +48,8 @@
- (void) awakeFromNib;
{
[tabBar setShowAddTabButton: YES];
+ [tabBar setTearOffStyle: PSMTabBarTearOffMiniwindow];
+ [tabBar setCanCloseOnlyTab: YES];
NSButton *b = [tabBar addTabButton];
[b setTarget: self];
@@ -79,6 +81,13 @@
}
}
+- (void) windowWillClose: (NSNotification *)notification;
+{
+ for (NSTabViewItem *tab in [tabView tabViewItems]) {
+ [tabView removeTabViewItem: tab];
+ }
+}
+
extern NSString * const kHomepageURL;
- (IBAction) newTab: (id) sender;
{
@@ -101,4 +110,30 @@ extern NSString * const kHomepageURL;
[self setActiveBrowser: [tabViewItem identifier]];
}
+- (BOOL)tabView:(NSTabView*)aTabView shouldDragTabViewItem:(NSTabViewItem *)tabViewItem fromTabBar:(PSMTabBarControl *)tabBarControl
+{
+ return YES;
+}
+
+- (BOOL)tabView:(NSTabView*)aTabView shouldDropTabViewItem:(NSTabViewItem *)tabViewItem inTabBar:(PSMTabBarControl *)tabBarControl
+{
+ [[tabViewItem identifier] setWindowController: self];
+ return YES;
+}
+
+- (PSMTabBarControl *)tabView:(NSTabView *)aTabView newTabBarForDraggedTabViewItem:(NSTabViewItem *)tabViewItem atPoint:(NSPoint)point;
+{
+ BrowserWindowController *newWindow = [[[BrowserWindowController alloc] init] autorelease];
+ [[tabViewItem identifier] setWindowController: newWindow];
+ [[newWindow window] setFrameOrigin: point];
+ return newWindow->tabBar;
+}
+
+- (void) tabView: (NSTabView *)aTabView didCloseTabViewItem: (NSTabViewItem *)tabViewItem;
+{
+ [tabViewItem unbind: @"label"];
+ browser_window_destroy( [[tabViewItem identifier] browser] );
+ [self setActiveBrowser: nil];
+}
+
@end