Added method to draw scroller using theme.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31656 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2010-11-26 19:16:46 +00:00
parent 8ed87de2f2
commit 538432c72f
4 changed files with 54 additions and 28 deletions

View file

@ -1,9 +1,18 @@
2010-11-26 Gregory John Casamento <greg.casamento@gmail.com>
* Source/GSThemeDrawing.m: Added method to scroller view.
* Source/NSScroller.m: Added call in drawRect: to new drawing method
in GSTheme.
* Headers/Additions/GNUstepGUI/GSTheme.h:
Added declaration for new method.
2010-11-26 Gregory John Casamento <greg.casamento@gmail.com>
* Source/GSThemeDrawing.m: Added method to draw tab view.
* Source/NSTabView.m: Added call in drawRect: to new drawing method
in GSTheme.
* Headers/GNUstepGUI/GSTheme.h: Added declaration for new method.
* Headers/Additions/GNUstepGUI/GSTheme.h:
Added declaration for new method.
2010-11-26 Wolfgang Lux <wolfgang.lux@gmail.com>>

View file

@ -939,6 +939,11 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
inView: (NSView *)view
withItems: (NSArray *)items
selectedItem: (NSTabViewItem *)item;
- (void) drawScrollerRect: (NSRect)rect
inView: (NSView *)view
hitPart: (NSScrollerPart)hitPart
isHorizontal: (BOOL)isHorizontal;
@end
/**

View file

@ -1786,4 +1786,39 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
DPSgrestore(ctxt);
}
- (void) drawScrollerRect: (NSRect)rect
inView: (NSView *)view
hitPart: (NSScrollerPart)hitPart
isHorizontal: (BOOL)isHorizontal
{
NSRect rectForPartIncrementLine;
NSRect rectForPartDecrementLine;
NSRect rectForPartKnobSlot;
NSScroller *scroller = (NSScroller *)view;
rectForPartIncrementLine = [scroller rectForPart: NSScrollerIncrementLine];
rectForPartDecrementLine = [scroller rectForPart: NSScrollerDecrementLine];
rectForPartKnobSlot = [scroller rectForPart: NSScrollerKnobSlot];
[[[view window] backgroundColor] set];
NSRectFill (rect);
if (NSIntersectsRect (rect, rectForPartKnobSlot) == YES)
{
[scroller drawKnobSlot];
[scroller drawKnob];
}
if (NSIntersectsRect (rect, rectForPartDecrementLine) == YES)
{
[scroller drawArrow: NSScrollerDecrementArrow
highlight: hitPart == NSScrollerDecrementLine];
}
if (NSIntersectsRect (rect, rectForPartIncrementLine) == YES)
{
[scroller drawArrow: NSScrollerIncrementArrow
highlight: hitPart == NSScrollerIncrementLine];
}
}
@end

View file

@ -1028,33 +1028,10 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
*/
- (void) drawRect: (NSRect)rect
{
NSRect rectForPartIncrementLine;
NSRect rectForPartDecrementLine;
NSRect rectForPartKnobSlot;
rectForPartIncrementLine = [self rectForPart: NSScrollerIncrementLine];
rectForPartDecrementLine = [self rectForPart: NSScrollerDecrementLine];
rectForPartKnobSlot = [self rectForPart: NSScrollerKnobSlot];
[[_window backgroundColor] set];
NSRectFill (rect);
if (NSIntersectsRect (rect, rectForPartKnobSlot) == YES)
{
[self drawKnobSlot];
[self drawKnob];
}
if (NSIntersectsRect (rect, rectForPartDecrementLine) == YES)
{
[self drawArrow: NSScrollerDecrementArrow
highlight: _hitPart == NSScrollerDecrementLine];
}
if (NSIntersectsRect (rect, rectForPartIncrementLine) == YES)
{
[self drawArrow: NSScrollerIncrementArrow
highlight: _hitPart == NSScrollerIncrementLine];
}
[[GSTheme theme] drawScrollerRect: rect
inView: self
hitPart: _hitPart
isHorizontal: _scFlags.isHorizontal];
}
/**<p>(Un)Highlight the button specified by <var>whichButton</var>.