2001-12-17 16:51:51 +00:00
|
|
|
/** <title>NSTableHeaderCell</title>
|
1999-10-25 22:15:18 +00:00
|
|
|
|
|
|
|
Copyright (C) 1999 Free Software Foundation, Inc.
|
|
|
|
|
2001-12-17 16:51:51 +00:00
|
|
|
Author: Nicola Pero <n.pero@mi.flashnet.it>
|
1999-10-25 22:15:18 +00:00
|
|
|
Date: 1999
|
|
|
|
|
|
|
|
This file is part of the GNUstep GUI Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
2007-10-29 21:16:17 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
1999-10-25 22:15:18 +00:00
|
|
|
License as published by the Free Software Foundation; either
|
2008-06-10 04:01:49 +00:00
|
|
|
version 2 of the License, or (at your option) any later version.
|
2007-10-29 21:16:17 +00:00
|
|
|
|
1999-10-25 22:15:18 +00:00
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2007-10-29 21:16:17 +00:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
1999-10-25 22:15:18 +00:00
|
|
|
|
2007-10-29 21:16:17 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
1999-10-25 22:15:18 +00:00
|
|
|
License along with this library; see the file COPYING.LIB.
|
2007-10-29 21:16:17 +00:00
|
|
|
If not, see <http://www.gnu.org/licenses/> or write to the
|
|
|
|
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02110-1301, USA.
|
1999-10-25 22:15:18 +00:00
|
|
|
*/
|
|
|
|
|
2003-06-13 15:01:12 +00:00
|
|
|
#include "AppKit/NSTableHeaderCell.h"
|
|
|
|
#include "AppKit/NSColor.h"
|
|
|
|
#include "AppKit/NSFont.h"
|
2006-09-22 11:53:40 +00:00
|
|
|
#include "GNUstepGUI/GSTheme.h"
|
1999-10-25 22:15:18 +00:00
|
|
|
|
1999-07-19 19:13:10 +00:00
|
|
|
@implementation NSTableHeaderCell
|
|
|
|
{
|
1999-10-25 22:15:18 +00:00
|
|
|
}
|
2006-01-20 01:03:01 +00:00
|
|
|
|
1999-10-25 22:15:18 +00:00
|
|
|
// Default appearance of NSTableHeaderCell
|
|
|
|
- (id) initTextCell: (NSString *)aString
|
|
|
|
{
|
|
|
|
[super initTextCell: aString];
|
|
|
|
|
2006-01-20 01:03:01 +00:00
|
|
|
[self setAlignment: NSCenterTextAlignment];
|
|
|
|
[self setTextColor: [NSColor windowFrameTextColor]];
|
1999-10-25 22:15:18 +00:00
|
|
|
[self setBackgroundColor: [NSColor controlShadowColor]];
|
2006-01-20 01:03:01 +00:00
|
|
|
[self setDrawsBackground: YES];
|
2000-09-02 17:16:26 +00:00
|
|
|
[self setFont: [NSFont titleBarFontOfSize: 0]];
|
2006-01-20 01:03:01 +00:00
|
|
|
// This is not exactly true
|
2000-03-18 00:26:41 +00:00
|
|
|
_cell.is_bezeled = YES;
|
2008-02-02 21:01:43 +00:00
|
|
|
_cell.is_bordered = NO;
|
1999-10-25 22:15:18 +00:00
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
2004-06-07 23:54:25 +00:00
|
|
|
|
2006-01-20 01:03:01 +00:00
|
|
|
- (NSRect) drawingRectForBounds: (NSRect)theRect
|
|
|
|
{
|
|
|
|
NSSize borderSize;
|
2002-02-13 16:34:40 +00:00
|
|
|
|
2006-01-20 01:03:01 +00:00
|
|
|
// This adjustment must match the drawn border
|
|
|
|
borderSize = NSMakeSize(1, 1);
|
2004-06-07 23:54:25 +00:00
|
|
|
|
2006-01-20 01:03:01 +00:00
|
|
|
return NSInsetRect(theRect, borderSize.width, borderSize.height);
|
2000-03-18 00:26:41 +00:00
|
|
|
}
|
|
|
|
|
2008-02-02 21:01:43 +00:00
|
|
|
- (void) _drawBorderAndBackgroundWithFrame: (NSRect)cellFrame
|
|
|
|
inView: (NSView*)controlView
|
2002-02-13 16:34:40 +00:00
|
|
|
{
|
2006-01-20 01:03:01 +00:00
|
|
|
if (_cell.is_highlighted == YES)
|
2002-02-13 16:34:40 +00:00
|
|
|
{
|
2006-09-22 11:53:40 +00:00
|
|
|
[[GSTheme theme] drawButton: cellFrame withClip: cellFrame];
|
2002-02-13 16:34:40 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-09-22 11:53:40 +00:00
|
|
|
[[GSTheme theme] drawDarkButton: cellFrame withClip: cellFrame];
|
2002-02-13 16:34:40 +00:00
|
|
|
}
|
1999-07-19 19:13:10 +00:00
|
|
|
}
|
2003-01-30 04:26:35 +00:00
|
|
|
|
2006-01-20 01:03:01 +00:00
|
|
|
- (void) setHighlighted: (BOOL)flag
|
2003-01-30 04:26:35 +00:00
|
|
|
{
|
|
|
|
_cell.is_highlighted = flag;
|
|
|
|
|
|
|
|
if (flag == YES)
|
|
|
|
{
|
2005-01-09 16:12:14 +00:00
|
|
|
[self setBackgroundColor: [NSColor controlHighlightColor]];
|
2006-01-20 01:03:01 +00:00
|
|
|
[self setTextColor: [NSColor controlTextColor]];
|
2003-01-30 04:26:35 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[self setBackgroundColor: [NSColor controlShadowColor]];
|
2006-01-20 01:03:01 +00:00
|
|
|
[self setTextColor: [NSColor windowFrameTextColor]];
|
2003-01-30 04:26:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-07-19 19:13:10 +00:00
|
|
|
@end
|