git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4554 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Michael Silva 1999-07-09 21:04:00 +00:00
parent 7084274d82
commit c01e5f1b4d
6 changed files with 51 additions and 6 deletions

View file

@ -1,3 +1,11 @@
1999-07-9 Michael Hanni <mhanni@sprintmail.com>
* Headers/AppKit/NSTabViewItem.h: defined some non-spec methods.
* Source/NSTabView.m: added event code. you can now select tabs.
Not perfect yet, but it works (i.e. click around the text.)
* Source/NSTabViewItem.m: cache tabrect for quick retrieval.
* Source/NSMenuView.m: removed an extra call to flushwindow.
Fri Jul 9 9:33:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Headers/AppKit/NSApplication.h: Removed delegate methods from

View file

@ -44,6 +44,7 @@ typedef enum {
NSMutableArray *tab_items;
NSFont *tab_font;
NSTabViewType tab_type;
NSTabViewItem *tab_selected;
BOOL tab_draws_background;
BOOL tab_truncated_label;
id tab_delegate;

View file

@ -45,6 +45,7 @@ typedef enum {
NSColor *item_color;
NSTabState item_state;
NSTabView *item_tabview;
NSRect item_rect; // cached
}
- (id) initWithIdentifier:(id)identifier;
@ -70,6 +71,11 @@ typedef enum {
- (void)drawLabel:(BOOL)shouldTruncateLabel
inRect:(NSRect)tabRect;
// Non-spec
- (void)_setTabState:(NSTabState)tabState;
- (void)_setTabView:(NSTabView *)tabView;
- (NSRect) _tabRect;
- (void) encodeWithCoder: (NSCoder*)aCoder;
- (id) initWithCoder: (NSCoder*)aDecoder;
@end

View file

@ -152,9 +152,6 @@ static float GSMenuBarHeight = 25.0; // a guess.
if ([anItem hasSubmenu])
[[anItem target] display];
// set view needs to be redrawn
[window flushWindow];
// set ivar to new index
menuv_highlightedItemIndex = index;
} else {

View file

@ -16,6 +16,7 @@
tab_items = [NSMutableArray new];
tab_font = [NSFont systemFontOfSize:12];
tab_selected = nil;
return self;
}
@ -206,7 +207,7 @@
NSTabState itemState;
// hack to simulate a selected tab other than tab one.
if (i == 1) [anItem _setTabState:NSSelectedTab];
// if (i == 0) [anItem _setTabState:NSSelectedTab];
itemState = [anItem tabState];
@ -303,14 +304,37 @@
- (NSTabViewItem *)tabViewItemAtPoint:(NSPoint)point
{
int howMany = [tab_items count];
int i;
for (i=0;i<howMany;i++) {
NSTabViewItem *anItem = [tab_items objectAtIndex:i];
if(NSPointInRect(point,[anItem _tabRect]))
return anItem;
}
return nil;
}
/*
- (NSView*) hitTest: (NSPoint)aPoint
{
NSTabViewItem *anItem = [self tabViewItemAtPoint:aPoint];
if (anItem) {
if (tab_selected)
[tab_selected _setTabState:NSBackgroundTab];
tab_selected = anItem;
[anItem _setTabState:NSSelectedTab];
}
[self setNeedsDisplay:YES];
return [super hitTest:aPoint];
}
/*
- (BOOL) mouse: (NSPoint)aPoint inRect: (NSRect)aRect
{
}

View file

@ -123,7 +123,9 @@
NSGraphicsContext *ctxt = GSCurrentContext();
NSRect lRect;
NSRect fRect;
item_rect = tabRect;
DPSgsave(ctxt);
fRect = tabRect;
@ -152,6 +154,13 @@
DPSgrestore(ctxt);
}
// Non spec
- (NSRect) _tabRect
{
return item_rect;
}
// NSCoding protocol.
- (void) encodeWithCoder: (NSCoder*)aCoder