mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 22:40:38 +00:00
Added method to draw scroll view.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31662 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
10fb5175e7
commit
a6f4c7d516
3 changed files with 104 additions and 82 deletions
|
@ -1216,87 +1216,8 @@ static float scrollerWidth;
|
|||
|
||||
- (void) drawRect: (NSRect)rect
|
||||
{
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
GSTheme *theme = [GSTheme theme];
|
||||
NSColor *color;
|
||||
NSString *name;
|
||||
BOOL hasInnerBorder = ![[NSUserDefaults standardUserDefaults]
|
||||
boolForKey: @"GSScrollViewNoInnerBorder"];
|
||||
|
||||
name = [theme nameForElement: self];
|
||||
if (name == nil)
|
||||
{
|
||||
name = @"NSScrollView";
|
||||
}
|
||||
color = [theme colorNamed: name state: GSThemeNormalState];
|
||||
if (color == nil)
|
||||
{
|
||||
color = [NSColor controlDarkShadowColor];
|
||||
}
|
||||
|
||||
switch (_borderType)
|
||||
{
|
||||
case NSNoBorder:
|
||||
break;
|
||||
|
||||
case NSLineBorder:
|
||||
[color set];
|
||||
NSFrameRect(_bounds);
|
||||
break;
|
||||
|
||||
case NSBezelBorder:
|
||||
[theme drawGrayBezel: _bounds withClip: rect];
|
||||
break;
|
||||
|
||||
case NSGrooveBorder:
|
||||
[theme drawGroove: _bounds withClip: rect];
|
||||
break;
|
||||
}
|
||||
|
||||
if (hasInnerBorder)
|
||||
{
|
||||
[color set];
|
||||
DPSsetlinewidth(ctxt, 1);
|
||||
|
||||
if (_hasVertScroller)
|
||||
{
|
||||
NSInterfaceStyle style;
|
||||
|
||||
style = NSInterfaceStyleForKey(@"NSScrollViewInterfaceStyle", nil);
|
||||
if (style == NSMacintoshInterfaceStyle
|
||||
|| style == NSWindows95InterfaceStyle)
|
||||
{
|
||||
DPSmoveto(ctxt, [_vertScroller frame].origin.x - 1,
|
||||
[_vertScroller frame].origin.y - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
DPSmoveto(ctxt, [_vertScroller frame].origin.x + scrollerWidth,
|
||||
[_vertScroller frame].origin.y - 1);
|
||||
}
|
||||
DPSrlineto(ctxt, 0, [_vertScroller frame].size.height + 1);
|
||||
DPSstroke(ctxt);
|
||||
}
|
||||
|
||||
if (_hasHorizScroller)
|
||||
{
|
||||
float ypos;
|
||||
float scrollerY = [_horizScroller frame].origin.y;
|
||||
|
||||
if ([self isFlipped])
|
||||
{
|
||||
ypos = scrollerY - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ypos = scrollerY + scrollerWidth + 1;
|
||||
}
|
||||
|
||||
DPSmoveto(ctxt, [_horizScroller frame].origin.x - 1, ypos);
|
||||
DPSrlineto(ctxt, [_horizScroller frame].size.width + 1, 0);
|
||||
DPSstroke(ctxt);
|
||||
}
|
||||
}
|
||||
[self drawScrollViewRect: rect
|
||||
inView: self];
|
||||
}
|
||||
|
||||
- (NSRect) documentVisibleRect
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue