mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 16:00:37 +00:00
Revert button margins from theme drawing code and move into NSButtonCell which is more correct (still not quite right)
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@38906 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
db87c49163
commit
ad0dc75094
2 changed files with 41 additions and 44 deletions
|
@ -1122,6 +1122,7 @@ typedef struct _GSButtonCellFlags
|
|||
|| [controlView mouse: [[controlView window] mouseLocationOutsideOfEventStream]
|
||||
inRect: cellFrame]))
|
||||
{
|
||||
cellFrame = [self drawingRectForBounds:cellFrame];
|
||||
[self drawBezelWithFrame: cellFrame inView: controlView];
|
||||
}
|
||||
}
|
||||
|
@ -1514,6 +1515,17 @@ typedef struct _GSButtonCellFlags
|
|||
return s;
|
||||
}
|
||||
|
||||
- (NSRect)insetFrame:(NSRect)frame withMargins:(GSThemeMargins)margins
|
||||
{
|
||||
NSRect result = frame;
|
||||
result.origin.x += margins.left;
|
||||
result.origin.y += ([_control_view isFlipped] ?
|
||||
margins.top : margins.bottom);
|
||||
result.size.width -= (margins.left + margins.right);
|
||||
result.size.height -= (margins.top + margins.bottom);
|
||||
return(result);
|
||||
}
|
||||
|
||||
- (NSRect) drawingRectForBounds: (NSRect)theRect
|
||||
{
|
||||
if (_cell.is_bordered)
|
||||
|
@ -1550,15 +1562,9 @@ typedef struct _GSButtonCellFlags
|
|||
}
|
||||
|
||||
border = [[GSTheme theme] buttonMarginsForCell: self
|
||||
style: _bezel_style
|
||||
state: buttonState];
|
||||
|
||||
interiorFrame = theRect;
|
||||
interiorFrame.origin.x += border.left;
|
||||
interiorFrame.size.width -= border.left + border.right;
|
||||
interiorFrame.origin.y += ([_control_view isFlipped] ?
|
||||
border.top : border.bottom);
|
||||
interiorFrame.size.height -= border.bottom + border.top;
|
||||
style: _bezel_style
|
||||
state: buttonState];
|
||||
interiorFrame = [self insetFrame:theRect withMargins:border];
|
||||
|
||||
/* Pushed in buttons contents are displaced to the bottom right 1px. */
|
||||
if (mask & NSPushInCellMask)
|
||||
|
@ -1570,7 +1576,11 @@ typedef struct _GSButtonCellFlags
|
|||
}
|
||||
else
|
||||
{
|
||||
return theRect;
|
||||
GSThemeMargins margins = [[GSTheme theme] buttonMarginsForCell: self
|
||||
style: _bezel_style
|
||||
state: GSThemeNormalState];
|
||||
NSRect frame = [self insetFrame:theRect withMargins:margins];
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue