mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 02:04:20 +00:00
* Source/Functions.m (NSFrameRectWithWidth): Use one pixel width
if a value of 0 is given. Fixes bug #40760 * Source/NSScroller.m: Move disable check out of -rectForPart:. Fixes bug #40761. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37425 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3ad5c33813
commit
313f18786a
3 changed files with 43 additions and 21 deletions
|
@ -1,3 +1,10 @@
|
|||
2013-12-01 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/Functions.m (NSFrameRectWithWidth): Use one pixel width
|
||||
if a value of 0 is given. Fixes bug #40760
|
||||
* Source/NSScroller.m: Move disable check out of -rectForPart:.
|
||||
Fixes bug #40761.
|
||||
|
||||
2013-12-01 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSModelLoaderFactory.h,
|
||||
|
|
|
@ -777,6 +777,14 @@ void NSFrameRectWithWidth(const NSRect aRect, CGFloat frameWidth)
|
|||
NSRect rects[4];
|
||||
int i;
|
||||
|
||||
if (frameWidth == 0.0)
|
||||
{
|
||||
NSView *view = [GSCurrentContext() focusView];
|
||||
NSSize aSize = [view convertSize: NSMakeSize(1.0, 1.0) fromView: nil];
|
||||
|
||||
frameWidth = (aSize.width + aSize.height) / 2.0;
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
NSDivideRect(remainder, &rects[i], &remainder, frameWidth, sides[i]);
|
||||
|
@ -793,6 +801,14 @@ NSFrameRectWithWidthUsingOperation(NSRect aRect, CGFloat frameWidth,
|
|||
NSRect rects[4];
|
||||
int i;
|
||||
|
||||
if (frameWidth == 0.0)
|
||||
{
|
||||
NSView *view = [GSCurrentContext() focusView];
|
||||
NSSize aSize = [view convertSize: NSMakeSize(1.0, 1.0) fromView: nil];
|
||||
|
||||
frameWidth = (aSize.width + aSize.height) / 2.0;
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
NSDivideRect(remainder, &rects[i], &remainder, frameWidth, sides[i]);
|
||||
|
|
|
@ -1059,6 +1059,11 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
|
|||
*/
|
||||
- (void) drawArrow: (NSScrollerArrow)whichButton highlight: (BOOL)flag
|
||||
{
|
||||
if (!_scFlags.isEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
NSRect rect = [self rectForPart: (whichButton == NSScrollerIncrementArrow
|
||||
? NSScrollerIncrementLine : NSScrollerDecrementLine)];
|
||||
id theCell = nil;
|
||||
|
@ -1090,6 +1095,11 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
|
|||
*/
|
||||
- (void) drawKnob
|
||||
{
|
||||
if (!_scFlags.isEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (upCell == nil)
|
||||
{
|
||||
[self drawParts];
|
||||
|
@ -1105,8 +1115,11 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
|
|||
|
||||
- (void) drawKnobSlot
|
||||
{
|
||||
[self drawKnobSlotInRect: [self rectForPart: NSScrollerKnobSlot]
|
||||
highlight: NO];
|
||||
if (_scFlags.isEnabled)
|
||||
{
|
||||
[self drawKnobSlotInRect: [self rectForPart: NSScrollerKnobSlot]
|
||||
highlight: NO];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) drawKnobSlotInRect: (NSRect)slotRect highlight: (BOOL)flag
|
||||
|
@ -1161,7 +1174,6 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
|
|||
CGFloat width, height;
|
||||
CGFloat buttonsWidth;
|
||||
CGFloat buttonsSize;
|
||||
NSUsableScrollerParts usableParts;
|
||||
BOOL arrowsSameEnd = [[GSTheme theme] scrollerArrowsSameEndForScroller: self];
|
||||
|
||||
if (upCell == nil)
|
||||
|
@ -1173,19 +1185,6 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
|
|||
x = y = buttonsOffset;
|
||||
buttonsSize = 2 * buttonsWidth + 2 * buttonsOffset;
|
||||
|
||||
/*
|
||||
* If the scroller is disabled then the scroller buttons and the
|
||||
* knob are not displayed at all.
|
||||
*/
|
||||
if (!_scFlags.isEnabled)
|
||||
{
|
||||
usableParts = NSNoScrollerParts;
|
||||
}
|
||||
else
|
||||
{
|
||||
usableParts = _usableParts;
|
||||
}
|
||||
|
||||
/*
|
||||
* Assign to `width' and `height' values describing
|
||||
* the width and height of the scroller regardless
|
||||
|
@ -1214,8 +1213,8 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
|
|||
{
|
||||
CGFloat knobHeight, knobPosition, slotHeight;
|
||||
|
||||
if (usableParts == NSNoScrollerParts
|
||||
|| usableParts == NSOnlyScrollerArrows)
|
||||
if (_usableParts == NSNoScrollerParts
|
||||
|| _usableParts == NSOnlyScrollerArrows)
|
||||
{
|
||||
return NSZeroRect;
|
||||
}
|
||||
|
@ -1275,7 +1274,7 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
|
|||
* if the scroller does not have buttons the slot completely
|
||||
* fills the scroller.
|
||||
*/
|
||||
if (usableParts == NSNoScrollerParts
|
||||
if (_usableParts == NSNoScrollerParts
|
||||
|| _arrowsPosition == NSScrollerArrowsNone)
|
||||
{
|
||||
break;
|
||||
|
@ -1297,7 +1296,7 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
|
|||
|
||||
case NSScrollerDecrementLine:
|
||||
case NSScrollerDecrementPage:
|
||||
if (usableParts == NSNoScrollerParts
|
||||
if (_usableParts == NSNoScrollerParts
|
||||
|| _arrowsPosition == NSScrollerArrowsNone)
|
||||
{
|
||||
return NSZeroRect;
|
||||
|
@ -1312,7 +1311,7 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
|
|||
|
||||
case NSScrollerIncrementLine:
|
||||
case NSScrollerIncrementPage:
|
||||
if (usableParts == NSNoScrollerParts
|
||||
if (_usableParts == NSNoScrollerParts
|
||||
|| _arrowsPosition == NSScrollerArrowsNone)
|
||||
{
|
||||
return NSZeroRect;
|
||||
|
|
Loading…
Reference in a new issue