mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 05:50:37 +00:00
* Headers/Additions/GNUstepGUI/GSTheme.h: New GSThemeMargins struct.
Rename buttonBorderForCell:style:state: to buttonMarginsForCell:style:state: and return the top/bottom/left/right margins instead of just two values. (This is a theme API break.) * Source/GSThemeDrawing.m: Implement buttonMarginsForCell:style:state:. Also reduce the top and left margin of the default button by 1 pt, to better reflect the button's appearance. * Source/GSGuiPrivate.h: Add a GSRoundTowardsNegativeInfinity function * Source/NSButtonCell.m (-drawImage:withFrame:inView:): Round the image position down and to the right, as this seems to look the best. * Source/NSButtonCell.m (-cellSize): Call new buttonMarginsForCell: method * Source/NSButtonCell.m (-drawingRectForBounds:): Call new buttonMarginsForCell: method git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33743 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6ec3f1a58b
commit
01c4a0be63
5 changed files with 137 additions and 57 deletions
|
@ -88,5 +88,20 @@ static inline CGFloat GSRoundTowardsInfinity(CGFloat x)
|
|||
return floor(x + 0.5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rounds to the nearest integer, and in the case of ties, round to the
|
||||
* smaller integer.
|
||||
*
|
||||
* For example:
|
||||
* GSRoundTowardsNegativeInfinity(0.8) == 1.0
|
||||
* GSRoundTowardsNegativeInfinity(0.5) == 0.0
|
||||
* GSRoundTowardsNegativeInfinity(0.1) == 0.0
|
||||
* GSRoundTowardsNegativeInfinity(-2.5) == -3.0
|
||||
*/
|
||||
static inline CGFloat GSRoundTowardsNegativeInfinity(CGFloat x)
|
||||
{
|
||||
return ceil(x - 0.5);
|
||||
}
|
||||
|
||||
#endif /* _GNUstep_H_GSGuiPrivate */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue