mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:00:48 +00:00
Fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4554 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ad02b7b410
commit
0e02356ba4
6 changed files with 51 additions and 6 deletions
|
@ -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>
|
Fri Jul 9 9:33:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||||
|
|
||||||
* Headers/AppKit/NSApplication.h: Removed delegate methods from
|
* Headers/AppKit/NSApplication.h: Removed delegate methods from
|
||||||
|
|
|
@ -44,6 +44,7 @@ typedef enum {
|
||||||
NSMutableArray *tab_items;
|
NSMutableArray *tab_items;
|
||||||
NSFont *tab_font;
|
NSFont *tab_font;
|
||||||
NSTabViewType tab_type;
|
NSTabViewType tab_type;
|
||||||
|
NSTabViewItem *tab_selected;
|
||||||
BOOL tab_draws_background;
|
BOOL tab_draws_background;
|
||||||
BOOL tab_truncated_label;
|
BOOL tab_truncated_label;
|
||||||
id tab_delegate;
|
id tab_delegate;
|
||||||
|
|
|
@ -45,6 +45,7 @@ typedef enum {
|
||||||
NSColor *item_color;
|
NSColor *item_color;
|
||||||
NSTabState item_state;
|
NSTabState item_state;
|
||||||
NSTabView *item_tabview;
|
NSTabView *item_tabview;
|
||||||
|
NSRect item_rect; // cached
|
||||||
}
|
}
|
||||||
- (id) initWithIdentifier:(id)identifier;
|
- (id) initWithIdentifier:(id)identifier;
|
||||||
|
|
||||||
|
@ -70,6 +71,11 @@ typedef enum {
|
||||||
- (void)drawLabel:(BOOL)shouldTruncateLabel
|
- (void)drawLabel:(BOOL)shouldTruncateLabel
|
||||||
inRect:(NSRect)tabRect;
|
inRect:(NSRect)tabRect;
|
||||||
|
|
||||||
|
// Non-spec
|
||||||
|
- (void)_setTabState:(NSTabState)tabState;
|
||||||
|
- (void)_setTabView:(NSTabView *)tabView;
|
||||||
|
- (NSRect) _tabRect;
|
||||||
|
|
||||||
- (void) encodeWithCoder: (NSCoder*)aCoder;
|
- (void) encodeWithCoder: (NSCoder*)aCoder;
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder;
|
- (id) initWithCoder: (NSCoder*)aDecoder;
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -152,9 +152,6 @@ static float GSMenuBarHeight = 25.0; // a guess.
|
||||||
if ([anItem hasSubmenu])
|
if ([anItem hasSubmenu])
|
||||||
[[anItem target] display];
|
[[anItem target] display];
|
||||||
|
|
||||||
// set view needs to be redrawn
|
|
||||||
[window flushWindow];
|
|
||||||
|
|
||||||
// set ivar to new index
|
// set ivar to new index
|
||||||
menuv_highlightedItemIndex = index;
|
menuv_highlightedItemIndex = index;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
tab_items = [NSMutableArray new];
|
tab_items = [NSMutableArray new];
|
||||||
tab_font = [NSFont systemFontOfSize:12];
|
tab_font = [NSFont systemFontOfSize:12];
|
||||||
|
tab_selected = nil;
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -206,7 +207,7 @@
|
||||||
NSTabState itemState;
|
NSTabState itemState;
|
||||||
|
|
||||||
// hack to simulate a selected tab other than tab one.
|
// 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];
|
itemState = [anItem tabState];
|
||||||
|
|
||||||
|
@ -303,14 +304,37 @@
|
||||||
|
|
||||||
- (NSTabViewItem *)tabViewItemAtPoint:(NSPoint)point
|
- (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;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
- (NSView*) hitTest: (NSPoint)aPoint
|
- (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
|
- (BOOL) mouse: (NSPoint)aPoint inRect: (NSRect)aRect
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,9 @@
|
||||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||||
NSRect lRect;
|
NSRect lRect;
|
||||||
NSRect fRect;
|
NSRect fRect;
|
||||||
|
|
||||||
|
item_rect = tabRect;
|
||||||
|
|
||||||
DPSgsave(ctxt);
|
DPSgsave(ctxt);
|
||||||
|
|
||||||
fRect = tabRect;
|
fRect = tabRect;
|
||||||
|
@ -152,6 +154,13 @@
|
||||||
DPSgrestore(ctxt);
|
DPSgrestore(ctxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Non spec
|
||||||
|
|
||||||
|
- (NSRect) _tabRect
|
||||||
|
{
|
||||||
|
return item_rect;
|
||||||
|
}
|
||||||
|
|
||||||
// NSCoding protocol.
|
// NSCoding protocol.
|
||||||
|
|
||||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue