Fixed problem with strings in non-editable textfields becoming bold when you click on the textfield

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@26368 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 2008-03-20 11:45:02 +00:00
parent c6c6e8f027
commit b416d00ef8
2 changed files with 31 additions and 12 deletions

View file

@ -1,3 +1,10 @@
2008-03-20 Nicola Pero <nicola.pero@meta-innovation.com>
* Source/NSTextFieldCell.m ([-drawInteriorWithFrame:inView:]): If
the control view is in an editing mode, do nothing. This fixes
problems with transparency or anti-aliased fonts when selecting or
editing textfields.
2008-03-20 Nicola Pero <nicola.pero@meta-innovation.com>
* Source/NSButtonCell.m ([-cellSize]): Restored horizontal space

View file

@ -36,6 +36,7 @@
#include "AppKit/NSEvent.h"
#include "AppKit/NSFont.h"
#include "AppKit/NSGraphics.h"
#include "AppKit/NSTextField.h"
#include "AppKit/NSTextFieldCell.h"
#include "AppKit/NSText.h"
@ -234,20 +235,31 @@ static NSColor *txtCol;
- (void) drawInteriorWithFrame: (NSRect)cellFrame inView: (NSView*)controlView
{
if (_textfieldcell_draws_background)
/* Do nothing if there is already a text editor doing the drawing;
* otherwise, we draw everything twice. That is bad if there are
* any transparency involved (eg, even an anti-alias font!) because
* if the semi-transparent pixels are drawn over themselves they
* become less transparent (eg, an anti-alias font becomes darker
* and gives the impression of being bold).
*/
if (([controlView respondsToSelector: @selector(currentEditor)] == NO)
|| ([(NSTextField *)controlView currentEditor] == nil))
{
if ([self isEnabled])
{
[_background_color set];
}
else
{
[[NSColor controlBackgroundColor] set];
}
NSRectFill([self drawingRectForBounds: cellFrame]);
if (_textfieldcell_draws_background)
{
if ([self isEnabled])
{
[_background_color set];
}
else
{
[[NSColor controlBackgroundColor] set];
}
NSRectFill([self drawingRectForBounds: cellFrame]);
}
[super drawInteriorWithFrame: cellFrame inView: controlView];
}
[super drawInteriorWithFrame: cellFrame inView: controlView];
}
/*