mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 14:20:54 +00:00
Add missing isFlipped methods to controls.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25473 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a46f252beb
commit
74b20f9065
6 changed files with 956 additions and 908 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2007-09-10 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Source/NSTableHeaderView.m,
|
||||||
|
* Source/NSSlider.m,
|
||||||
|
* Source/NSProgressIndicator.m,
|
||||||
|
* Source/NSButton.m (-isFlipped): Add fliiping.
|
||||||
|
* Source/NSTableHeaderView.m (-drawRect:): Adjust for flipping.
|
||||||
|
* Source/NSTabView.m: Mark as needing an isFlipped method.
|
||||||
|
|
||||||
2007-09-09 Fred Kiefer <FredKiefer@gmx.de>
|
2007-09-09 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSWindow.m (-makeKeyAndOrderFront:): Use
|
* Source/NSWindow.m (-makeKeyAndOrderFront:): Use
|
||||||
|
|
|
@ -81,6 +81,11 @@ static id buttonCellClass = nil;
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL) isFlipped
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
/** <p>Sets the NSButtonCell's type to <var>aType</var> and marks self for
|
/** <p>Sets the NSButtonCell's type to <var>aType</var> and marks self for
|
||||||
display.See <ref type="type" id="NSButtonType">NSButtonType</ref> for more
|
display.See <ref type="type" id="NSButtonType">NSButtonType</ref> for more
|
||||||
information.</p><p>See Also: [NSButtonCell-setButtonType:]</p>
|
information.</p><p>See Also: [NSButtonCell-setButtonType:]</p>
|
||||||
|
|
|
@ -68,6 +68,11 @@ static NSColor *fillColour = nil;
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL) isFlipped
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)animate:(id)sender
|
- (void)animate:(id)sender
|
||||||
{
|
{
|
||||||
if (!_isIndeterminate)
|
if (!_isIndeterminate)
|
||||||
|
|
|
@ -97,6 +97,11 @@ static Class cellClass;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL) isFlipped
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
/**<p>Returns the value by which the slider will be incremented if the
|
/**<p>Returns the value by which the slider will be incremented if the
|
||||||
user holds down the ALT key.</p><p>See Also: -setAltIncrementValue:</p> */
|
user holds down the ALT key.</p><p>See Also: -setAltIncrementValue:</p> */
|
||||||
- (double) altIncrementValue
|
- (double) altIncrementValue
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
|
@ -75,6 +75,14 @@
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// FIXME: This should be defined
|
||||||
|
- (BOOL) isFlipped
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// tab management.
|
// tab management.
|
||||||
|
|
||||||
- (void) addTabViewItem: (NSTabViewItem*)tabViewItem
|
- (void) addTabViewItem: (NSTabViewItem*)tabViewItem
|
||||||
|
@ -83,7 +91,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) insertTabViewItem: (NSTabViewItem*)tabViewItem
|
- (void) insertTabViewItem: (NSTabViewItem*)tabViewItem
|
||||||
atIndex: (int)index
|
atIndex: (int)index
|
||||||
{
|
{
|
||||||
[tabViewItem _setTabView: self];
|
[tabViewItem _setTabView: self];
|
||||||
[_items insertObject: tabViewItem atIndex: index];
|
[_items insertObject: tabViewItem atIndex: index];
|
||||||
|
@ -143,8 +151,8 @@
|
||||||
|
|
||||||
- (int) indexOfTabViewItemWithIdentifier: (id)identifier
|
- (int) indexOfTabViewItemWithIdentifier: (id)identifier
|
||||||
{
|
{
|
||||||
unsigned howMany = [_items count];
|
unsigned howMany = [_items count];
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
for (i = 0; i < howMany; i++)
|
for (i = 0; i < howMany; i++)
|
||||||
{
|
{
|
||||||
|
@ -214,7 +222,7 @@
|
||||||
@selector(tabView: shouldSelectTabViewItem:)])
|
@selector(tabView: shouldSelectTabViewItem:)])
|
||||||
{
|
{
|
||||||
canSelect = [_delegate tabView: self
|
canSelect = [_delegate tabView: self
|
||||||
shouldSelectTabViewItem: tabViewItem];
|
shouldSelectTabViewItem: tabViewItem];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canSelect)
|
if (canSelect)
|
||||||
|
@ -225,16 +233,16 @@
|
||||||
{
|
{
|
||||||
[_selected _setTabState: NSBackgroundTab];
|
[_selected _setTabState: NSBackgroundTab];
|
||||||
|
|
||||||
/* NB: If [_selected view] is nil this does nothing, which
|
/* NB: If [_selected view] is nil this does nothing, which
|
||||||
is fine. */
|
is fine. */
|
||||||
[[_selected view] removeFromSuperview];
|
[[_selected view] removeFromSuperview];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([_delegate respondsToSelector:
|
if ([_delegate respondsToSelector:
|
||||||
@selector(tabView: willSelectTabViewItem:)])
|
@selector(tabView: willSelectTabViewItem:)])
|
||||||
{
|
{
|
||||||
[_delegate tabView: self willSelectTabViewItem: tabViewItem];
|
[_delegate tabView: self willSelectTabViewItem: tabViewItem];
|
||||||
}
|
}
|
||||||
|
|
||||||
_selected = tabViewItem;
|
_selected = tabViewItem;
|
||||||
_selected_item = [_items indexOfObject: _selected];
|
_selected_item = [_items indexOfObject: _selected];
|
||||||
|
@ -243,20 +251,20 @@
|
||||||
selectedView = [_selected view];
|
selectedView = [_selected view];
|
||||||
|
|
||||||
if (selectedView != nil)
|
if (selectedView != nil)
|
||||||
{
|
{
|
||||||
[self addSubview: selectedView];
|
[self addSubview: selectedView];
|
||||||
[selectedView setFrame: [self contentRect]];
|
[selectedView setFrame: [self contentRect]];
|
||||||
[_window makeFirstResponder: [_selected initialFirstResponder]];
|
[_window makeFirstResponder: [_selected initialFirstResponder]];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Will need to redraw tabs and content area. */
|
/* Will need to redraw tabs and content area. */
|
||||||
[self setNeedsDisplay: YES];
|
[self setNeedsDisplay: YES];
|
||||||
|
|
||||||
if ([_delegate respondsToSelector:
|
if ([_delegate respondsToSelector:
|
||||||
@selector(tabView: didSelectTabViewItem:)])
|
@selector(tabView: didSelectTabViewItem:)])
|
||||||
{
|
{
|
||||||
[_delegate tabView: self didSelectTabViewItem: _selected];
|
[_delegate tabView: self didSelectTabViewItem: _selected];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +285,7 @@
|
||||||
|
|
||||||
- (void) takeSelectedTabViewItemFromSender: (id)sender
|
- (void) takeSelectedTabViewItemFromSender: (id)sender
|
||||||
{
|
{
|
||||||
int index = -1;
|
int index = -1;
|
||||||
|
|
||||||
if ([sender respondsToSelector: @selector(indexOfSelectedItem)] == YES)
|
if ([sender respondsToSelector: @selector(indexOfSelectedItem)] == YES)
|
||||||
{
|
{
|
||||||
|
@ -285,14 +293,14 @@
|
||||||
}
|
}
|
||||||
else if ([sender isKindOfClass: [NSMatrix class]] == YES)
|
else if ([sender isKindOfClass: [NSMatrix class]] == YES)
|
||||||
{
|
{
|
||||||
int cols = [sender numberOfColumns];
|
int cols = [sender numberOfColumns];
|
||||||
int row = [sender selectedRow];
|
int row = [sender selectedRow];
|
||||||
int col = [sender selectedColumn];
|
int col = [sender selectedColumn];
|
||||||
|
|
||||||
if (row >= 0 && col >= 0)
|
if (row >= 0 && col >= 0)
|
||||||
{
|
{
|
||||||
index = row * cols + col;
|
index = row * cols + col;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[self selectTabViewItemAtIndex: index];
|
[self selectTabViewItemAtIndex: index];
|
||||||
}
|
}
|
||||||
|
@ -355,20 +363,20 @@
|
||||||
switch (_type)
|
switch (_type)
|
||||||
{
|
{
|
||||||
case NSTopTabsBezelBorder:
|
case NSTopTabsBezelBorder:
|
||||||
return NSMakeSize(2, 19.5);
|
return NSMakeSize(2, 19.5);
|
||||||
case NSNoTabsBezelBorder:
|
case NSNoTabsBezelBorder:
|
||||||
return NSMakeSize(2, 3);
|
return NSMakeSize(2, 3);
|
||||||
case NSNoTabsLineBorder:
|
case NSNoTabsLineBorder:
|
||||||
return NSMakeSize(2, 3);
|
return NSMakeSize(2, 3);
|
||||||
case NSBottomTabsBezelBorder:
|
case NSBottomTabsBezelBorder:
|
||||||
return NSMakeSize(2, 16);
|
return NSMakeSize(2, 16);
|
||||||
case NSLeftTabsBezelBorder:
|
case NSLeftTabsBezelBorder:
|
||||||
return NSMakeSize(16, 3);
|
return NSMakeSize(16, 3);
|
||||||
case NSRightTabsBezelBorder:
|
case NSRightTabsBezelBorder:
|
||||||
return NSMakeSize(16, 3);
|
return NSMakeSize(16, 3);
|
||||||
case NSNoTabsNoBorder:
|
case NSNoTabsNoBorder:
|
||||||
default:
|
default:
|
||||||
return NSZeroSize;
|
return NSZeroSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,37 +393,37 @@
|
||||||
switch (_type)
|
switch (_type)
|
||||||
{
|
{
|
||||||
case NSTopTabsBezelBorder:
|
case NSTopTabsBezelBorder:
|
||||||
cRect.origin.y += 1;
|
cRect.origin.y += 1;
|
||||||
cRect.origin.x += 0.5;
|
cRect.origin.x += 0.5;
|
||||||
cRect.size.width -= 2;
|
cRect.size.width -= 2;
|
||||||
cRect.size.height -= 18.5;
|
cRect.size.height -= 18.5;
|
||||||
break;
|
break;
|
||||||
case NSNoTabsBezelBorder:
|
case NSNoTabsBezelBorder:
|
||||||
cRect.origin.y += 1;
|
cRect.origin.y += 1;
|
||||||
cRect.origin.x += 0.5;
|
cRect.origin.x += 0.5;
|
||||||
cRect.size.width -= 2;
|
cRect.size.width -= 2;
|
||||||
cRect.size.height -= 2;
|
cRect.size.height -= 2;
|
||||||
break;
|
break;
|
||||||
case NSNoTabsLineBorder:
|
case NSNoTabsLineBorder:
|
||||||
cRect.origin.y += 1;
|
cRect.origin.y += 1;
|
||||||
cRect.origin.x += 0.5;
|
cRect.origin.x += 0.5;
|
||||||
cRect.size.width -= 2;
|
cRect.size.width -= 2;
|
||||||
cRect.size.height -= 2;
|
cRect.size.height -= 2;
|
||||||
break;
|
break;
|
||||||
case NSBottomTabsBezelBorder:
|
case NSBottomTabsBezelBorder:
|
||||||
cRect.size.height -= 8;
|
cRect.size.height -= 8;
|
||||||
cRect.origin.y = 8;
|
cRect.origin.y = 8;
|
||||||
break;
|
break;
|
||||||
case NSLeftTabsBezelBorder:
|
case NSLeftTabsBezelBorder:
|
||||||
cRect.size.width -= 16;
|
cRect.size.width -= 16;
|
||||||
cRect.origin.x += 16;
|
cRect.origin.x += 16;
|
||||||
break;
|
break;
|
||||||
case NSRightTabsBezelBorder:
|
case NSRightTabsBezelBorder:
|
||||||
cRect.size.width -= 16;
|
cRect.size.width -= 16;
|
||||||
break;
|
break;
|
||||||
case NSNoTabsNoBorder:
|
case NSNoTabsNoBorder:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cRect;
|
return cRect;
|
||||||
|
@ -425,12 +433,12 @@
|
||||||
|
|
||||||
- (void) drawRect: (NSRect)rect
|
- (void) drawRect: (NSRect)rect
|
||||||
{
|
{
|
||||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||||
GSTheme *theme = [GSTheme theme];
|
GSTheme *theme = [GSTheme theme];
|
||||||
int howMany = [_items count];
|
int howMany = [_items count];
|
||||||
int i;
|
int i;
|
||||||
int previousState = 0;
|
int previousState = 0;
|
||||||
NSRect aRect = _bounds;
|
NSRect aRect = _bounds;
|
||||||
NSColor *lineColour = [NSColor highlightColor];
|
NSColor *lineColour = [NSColor highlightColor];
|
||||||
NSColor *backgroundColour = [[self window] backgroundColor];
|
NSColor *backgroundColour = [[self window] backgroundColor];
|
||||||
BOOL truncate = [self allowsTruncatedLabels];
|
BOOL truncate = [self allowsTruncatedLabels];
|
||||||
|
@ -445,39 +453,39 @@
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case NSTopTabsBezelBorder:
|
case NSTopTabsBezelBorder:
|
||||||
aRect.size.height -= 16;
|
aRect.size.height -= 16;
|
||||||
[theme drawButton: aRect withClip: rect];
|
[theme drawButton: aRect withClip: rect];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSBottomTabsBezelBorder:
|
case NSBottomTabsBezelBorder:
|
||||||
aRect.size.height -= 16;
|
aRect.size.height -= 16;
|
||||||
aRect.origin.y += 16;
|
aRect.origin.y += 16;
|
||||||
[theme drawButton: aRect withClip: rect];
|
[theme drawButton: aRect withClip: rect];
|
||||||
aRect.origin.y -= 16;
|
aRect.origin.y -= 16;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSLeftTabsBezelBorder:
|
case NSLeftTabsBezelBorder:
|
||||||
aRect.size.width -= 18;
|
aRect.size.width -= 18;
|
||||||
aRect.origin.x += 18;
|
aRect.origin.x += 18;
|
||||||
[theme drawButton: aRect withClip: rect];
|
[theme drawButton: aRect withClip: rect];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSRightTabsBezelBorder:
|
case NSRightTabsBezelBorder:
|
||||||
aRect.size.width -= 18;
|
aRect.size.width -= 18;
|
||||||
[theme drawButton: aRect withClip: rect];
|
[theme drawButton: aRect withClip: rect];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSNoTabsBezelBorder:
|
case NSNoTabsBezelBorder:
|
||||||
[theme drawButton: aRect withClip: rect];
|
[theme drawButton: aRect withClip: rect];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSNoTabsLineBorder:
|
case NSNoTabsLineBorder:
|
||||||
[[NSColor controlDarkShadowColor] set];
|
[[NSColor controlDarkShadowColor] set];
|
||||||
NSFrameRect(aRect);
|
NSFrameRect(aRect);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSNoTabsNoBorder:
|
case NSNoTabsNoBorder:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_type == NSBottomTabsBezelBorder)
|
if (_type == NSBottomTabsBezelBorder)
|
||||||
|
@ -486,119 +494,119 @@
|
||||||
|
|
||||||
iP.x = _bounds.origin.x;
|
iP.x = _bounds.origin.x;
|
||||||
iP.y = _bounds.origin.y;
|
iP.y = _bounds.origin.y;
|
||||||
|
|
||||||
for (i = 0; i < howMany; i++)
|
for (i = 0; i < howMany; i++)
|
||||||
{
|
{
|
||||||
NSRect r;
|
NSRect r;
|
||||||
NSRect fRect;
|
NSRect fRect;
|
||||||
NSTabViewItem *anItem = [_items objectAtIndex: i];
|
NSTabViewItem *anItem = [_items objectAtIndex: i];
|
||||||
NSTabState itemState = [anItem tabState];
|
NSTabState itemState = [anItem tabState];
|
||||||
NSSize s = [anItem sizeOfLabel: truncate];
|
NSSize s = [anItem sizeOfLabel: truncate];
|
||||||
|
|
||||||
[backgroundColour set];
|
[backgroundColour set];
|
||||||
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
if (itemState == NSSelectedTab)
|
if (itemState == NSSelectedTab)
|
||||||
{
|
{
|
||||||
iP.y += 1;
|
iP.y += 1;
|
||||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||||
[[NSImage imageNamed: @"common_TabDownSelectedLeft"]
|
[[NSImage imageNamed: @"common_TabDownSelectedLeft"]
|
||||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||||
iP.y -= 1;
|
iP.y -= 1;
|
||||||
}
|
}
|
||||||
else if (itemState == NSBackgroundTab)
|
else if (itemState == NSBackgroundTab)
|
||||||
{
|
{
|
||||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||||
[[NSImage imageNamed: @"common_TabDownUnSelectedLeft"]
|
[[NSImage imageNamed: @"common_TabDownUnSelectedLeft"]
|
||||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
NSLog(@"Not finished yet. Luff ya.\n");
|
NSLog(@"Not finished yet. Luff ya.\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (itemState == NSSelectedTab)
|
if (itemState == NSSelectedTab)
|
||||||
{
|
{
|
||||||
iP.y += 1;
|
iP.y += 1;
|
||||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||||
[[NSImage imageNamed:
|
[[NSImage imageNamed:
|
||||||
@"common_TabDownUnSelectedToSelectedJunction"]
|
@"common_TabDownUnSelectedToSelectedJunction"]
|
||||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||||
iP.y -= 1;
|
iP.y -= 1;
|
||||||
}
|
}
|
||||||
else if (itemState == NSBackgroundTab)
|
else if (itemState == NSBackgroundTab)
|
||||||
{
|
{
|
||||||
if (previousState == NSSelectedTab)
|
if (previousState == NSSelectedTab)
|
||||||
{
|
{
|
||||||
iP.y += 1;
|
iP.y += 1;
|
||||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||||
[[NSImage imageNamed:
|
[[NSImage imageNamed:
|
||||||
@"common_TabDownSelectedToUnSelectedJunction"]
|
@"common_TabDownSelectedToUnSelectedJunction"]
|
||||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||||
iP.y -= 1;
|
iP.y -= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||||
[[NSImage imageNamed:
|
[[NSImage imageNamed:
|
||||||
@"common_TabDownUnSelectedJunction"]
|
@"common_TabDownUnSelectedJunction"]
|
||||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
NSLog(@"Not finished yet. Luff ya.\n");
|
NSLog(@"Not finished yet. Luff ya.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
r.origin.x = iP.x + 13;
|
r.origin.x = iP.x + 13;
|
||||||
r.origin.y = iP.y + 2;
|
r.origin.y = iP.y + 2;
|
||||||
r.size.width = s.width;
|
r.size.width = s.width;
|
||||||
r.size.height = 15;
|
r.size.height = 15;
|
||||||
|
|
||||||
fRect = r;
|
fRect = r;
|
||||||
if (itemState == NSSelectedTab)
|
if (itemState == NSSelectedTab)
|
||||||
{
|
{
|
||||||
// Undraw the line that separates the tab from its view.
|
// Undraw the line that separates the tab from its view.
|
||||||
fRect.origin.y += 1;
|
fRect.origin.y += 1;
|
||||||
fRect.size.height += 1;
|
fRect.size.height += 1;
|
||||||
}
|
}
|
||||||
NSRectFill(fRect);
|
NSRectFill(fRect);
|
||||||
|
|
||||||
// Draw the line at the bottom of the item
|
// Draw the line at the bottom of the item
|
||||||
[lineColour set];
|
[lineColour set];
|
||||||
DPSsetlinewidth(ctxt, 1);
|
DPSsetlinewidth(ctxt, 1);
|
||||||
DPSmoveto(ctxt, r.origin.x, r.origin.y - 1);
|
DPSmoveto(ctxt, r.origin.x, r.origin.y - 1);
|
||||||
DPSrlineto(ctxt, r.size.width, 0);
|
DPSrlineto(ctxt, r.size.width, 0);
|
||||||
DPSstroke(ctxt);
|
DPSstroke(ctxt);
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
[anItem drawLabel: truncate inRect: r];
|
[anItem drawLabel: truncate inRect: r];
|
||||||
|
|
||||||
iP.x += s.width + 13;
|
iP.x += s.width + 13;
|
||||||
previousState = itemState;
|
previousState = itemState;
|
||||||
|
|
||||||
if (i == howMany - 1)
|
if (i == howMany - 1)
|
||||||
{
|
{
|
||||||
[backgroundColour set];
|
[backgroundColour set];
|
||||||
|
|
||||||
if ([anItem tabState] == NSSelectedTab)
|
if ([anItem tabState] == NSSelectedTab)
|
||||||
{
|
{
|
||||||
iP.y += 1;
|
iP.y += 1;
|
||||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||||
[[NSImage imageNamed: @"common_TabDownSelectedRight"]
|
[[NSImage imageNamed: @"common_TabDownSelectedRight"]
|
||||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||||
iP.y -= 1;
|
iP.y -= 1;
|
||||||
}
|
}
|
||||||
else if ([anItem tabState] == NSBackgroundTab)
|
else if ([anItem tabState] == NSBackgroundTab)
|
||||||
{
|
{
|
||||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||||
[[NSImage imageNamed: @"common_TabDownUnSelectedRight"]
|
[[NSImage imageNamed: @"common_TabDownUnSelectedRight"]
|
||||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
NSLog(@"Not finished yet. Luff ya.\n");
|
NSLog(@"Not finished yet. Luff ya.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (_type == NSTopTabsBezelBorder)
|
else if (_type == NSTopTabsBezelBorder)
|
||||||
{
|
{
|
||||||
|
@ -609,117 +617,117 @@
|
||||||
iP.y = _bounds.size.height - 16;
|
iP.y = _bounds.size.height - 16;
|
||||||
|
|
||||||
for (i = 0; i < howMany; i++)
|
for (i = 0; i < howMany; i++)
|
||||||
{
|
{
|
||||||
NSRect r;
|
NSRect r;
|
||||||
NSRect fRect;
|
NSRect fRect;
|
||||||
NSTabViewItem *anItem = [_items objectAtIndex: i];
|
NSTabViewItem *anItem = [_items objectAtIndex: i];
|
||||||
NSTabState itemState = [anItem tabState];
|
NSTabState itemState = [anItem tabState];
|
||||||
NSSize s = [anItem sizeOfLabel: truncate];
|
NSSize s = [anItem sizeOfLabel: truncate];
|
||||||
|
|
||||||
[backgroundColour set];
|
[backgroundColour set];
|
||||||
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
if (itemState == NSSelectedTab)
|
if (itemState == NSSelectedTab)
|
||||||
{
|
{
|
||||||
iP.y -= 1;
|
iP.y -= 1;
|
||||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||||
[[NSImage imageNamed: @"common_TabSelectedLeft"]
|
[[NSImage imageNamed: @"common_TabSelectedLeft"]
|
||||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||||
iP.y += 1;
|
iP.y += 1;
|
||||||
}
|
}
|
||||||
else if (itemState == NSBackgroundTab)
|
else if (itemState == NSBackgroundTab)
|
||||||
{
|
{
|
||||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||||
[[NSImage imageNamed: @"common_TabUnSelectedLeft"]
|
[[NSImage imageNamed: @"common_TabUnSelectedLeft"]
|
||||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
NSLog(@"Not finished yet. Luff ya.\n");
|
NSLog(@"Not finished yet. Luff ya.\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (itemState == NSSelectedTab)
|
if (itemState == NSSelectedTab)
|
||||||
{
|
{
|
||||||
iP.y -= 1;
|
iP.y -= 1;
|
||||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||||
[[NSImage imageNamed:
|
[[NSImage imageNamed:
|
||||||
@"common_TabUnSelectToSelectedJunction"]
|
@"common_TabUnSelectToSelectedJunction"]
|
||||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||||
iP.y += 1;
|
iP.y += 1;
|
||||||
}
|
}
|
||||||
else if (itemState == NSBackgroundTab)
|
else if (itemState == NSBackgroundTab)
|
||||||
{
|
{
|
||||||
if (previousState == NSSelectedTab)
|
if (previousState == NSSelectedTab)
|
||||||
{
|
{
|
||||||
iP.y -= 1;
|
iP.y -= 1;
|
||||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||||
[[NSImage imageNamed:
|
[[NSImage imageNamed:
|
||||||
@"common_TabSelectedToUnSelectedJunction"]
|
@"common_TabSelectedToUnSelectedJunction"]
|
||||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||||
iP.y += 1;
|
iP.y += 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||||
[[NSImage imageNamed:
|
[[NSImage imageNamed:
|
||||||
@"common_TabUnSelectedJunction"]
|
@"common_TabUnSelectedJunction"]
|
||||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
NSLog(@"Not finished yet. Luff ya.\n");
|
NSLog(@"Not finished yet. Luff ya.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
r.origin.x = iP.x + 13;
|
r.origin.x = iP.x + 13;
|
||||||
r.origin.y = iP.y;
|
r.origin.y = iP.y;
|
||||||
r.size.width = s.width;
|
r.size.width = s.width;
|
||||||
r.size.height = 15;
|
r.size.height = 15;
|
||||||
|
|
||||||
fRect = r;
|
fRect = r;
|
||||||
if (itemState == NSSelectedTab)
|
if (itemState == NSSelectedTab)
|
||||||
{
|
{
|
||||||
// Undraw the line that separates the tab from its view.
|
// Undraw the line that separates the tab from its view.
|
||||||
fRect.origin.y -= 1;
|
fRect.origin.y -= 1;
|
||||||
fRect.size.height += 1;
|
fRect.size.height += 1;
|
||||||
}
|
}
|
||||||
NSRectFill(fRect);
|
NSRectFill(fRect);
|
||||||
|
|
||||||
// Draw the line at the top of the item
|
// Draw the line at the top of the item
|
||||||
[lineColour set];
|
[lineColour set];
|
||||||
DPSsetlinewidth(ctxt, 1);
|
DPSsetlinewidth(ctxt, 1);
|
||||||
DPSmoveto(ctxt, r.origin.x, r.origin.y + 16);
|
DPSmoveto(ctxt, r.origin.x, r.origin.y + 16);
|
||||||
DPSrlineto(ctxt, r.size.width, 0);
|
DPSrlineto(ctxt, r.size.width, 0);
|
||||||
DPSstroke(ctxt);
|
DPSstroke(ctxt);
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
[anItem drawLabel: truncate inRect: r];
|
[anItem drawLabel: truncate inRect: r];
|
||||||
|
|
||||||
iP.x += s.width + 13;
|
iP.x += s.width + 13;
|
||||||
previousState = itemState;
|
previousState = itemState;
|
||||||
|
|
||||||
if (i == howMany - 1)
|
if (i == howMany - 1)
|
||||||
{
|
{
|
||||||
[backgroundColour set];
|
[backgroundColour set];
|
||||||
|
|
||||||
if ([anItem tabState] == NSSelectedTab)
|
if ([anItem tabState] == NSSelectedTab)
|
||||||
{
|
{
|
||||||
iP.y -= 1;
|
iP.y -= 1;
|
||||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||||
[[NSImage imageNamed: @"common_TabSelectedRight"]
|
[[NSImage imageNamed: @"common_TabSelectedRight"]
|
||||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||||
iP.y += 1;
|
iP.y += 1;
|
||||||
}
|
}
|
||||||
else if ([anItem tabState] == NSBackgroundTab)
|
else if ([anItem tabState] == NSBackgroundTab)
|
||||||
{
|
{
|
||||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||||
[[NSImage imageNamed: @"common_TabUnSelectedRight"]
|
[[NSImage imageNamed: @"common_TabUnSelectedRight"]
|
||||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
NSLog(@"Not finished yet. Luff ya.\n");
|
NSLog(@"Not finished yet. Luff ya.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// FIXME: Missing drawing code for other cases
|
// FIXME: Missing drawing code for other cases
|
||||||
|
|
||||||
|
@ -747,7 +755,7 @@
|
||||||
NSTabViewItem *anItem = [_items objectAtIndex: i];
|
NSTabViewItem *anItem = [_items objectAtIndex: i];
|
||||||
|
|
||||||
if (NSPointInRect(point, [anItem _tabRect]))
|
if (NSPointInRect(point, [anItem _tabRect]))
|
||||||
return anItem;
|
return anItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil;
|
return nil;
|
||||||
|
@ -756,7 +764,7 @@
|
||||||
- (void) mouseDown: (NSEvent *)theEvent
|
- (void) mouseDown: (NSEvent *)theEvent
|
||||||
{
|
{
|
||||||
NSPoint location = [self convertPoint: [theEvent locationInWindow]
|
NSPoint location = [self convertPoint: [theEvent locationInWindow]
|
||||||
fromView: nil];
|
fromView: nil];
|
||||||
NSTabViewItem *anItem = [self tabViewItemAtPoint: location];
|
NSTabViewItem *anItem = [self tabViewItemAtPoint: location];
|
||||||
|
|
||||||
if (anItem != nil && ![anItem isEqual: _selected])
|
if (anItem != nil && ![anItem isEqual: _selected])
|
||||||
|
@ -830,35 +838,35 @@
|
||||||
{
|
{
|
||||||
if ([aDecoder containsValueForKey: @"NSAllowTruncatedLabels"])
|
if ([aDecoder containsValueForKey: @"NSAllowTruncatedLabels"])
|
||||||
{
|
{
|
||||||
[self setAllowsTruncatedLabels: [aDecoder decodeBoolForKey:
|
[self setAllowsTruncatedLabels: [aDecoder decodeBoolForKey:
|
||||||
@"NSAllowTruncatedLabels"]];
|
@"NSAllowTruncatedLabels"]];
|
||||||
}
|
}
|
||||||
if ([aDecoder containsValueForKey: @"NSDrawsBackground"])
|
if ([aDecoder containsValueForKey: @"NSDrawsBackground"])
|
||||||
{
|
{
|
||||||
[self setDrawsBackground: [aDecoder decodeBoolForKey:
|
[self setDrawsBackground: [aDecoder decodeBoolForKey:
|
||||||
@"NSDrawsBackground"]];
|
@"NSDrawsBackground"]];
|
||||||
}
|
}
|
||||||
if ([aDecoder containsValueForKey: @"NSFont"])
|
if ([aDecoder containsValueForKey: @"NSFont"])
|
||||||
{
|
{
|
||||||
[self setFont: [aDecoder decodeObjectForKey: @"NSFont"]];
|
[self setFont: [aDecoder decodeObjectForKey: @"NSFont"]];
|
||||||
}
|
}
|
||||||
if ([aDecoder containsValueForKey: @"NSTabViewItems"])
|
if ([aDecoder containsValueForKey: @"NSTabViewItems"])
|
||||||
{
|
{
|
||||||
ASSIGN(_items, [aDecoder decodeObjectForKey: @"NSTabViewItems"]);
|
ASSIGN(_items, [aDecoder decodeObjectForKey: @"NSTabViewItems"]);
|
||||||
}
|
}
|
||||||
if ([aDecoder containsValueForKey: @"NSSelectedTabViewItem"])
|
if ([aDecoder containsValueForKey: @"NSSelectedTabViewItem"])
|
||||||
{
|
{
|
||||||
[self selectTabViewItem: [aDecoder decodeObjectForKey:
|
[self selectTabViewItem: [aDecoder decodeObjectForKey:
|
||||||
@"NSSelectedTabViewItem"]];
|
@"NSSelectedTabViewItem"]];
|
||||||
}
|
}
|
||||||
if ([aDecoder containsValueForKey: @"NSTvFlags"])
|
if ([aDecoder containsValueForKey: @"NSTvFlags"])
|
||||||
{
|
{
|
||||||
int vFlags = [aDecoder decodeIntForKey: @"NSTvFlags"];
|
int vFlags = [aDecoder decodeIntForKey: @"NSTvFlags"];
|
||||||
|
|
||||||
[self setControlTint: ((vFlags & 0x70000000) >> 28)];
|
[self setControlTint: ((vFlags & 0x70000000) >> 28)];
|
||||||
[self setControlSize: ((vFlags & 0x0c000000) >> 26)];
|
[self setControlSize: ((vFlags & 0x0c000000) >> 26)];
|
||||||
[self setTabViewType: (vFlags & 0x00000007)];
|
[self setTabViewType: (vFlags & 0x00000007)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -869,33 +877,33 @@
|
||||||
[aDecoder decodeValueOfObjCType: @encode(NSTabViewType) at: &_type];
|
[aDecoder decodeValueOfObjCType: @encode(NSTabViewType) at: &_type];
|
||||||
if (version < 2)
|
if (version < 2)
|
||||||
{
|
{
|
||||||
switch(_type)
|
switch(_type)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
_type = NSTopTabsBezelBorder;
|
_type = NSTopTabsBezelBorder;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
_type = NSLeftTabsBezelBorder;
|
_type = NSLeftTabsBezelBorder;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
_type = NSBottomTabsBezelBorder;
|
_type = NSBottomTabsBezelBorder;
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
_type = NSRightTabsBezelBorder;
|
_type = NSRightTabsBezelBorder;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
_type = NSNoTabsBezelBorder;
|
_type = NSNoTabsBezelBorder;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
_type = NSNoTabsLineBorder;
|
_type = NSNoTabsLineBorder;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
_type = NSNoTabsNoBorder;
|
_type = NSNoTabsNoBorder;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_draws_background];
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_draws_background];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_truncated_label];
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_truncated_label];
|
||||||
_delegate = [aDecoder decodeObject];
|
_delegate = [aDecoder decodeObject];
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue