mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 07:50:53 +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>
|
||||
|
||||
* Source/NSWindow.m (-makeKeyAndOrderFront:): Use
|
||||
|
|
|
@ -81,6 +81,11 @@ static id buttonCellClass = nil;
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL) isFlipped
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
/** <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
|
||||
information.</p><p>See Also: [NSButtonCell-setButtonType:]</p>
|
||||
|
|
|
@ -68,6 +68,11 @@ static NSColor *fillColour = nil;
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (BOOL) isFlipped
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)animate:(id)sender
|
||||
{
|
||||
if (!_isIndeterminate)
|
||||
|
|
|
@ -97,6 +97,11 @@ static Class cellClass;
|
|||
return self;
|
||||
}
|
||||
|
||||
- (BOOL) isFlipped
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
/**<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> */
|
||||
- (double) altIncrementValue
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
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.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
|
@ -75,6 +75,14 @@
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
/*
|
||||
// FIXME: This should be defined
|
||||
- (BOOL) isFlipped
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
*/
|
||||
|
||||
// tab management.
|
||||
|
||||
- (void) addTabViewItem: (NSTabViewItem*)tabViewItem
|
||||
|
@ -83,7 +91,7 @@
|
|||
}
|
||||
|
||||
- (void) insertTabViewItem: (NSTabViewItem*)tabViewItem
|
||||
atIndex: (int)index
|
||||
atIndex: (int)index
|
||||
{
|
||||
[tabViewItem _setTabView: self];
|
||||
[_items insertObject: tabViewItem atIndex: index];
|
||||
|
@ -143,8 +151,8 @@
|
|||
|
||||
- (int) indexOfTabViewItemWithIdentifier: (id)identifier
|
||||
{
|
||||
unsigned howMany = [_items count];
|
||||
unsigned i;
|
||||
unsigned howMany = [_items count];
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < howMany; i++)
|
||||
{
|
||||
|
@ -214,7 +222,7 @@
|
|||
@selector(tabView: shouldSelectTabViewItem:)])
|
||||
{
|
||||
canSelect = [_delegate tabView: self
|
||||
shouldSelectTabViewItem: tabViewItem];
|
||||
shouldSelectTabViewItem: tabViewItem];
|
||||
}
|
||||
|
||||
if (canSelect)
|
||||
|
@ -225,16 +233,16 @@
|
|||
{
|
||||
[_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. */
|
||||
[[_selected view] removeFromSuperview];
|
||||
}
|
||||
[[_selected view] removeFromSuperview];
|
||||
}
|
||||
|
||||
if ([_delegate respondsToSelector:
|
||||
@selector(tabView: willSelectTabViewItem:)])
|
||||
{
|
||||
[_delegate tabView: self willSelectTabViewItem: tabViewItem];
|
||||
}
|
||||
@selector(tabView: willSelectTabViewItem:)])
|
||||
{
|
||||
[_delegate tabView: self willSelectTabViewItem: tabViewItem];
|
||||
}
|
||||
|
||||
_selected = tabViewItem;
|
||||
_selected_item = [_items indexOfObject: _selected];
|
||||
|
@ -243,20 +251,20 @@
|
|||
selectedView = [_selected view];
|
||||
|
||||
if (selectedView != nil)
|
||||
{
|
||||
[self addSubview: selectedView];
|
||||
[selectedView setFrame: [self contentRect]];
|
||||
[_window makeFirstResponder: [_selected initialFirstResponder]];
|
||||
}
|
||||
{
|
||||
[self addSubview: selectedView];
|
||||
[selectedView setFrame: [self contentRect]];
|
||||
[_window makeFirstResponder: [_selected initialFirstResponder]];
|
||||
}
|
||||
|
||||
/* Will need to redraw tabs and content area. */
|
||||
[self setNeedsDisplay: YES];
|
||||
|
||||
if ([_delegate respondsToSelector:
|
||||
@selector(tabView: didSelectTabViewItem:)])
|
||||
{
|
||||
[_delegate tabView: self didSelectTabViewItem: _selected];
|
||||
}
|
||||
@selector(tabView: didSelectTabViewItem:)])
|
||||
{
|
||||
[_delegate tabView: self didSelectTabViewItem: _selected];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -277,7 +285,7 @@
|
|||
|
||||
- (void) takeSelectedTabViewItemFromSender: (id)sender
|
||||
{
|
||||
int index = -1;
|
||||
int index = -1;
|
||||
|
||||
if ([sender respondsToSelector: @selector(indexOfSelectedItem)] == YES)
|
||||
{
|
||||
|
@ -285,14 +293,14 @@
|
|||
}
|
||||
else if ([sender isKindOfClass: [NSMatrix class]] == YES)
|
||||
{
|
||||
int cols = [sender numberOfColumns];
|
||||
int row = [sender selectedRow];
|
||||
int col = [sender selectedColumn];
|
||||
int cols = [sender numberOfColumns];
|
||||
int row = [sender selectedRow];
|
||||
int col = [sender selectedColumn];
|
||||
|
||||
if (row >= 0 && col >= 0)
|
||||
{
|
||||
index = row * cols + col;
|
||||
}
|
||||
{
|
||||
index = row * cols + col;
|
||||
}
|
||||
}
|
||||
[self selectTabViewItemAtIndex: index];
|
||||
}
|
||||
|
@ -355,20 +363,20 @@
|
|||
switch (_type)
|
||||
{
|
||||
case NSTopTabsBezelBorder:
|
||||
return NSMakeSize(2, 19.5);
|
||||
return NSMakeSize(2, 19.5);
|
||||
case NSNoTabsBezelBorder:
|
||||
return NSMakeSize(2, 3);
|
||||
return NSMakeSize(2, 3);
|
||||
case NSNoTabsLineBorder:
|
||||
return NSMakeSize(2, 3);
|
||||
return NSMakeSize(2, 3);
|
||||
case NSBottomTabsBezelBorder:
|
||||
return NSMakeSize(2, 16);
|
||||
return NSMakeSize(2, 16);
|
||||
case NSLeftTabsBezelBorder:
|
||||
return NSMakeSize(16, 3);
|
||||
return NSMakeSize(16, 3);
|
||||
case NSRightTabsBezelBorder:
|
||||
return NSMakeSize(16, 3);
|
||||
return NSMakeSize(16, 3);
|
||||
case NSNoTabsNoBorder:
|
||||
default:
|
||||
return NSZeroSize;
|
||||
return NSZeroSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -385,37 +393,37 @@
|
|||
switch (_type)
|
||||
{
|
||||
case NSTopTabsBezelBorder:
|
||||
cRect.origin.y += 1;
|
||||
cRect.origin.x += 0.5;
|
||||
cRect.size.width -= 2;
|
||||
cRect.size.height -= 18.5;
|
||||
break;
|
||||
cRect.origin.y += 1;
|
||||
cRect.origin.x += 0.5;
|
||||
cRect.size.width -= 2;
|
||||
cRect.size.height -= 18.5;
|
||||
break;
|
||||
case NSNoTabsBezelBorder:
|
||||
cRect.origin.y += 1;
|
||||
cRect.origin.x += 0.5;
|
||||
cRect.size.width -= 2;
|
||||
cRect.size.height -= 2;
|
||||
break;
|
||||
cRect.origin.y += 1;
|
||||
cRect.origin.x += 0.5;
|
||||
cRect.size.width -= 2;
|
||||
cRect.size.height -= 2;
|
||||
break;
|
||||
case NSNoTabsLineBorder:
|
||||
cRect.origin.y += 1;
|
||||
cRect.origin.x += 0.5;
|
||||
cRect.size.width -= 2;
|
||||
cRect.size.height -= 2;
|
||||
break;
|
||||
case NSBottomTabsBezelBorder:
|
||||
cRect.size.height -= 8;
|
||||
cRect.origin.y = 8;
|
||||
break;
|
||||
cRect.origin.y += 1;
|
||||
cRect.origin.x += 0.5;
|
||||
cRect.size.width -= 2;
|
||||
cRect.size.height -= 2;
|
||||
break;
|
||||
case NSBottomTabsBezelBorder:
|
||||
cRect.size.height -= 8;
|
||||
cRect.origin.y = 8;
|
||||
break;
|
||||
case NSLeftTabsBezelBorder:
|
||||
cRect.size.width -= 16;
|
||||
cRect.origin.x += 16;
|
||||
break;
|
||||
cRect.size.width -= 16;
|
||||
cRect.origin.x += 16;
|
||||
break;
|
||||
case NSRightTabsBezelBorder:
|
||||
cRect.size.width -= 16;
|
||||
break;
|
||||
cRect.size.width -= 16;
|
||||
break;
|
||||
case NSNoTabsNoBorder:
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
return cRect;
|
||||
|
@ -425,12 +433,12 @@
|
|||
|
||||
- (void) drawRect: (NSRect)rect
|
||||
{
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
GSTheme *theme = [GSTheme theme];
|
||||
int howMany = [_items count];
|
||||
int i;
|
||||
int previousState = 0;
|
||||
NSRect aRect = _bounds;
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
GSTheme *theme = [GSTheme theme];
|
||||
int howMany = [_items count];
|
||||
int i;
|
||||
int previousState = 0;
|
||||
NSRect aRect = _bounds;
|
||||
NSColor *lineColour = [NSColor highlightColor];
|
||||
NSColor *backgroundColour = [[self window] backgroundColor];
|
||||
BOOL truncate = [self allowsTruncatedLabels];
|
||||
|
@ -445,39 +453,39 @@
|
|||
{
|
||||
default:
|
||||
case NSTopTabsBezelBorder:
|
||||
aRect.size.height -= 16;
|
||||
[theme drawButton: aRect withClip: rect];
|
||||
break;
|
||||
aRect.size.height -= 16;
|
||||
[theme drawButton: aRect withClip: rect];
|
||||
break;
|
||||
|
||||
case NSBottomTabsBezelBorder:
|
||||
aRect.size.height -= 16;
|
||||
aRect.origin.y += 16;
|
||||
[theme drawButton: aRect withClip: rect];
|
||||
aRect.origin.y -= 16;
|
||||
break;
|
||||
aRect.size.height -= 16;
|
||||
aRect.origin.y += 16;
|
||||
[theme drawButton: aRect withClip: rect];
|
||||
aRect.origin.y -= 16;
|
||||
break;
|
||||
|
||||
case NSLeftTabsBezelBorder:
|
||||
aRect.size.width -= 18;
|
||||
aRect.origin.x += 18;
|
||||
[theme drawButton: aRect withClip: rect];
|
||||
break;
|
||||
aRect.size.width -= 18;
|
||||
aRect.origin.x += 18;
|
||||
[theme drawButton: aRect withClip: rect];
|
||||
break;
|
||||
|
||||
case NSRightTabsBezelBorder:
|
||||
aRect.size.width -= 18;
|
||||
[theme drawButton: aRect withClip: rect];
|
||||
break;
|
||||
aRect.size.width -= 18;
|
||||
[theme drawButton: aRect withClip: rect];
|
||||
break;
|
||||
|
||||
case NSNoTabsBezelBorder:
|
||||
[theme drawButton: aRect withClip: rect];
|
||||
break;
|
||||
[theme drawButton: aRect withClip: rect];
|
||||
break;
|
||||
|
||||
case NSNoTabsLineBorder:
|
||||
[[NSColor controlDarkShadowColor] set];
|
||||
NSFrameRect(aRect);
|
||||
break;
|
||||
[[NSColor controlDarkShadowColor] set];
|
||||
NSFrameRect(aRect);
|
||||
break;
|
||||
|
||||
case NSNoTabsNoBorder:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
if (_type == NSBottomTabsBezelBorder)
|
||||
|
@ -486,119 +494,119 @@
|
|||
|
||||
iP.x = _bounds.origin.x;
|
||||
iP.y = _bounds.origin.y;
|
||||
|
||||
|
||||
for (i = 0; i < howMany; i++)
|
||||
{
|
||||
NSRect r;
|
||||
NSRect fRect;
|
||||
NSTabViewItem *anItem = [_items objectAtIndex: i];
|
||||
NSTabState itemState = [anItem tabState];
|
||||
NSSize s = [anItem sizeOfLabel: truncate];
|
||||
|
||||
[backgroundColour set];
|
||||
{
|
||||
NSRect r;
|
||||
NSRect fRect;
|
||||
NSTabViewItem *anItem = [_items objectAtIndex: i];
|
||||
NSTabState itemState = [anItem tabState];
|
||||
NSSize s = [anItem sizeOfLabel: truncate];
|
||||
|
||||
[backgroundColour set];
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
if (itemState == NSSelectedTab)
|
||||
{
|
||||
iP.y += 1;
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed: @"common_TabDownSelectedLeft"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
iP.y -= 1;
|
||||
}
|
||||
else if (itemState == NSBackgroundTab)
|
||||
{
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed: @"common_TabDownUnSelectedLeft"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
}
|
||||
else
|
||||
NSLog(@"Not finished yet. Luff ya.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (itemState == NSSelectedTab)
|
||||
{
|
||||
iP.y += 1;
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed:
|
||||
@"common_TabDownUnSelectedToSelectedJunction"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
iP.y -= 1;
|
||||
}
|
||||
else if (itemState == NSBackgroundTab)
|
||||
{
|
||||
if (previousState == NSSelectedTab)
|
||||
{
|
||||
iP.y += 1;
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed:
|
||||
@"common_TabDownSelectedToUnSelectedJunction"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
iP.y -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed:
|
||||
@"common_TabDownUnSelectedJunction"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
}
|
||||
}
|
||||
else
|
||||
NSLog(@"Not finished yet. Luff ya.\n");
|
||||
}
|
||||
if (i == 0)
|
||||
{
|
||||
if (itemState == NSSelectedTab)
|
||||
{
|
||||
iP.y += 1;
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed: @"common_TabDownSelectedLeft"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
iP.y -= 1;
|
||||
}
|
||||
else if (itemState == NSBackgroundTab)
|
||||
{
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed: @"common_TabDownUnSelectedLeft"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
}
|
||||
else
|
||||
NSLog(@"Not finished yet. Luff ya.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (itemState == NSSelectedTab)
|
||||
{
|
||||
iP.y += 1;
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed:
|
||||
@"common_TabDownUnSelectedToSelectedJunction"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
iP.y -= 1;
|
||||
}
|
||||
else if (itemState == NSBackgroundTab)
|
||||
{
|
||||
if (previousState == NSSelectedTab)
|
||||
{
|
||||
iP.y += 1;
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed:
|
||||
@"common_TabDownSelectedToUnSelectedJunction"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
iP.y -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed:
|
||||
@"common_TabDownUnSelectedJunction"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
}
|
||||
}
|
||||
else
|
||||
NSLog(@"Not finished yet. Luff ya.\n");
|
||||
}
|
||||
|
||||
r.origin.x = iP.x + 13;
|
||||
r.origin.y = iP.y + 2;
|
||||
r.size.width = s.width;
|
||||
r.size.height = 15;
|
||||
r.origin.x = iP.x + 13;
|
||||
r.origin.y = iP.y + 2;
|
||||
r.size.width = s.width;
|
||||
r.size.height = 15;
|
||||
|
||||
fRect = r;
|
||||
if (itemState == NSSelectedTab)
|
||||
{
|
||||
// Undraw the line that separates the tab from its view.
|
||||
fRect.origin.y += 1;
|
||||
fRect.size.height += 1;
|
||||
}
|
||||
NSRectFill(fRect);
|
||||
fRect = r;
|
||||
if (itemState == NSSelectedTab)
|
||||
{
|
||||
// Undraw the line that separates the tab from its view.
|
||||
fRect.origin.y += 1;
|
||||
fRect.size.height += 1;
|
||||
}
|
||||
NSRectFill(fRect);
|
||||
|
||||
// Draw the line at the bottom of the item
|
||||
[lineColour set];
|
||||
DPSsetlinewidth(ctxt, 1);
|
||||
DPSmoveto(ctxt, r.origin.x, r.origin.y - 1);
|
||||
DPSrlineto(ctxt, r.size.width, 0);
|
||||
DPSstroke(ctxt);
|
||||
|
||||
// Label
|
||||
[anItem drawLabel: truncate inRect: r];
|
||||
|
||||
iP.x += s.width + 13;
|
||||
previousState = itemState;
|
||||
// Draw the line at the bottom of the item
|
||||
[lineColour set];
|
||||
DPSsetlinewidth(ctxt, 1);
|
||||
DPSmoveto(ctxt, r.origin.x, r.origin.y - 1);
|
||||
DPSrlineto(ctxt, r.size.width, 0);
|
||||
DPSstroke(ctxt);
|
||||
|
||||
// Label
|
||||
[anItem drawLabel: truncate inRect: r];
|
||||
|
||||
iP.x += s.width + 13;
|
||||
previousState = itemState;
|
||||
|
||||
if (i == howMany - 1)
|
||||
{
|
||||
[backgroundColour set];
|
||||
if (i == howMany - 1)
|
||||
{
|
||||
[backgroundColour set];
|
||||
|
||||
if ([anItem tabState] == NSSelectedTab)
|
||||
{
|
||||
iP.y += 1;
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed: @"common_TabDownSelectedRight"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
iP.y -= 1;
|
||||
}
|
||||
else if ([anItem tabState] == NSBackgroundTab)
|
||||
{
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed: @"common_TabDownUnSelectedRight"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
}
|
||||
else
|
||||
NSLog(@"Not finished yet. Luff ya.\n");
|
||||
}
|
||||
}
|
||||
if ([anItem tabState] == NSSelectedTab)
|
||||
{
|
||||
iP.y += 1;
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed: @"common_TabDownSelectedRight"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
iP.y -= 1;
|
||||
}
|
||||
else if ([anItem tabState] == NSBackgroundTab)
|
||||
{
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed: @"common_TabDownUnSelectedRight"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
}
|
||||
else
|
||||
NSLog(@"Not finished yet. Luff ya.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_type == NSTopTabsBezelBorder)
|
||||
{
|
||||
|
@ -609,117 +617,117 @@
|
|||
iP.y = _bounds.size.height - 16;
|
||||
|
||||
for (i = 0; i < howMany; i++)
|
||||
{
|
||||
NSRect r;
|
||||
NSRect fRect;
|
||||
NSTabViewItem *anItem = [_items objectAtIndex: i];
|
||||
NSTabState itemState = [anItem tabState];
|
||||
NSSize s = [anItem sizeOfLabel: truncate];
|
||||
{
|
||||
NSRect r;
|
||||
NSRect fRect;
|
||||
NSTabViewItem *anItem = [_items objectAtIndex: i];
|
||||
NSTabState itemState = [anItem tabState];
|
||||
NSSize s = [anItem sizeOfLabel: truncate];
|
||||
|
||||
[backgroundColour set];
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
if (itemState == NSSelectedTab)
|
||||
{
|
||||
iP.y -= 1;
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed: @"common_TabSelectedLeft"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
iP.y += 1;
|
||||
}
|
||||
else if (itemState == NSBackgroundTab)
|
||||
{
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed: @"common_TabUnSelectedLeft"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
}
|
||||
else
|
||||
NSLog(@"Not finished yet. Luff ya.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (itemState == NSSelectedTab)
|
||||
{
|
||||
iP.y -= 1;
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed:
|
||||
@"common_TabUnSelectToSelectedJunction"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
iP.y += 1;
|
||||
}
|
||||
else if (itemState == NSBackgroundTab)
|
||||
{
|
||||
if (previousState == NSSelectedTab)
|
||||
{
|
||||
iP.y -= 1;
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed:
|
||||
@"common_TabSelectedToUnSelectedJunction"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
iP.y += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed:
|
||||
@"common_TabUnSelectedJunction"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
}
|
||||
}
|
||||
else
|
||||
NSLog(@"Not finished yet. Luff ya.\n");
|
||||
}
|
||||
[backgroundColour set];
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
if (itemState == NSSelectedTab)
|
||||
{
|
||||
iP.y -= 1;
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed: @"common_TabSelectedLeft"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
iP.y += 1;
|
||||
}
|
||||
else if (itemState == NSBackgroundTab)
|
||||
{
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed: @"common_TabUnSelectedLeft"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
}
|
||||
else
|
||||
NSLog(@"Not finished yet. Luff ya.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (itemState == NSSelectedTab)
|
||||
{
|
||||
iP.y -= 1;
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed:
|
||||
@"common_TabUnSelectToSelectedJunction"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
iP.y += 1;
|
||||
}
|
||||
else if (itemState == NSBackgroundTab)
|
||||
{
|
||||
if (previousState == NSSelectedTab)
|
||||
{
|
||||
iP.y -= 1;
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed:
|
||||
@"common_TabSelectedToUnSelectedJunction"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
iP.y += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed:
|
||||
@"common_TabUnSelectedJunction"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
}
|
||||
}
|
||||
else
|
||||
NSLog(@"Not finished yet. Luff ya.\n");
|
||||
}
|
||||
|
||||
r.origin.x = iP.x + 13;
|
||||
r.origin.y = iP.y;
|
||||
r.size.width = s.width;
|
||||
r.size.height = 15;
|
||||
|
||||
fRect = r;
|
||||
if (itemState == NSSelectedTab)
|
||||
{
|
||||
// Undraw the line that separates the tab from its view.
|
||||
fRect.origin.y -= 1;
|
||||
fRect.size.height += 1;
|
||||
}
|
||||
NSRectFill(fRect);
|
||||
r.origin.x = iP.x + 13;
|
||||
r.origin.y = iP.y;
|
||||
r.size.width = s.width;
|
||||
r.size.height = 15;
|
||||
|
||||
fRect = r;
|
||||
if (itemState == NSSelectedTab)
|
||||
{
|
||||
// Undraw the line that separates the tab from its view.
|
||||
fRect.origin.y -= 1;
|
||||
fRect.size.height += 1;
|
||||
}
|
||||
NSRectFill(fRect);
|
||||
|
||||
// Draw the line at the top of the item
|
||||
[lineColour set];
|
||||
DPSsetlinewidth(ctxt, 1);
|
||||
DPSmoveto(ctxt, r.origin.x, r.origin.y + 16);
|
||||
DPSrlineto(ctxt, r.size.width, 0);
|
||||
DPSstroke(ctxt);
|
||||
|
||||
// Label
|
||||
[anItem drawLabel: truncate inRect: r];
|
||||
|
||||
iP.x += s.width + 13;
|
||||
previousState = itemState;
|
||||
// Draw the line at the top of the item
|
||||
[lineColour set];
|
||||
DPSsetlinewidth(ctxt, 1);
|
||||
DPSmoveto(ctxt, r.origin.x, r.origin.y + 16);
|
||||
DPSrlineto(ctxt, r.size.width, 0);
|
||||
DPSstroke(ctxt);
|
||||
|
||||
// Label
|
||||
[anItem drawLabel: truncate inRect: r];
|
||||
|
||||
iP.x += s.width + 13;
|
||||
previousState = itemState;
|
||||
|
||||
if (i == howMany - 1)
|
||||
{
|
||||
[backgroundColour set];
|
||||
|
||||
if ([anItem tabState] == NSSelectedTab)
|
||||
{
|
||||
iP.y -= 1;
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed: @"common_TabSelectedRight"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
iP.y += 1;
|
||||
}
|
||||
else if ([anItem tabState] == NSBackgroundTab)
|
||||
{
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed: @"common_TabUnSelectedRight"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
}
|
||||
else
|
||||
NSLog(@"Not finished yet. Luff ya.\n");
|
||||
}
|
||||
}
|
||||
if (i == howMany - 1)
|
||||
{
|
||||
[backgroundColour set];
|
||||
|
||||
if ([anItem tabState] == NSSelectedTab)
|
||||
{
|
||||
iP.y -= 1;
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed: @"common_TabSelectedRight"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
iP.y += 1;
|
||||
}
|
||||
else if ([anItem tabState] == NSBackgroundTab)
|
||||
{
|
||||
NSRectFill(NSMakeRect(iP.x, iP.y, 14, 17));
|
||||
[[NSImage imageNamed: @"common_TabUnSelectedRight"]
|
||||
compositeToPoint: iP operation: NSCompositeSourceOver];
|
||||
}
|
||||
else
|
||||
NSLog(@"Not finished yet. Luff ya.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
// FIXME: Missing drawing code for other cases
|
||||
|
||||
|
@ -747,7 +755,7 @@
|
|||
NSTabViewItem *anItem = [_items objectAtIndex: i];
|
||||
|
||||
if (NSPointInRect(point, [anItem _tabRect]))
|
||||
return anItem;
|
||||
return anItem;
|
||||
}
|
||||
|
||||
return nil;
|
||||
|
@ -756,7 +764,7 @@
|
|||
- (void) mouseDown: (NSEvent *)theEvent
|
||||
{
|
||||
NSPoint location = [self convertPoint: [theEvent locationInWindow]
|
||||
fromView: nil];
|
||||
fromView: nil];
|
||||
NSTabViewItem *anItem = [self tabViewItemAtPoint: location];
|
||||
|
||||
if (anItem != nil && ![anItem isEqual: _selected])
|
||||
|
@ -830,35 +838,35 @@
|
|||
{
|
||||
if ([aDecoder containsValueForKey: @"NSAllowTruncatedLabels"])
|
||||
{
|
||||
[self setAllowsTruncatedLabels: [aDecoder decodeBoolForKey:
|
||||
@"NSAllowTruncatedLabels"]];
|
||||
}
|
||||
[self setAllowsTruncatedLabels: [aDecoder decodeBoolForKey:
|
||||
@"NSAllowTruncatedLabels"]];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSDrawsBackground"])
|
||||
{
|
||||
[self setDrawsBackground: [aDecoder decodeBoolForKey:
|
||||
@"NSDrawsBackground"]];
|
||||
}
|
||||
[self setDrawsBackground: [aDecoder decodeBoolForKey:
|
||||
@"NSDrawsBackground"]];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSFont"])
|
||||
{
|
||||
[self setFont: [aDecoder decodeObjectForKey: @"NSFont"]];
|
||||
}
|
||||
[self setFont: [aDecoder decodeObjectForKey: @"NSFont"]];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSTabViewItems"])
|
||||
{
|
||||
ASSIGN(_items, [aDecoder decodeObjectForKey: @"NSTabViewItems"]);
|
||||
}
|
||||
ASSIGN(_items, [aDecoder decodeObjectForKey: @"NSTabViewItems"]);
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSSelectedTabViewItem"])
|
||||
{
|
||||
[self selectTabViewItem: [aDecoder decodeObjectForKey:
|
||||
@"NSSelectedTabViewItem"]];
|
||||
}
|
||||
[self selectTabViewItem: [aDecoder decodeObjectForKey:
|
||||
@"NSSelectedTabViewItem"]];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSTvFlags"])
|
||||
{
|
||||
int vFlags = [aDecoder decodeIntForKey: @"NSTvFlags"];
|
||||
int vFlags = [aDecoder decodeIntForKey: @"NSTvFlags"];
|
||||
|
||||
[self setControlTint: ((vFlags & 0x70000000) >> 28)];
|
||||
[self setControlSize: ((vFlags & 0x0c000000) >> 26)];
|
||||
[self setTabViewType: (vFlags & 0x00000007)];
|
||||
}
|
||||
[self setControlTint: ((vFlags & 0x70000000) >> 28)];
|
||||
[self setControlSize: ((vFlags & 0x0c000000) >> 26)];
|
||||
[self setTabViewType: (vFlags & 0x00000007)];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -869,33 +877,33 @@
|
|||
[aDecoder decodeValueOfObjCType: @encode(NSTabViewType) at: &_type];
|
||||
if (version < 2)
|
||||
{
|
||||
switch(_type)
|
||||
{
|
||||
case 0:
|
||||
_type = NSTopTabsBezelBorder;
|
||||
break;
|
||||
case 5:
|
||||
_type = NSLeftTabsBezelBorder;
|
||||
break;
|
||||
case 1:
|
||||
_type = NSBottomTabsBezelBorder;
|
||||
break;
|
||||
case 6:
|
||||
_type = NSRightTabsBezelBorder;
|
||||
break;
|
||||
case 2:
|
||||
_type = NSNoTabsBezelBorder;
|
||||
break;
|
||||
case 3:
|
||||
_type = NSNoTabsLineBorder;
|
||||
break;
|
||||
case 4:
|
||||
_type = NSNoTabsNoBorder;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch(_type)
|
||||
{
|
||||
case 0:
|
||||
_type = NSTopTabsBezelBorder;
|
||||
break;
|
||||
case 5:
|
||||
_type = NSLeftTabsBezelBorder;
|
||||
break;
|
||||
case 1:
|
||||
_type = NSBottomTabsBezelBorder;
|
||||
break;
|
||||
case 6:
|
||||
_type = NSRightTabsBezelBorder;
|
||||
break;
|
||||
case 2:
|
||||
_type = NSNoTabsBezelBorder;
|
||||
break;
|
||||
case 3:
|
||||
_type = NSNoTabsLineBorder;
|
||||
break;
|
||||
case 4:
|
||||
_type = NSNoTabsNoBorder;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_draws_background];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_truncated_label];
|
||||
_delegate = [aDecoder decodeObject];
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue