mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
* Images/common_StepperDown.tiff,
* Images/common_StepperDownHighlighted.tiff, * Images/common_StepperUp.tiff, * Images/common_StepperUpHighlighted.tiff: new images with arrows similar to scroll view buttons'. * Source/GSThemeDrawing.m (stepperUpButtonRectWithFrame:), (stepperDownButtonRectWithFrame:): center buttons horizontally; simplify and cleanup. * Source/NSStepper.m (acceptsFirstResponder): return NO. Returning YES makes sense only if `keyDown:` is implemented. (acceptsFirstMouse:): return YES. * Source/NSStepperCell.m (cellSize): initial implementation. Retruns minimum size based on up and button sizes.
This commit is contained in:
parent
3f6da64b52
commit
9a58a93ee5
8 changed files with 54 additions and 8 deletions
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
|||
2020-01-10 Sergii Stoian <stoyan255@gmail.com>
|
||||
|
||||
* Images/common_StepperDown.tiff,
|
||||
* Images/common_StepperDownHighlighted.tiff,
|
||||
* Images/common_StepperUp.tiff,
|
||||
* Images/common_StepperUpHighlighted.tiff: new images with arrows
|
||||
similar to scroll view buttons'.
|
||||
|
||||
* Source/GSThemeDrawing.m (stepperUpButtonRectWithFrame:),
|
||||
(stepperDownButtonRectWithFrame:): center buttons horizontally; simplify
|
||||
and cleanup.
|
||||
|
||||
* Source/NSStepper.m (acceptsFirstResponder): return NO. Returning
|
||||
YES makes sense only if `keyDown:` is implemented.
|
||||
(acceptsFirstMouse:): return YES.
|
||||
|
||||
* Source/NSStepperCell.m (cellSize): initial implementation. Retruns
|
||||
minimum size based on up and button sizes.
|
||||
|
||||
2020-01-07 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/AppKit/NSDatePicker.h,
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -722,22 +722,20 @@
|
|||
- (NSRect) stepperUpButtonRectWithFrame: (NSRect)frame
|
||||
{
|
||||
NSSize size = [[NSImage imageNamed: @"common_StepperUp"] size];
|
||||
NSRect upRect;
|
||||
NSRect upRect = {{NSMinX(frame), NSMinY(frame)}, {size.width, size.height}};
|
||||
|
||||
upRect.size = size;
|
||||
upRect.origin.x = NSMaxX(frame) - size.width;
|
||||
upRect.origin.y = NSMinY(frame) + ((int)frame.size.height / 2) + 1;
|
||||
upRect.origin.x += ((int)frame.size.width / 2) - ((int)size.width / 2);
|
||||
upRect.origin.y += ((int)frame.size.height / 2);
|
||||
return upRect;
|
||||
}
|
||||
|
||||
- (NSRect) stepperDownButtonRectWithFrame: (NSRect)frame
|
||||
{
|
||||
NSSize size = [[NSImage imageNamed: @"common_StepperDown"] size];
|
||||
NSRect downRect;
|
||||
NSRect downRect = {{NSMinX(frame), NSMinY(frame)}, {size.width, size.height}};
|
||||
|
||||
downRect.size = size;
|
||||
downRect.origin.x = NSMaxX(frame) - size.width;
|
||||
downRect.origin.y = NSMinY(frame) + ((int)frame.size.height / 2) - size.height + 1;
|
||||
downRect.origin.x += ((int)frame.size.width / 2) - ((int)size.width / 2);
|
||||
downRect.origin.y += ((int)frame.size.height / 2) - size.height;
|
||||
return downRect;
|
||||
}
|
||||
|
||||
|
|
|
@ -85,6 +85,17 @@ id _nsstepperCellClass = nil;
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)acceptsFirstResponder
|
||||
{
|
||||
// FIXME: change to `YES` after `keyDown:` implementation.
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) acceptsFirstMouse: (NSEvent *)theEvent
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) keyDown: (NSEvent*)theEvent
|
||||
{
|
||||
// FIXME
|
||||
|
|
|
@ -346,6 +346,24 @@
|
|||
return mouseWentUp;
|
||||
}
|
||||
|
||||
- (NSSize) cellSize
|
||||
{
|
||||
NSRect upRect = [[GSTheme theme]
|
||||
stepperUpButtonRectWithFrame: [_control_view bounds]];
|
||||
NSRect downRect = [[GSTheme theme]
|
||||
stepperDownButtonRectWithFrame: [_control_view bounds]];
|
||||
NSSize size;
|
||||
|
||||
if (upRect.size.width > downRect.size.width)
|
||||
size.width = upRect.size.width;
|
||||
else
|
||||
size.width = downRect.size.width;
|
||||
|
||||
size.height = upRect.size.height + downRect.size.height;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
//
|
||||
// NSCoding protocol
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue