From 030e3d56d62520b17abd7fea3b48a355e98d1edc Mon Sep 17 00:00:00 2001 From: michael Date: Mon, 26 Jul 1999 08:06:36 +0000 Subject: [PATCH] More and more fun stuff, NSTabView kicks arse now. :-) git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4655 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 8 +++++++- Source/NSTabView.m | 23 ++++++++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 57eff8d6e..9065009b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,7 +9,13 @@ * Source/NSTabView.m: implementation is at 90%. All delegate messages are sent as required (if possible) and tab selection is now by the spec. Also a small optimization in tab selection makes - sure we don't reselect tabs that are already selected. + sure we don't reselect tabs that are already selected. Also, when + drawRect is called, if no tab is selected the first tab becomes + selected. Further, we properly keep the value of the index of the + currently selected item. I also fixed the drawing code for use + NSTabView without displaying tabs. The result of this can be seen + in core/Testing/GNUstepInstaller.app. Tidied (- contentRect) to + return something a little closer to the full rect. * Source/NSMenu.m: redid alot of the insertItem: addItem: methods to unify under the one primitive method. Did the same for removeItem:. Also added all the rest of the NSMenu notifications: diff --git a/Source/NSTabView.m b/Source/NSTabView.m index 4516d9f53..291d3462f 100644 --- a/Source/NSTabView.m +++ b/Source/NSTabView.m @@ -152,6 +152,7 @@ [tab_delegate tabView:self willSelectTabViewItem:tab_selected]; } + tab_selected_item = [tab_items indexOfObject:tab_selected]; [tab_selected _setTabState:NSSelectedTab]; if ([tab_selected view]) [self addSubview:[tab_selected view]]; @@ -161,6 +162,8 @@ { [tab_delegate tabView:self didSelectTabViewItem:tab_selected]; } + + [self setNeedsDisplay:YES]; } } @@ -234,12 +237,13 @@ { NSRect cRect = [self frame]; - cRect.origin.x = 2; - cRect.origin.y = 2; - cRect.size.height -= 4; - cRect.size.width -= 4; + cRect.origin.x = 0; + cRect.origin.y = 0; + cRect.size.height += 1; + cRect.size.width += 1; - cRect.size.height -= 21; + if (tab_type == NSTopTabsBezelBorder) + cRect.size.height -= 21; return cRect; } @@ -276,6 +280,15 @@ break; } + if (!tab_selected) + [self selectFirstTabViewItem:nil]; + + if (tab_type == NSNoTabsBezelBorder) + { + DPSgrestore(ctxt); + return; + } + for (i=0;i