Incorporated bug fixes from Benhur Stein.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@2587 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Ovidiu Predescu 1997-10-29 21:56:04 +00:00
parent fe084aeb94
commit 87966db359
8 changed files with 70 additions and 41 deletions

View file

@ -1,3 +1,23 @@
Wed Oct 29 12:22:22 1997 Ovidiu Predescu <ovidiu@net-community.com>
Bug fixes for NSForm and NSFormCell from Benhur Stein
<Benhur-de-Oliveira.Stein@imag.fr>.
* Headers/gnustep/gui/NSFormCell.h: The text field cell is keeping the
value now not the title. Changed drawInteriorWithFrame:inView: to
drawWithFrame:inView:.
* Source/NSForm.m: Likewise.
* Source/NSFormCell.m: Likewise.
(drawInteriorWithFrame:inView:): Changed to drawWithFrame:inView:.
* Source/NSCell.m (init): Make a text cell by default.
(_init): Invoke super's init.
* Source/NSView.m (opaqueAncestor): Implemented.
(visibleRect): Intersect the super view's visible rectangle with the
receiver's bounds instead of the receiver's frame.
* GNUmakefile: Fixed typo.
* Source/GNUmakefile: Changed the name of the variables to work with
the new multi-library building capabilities of library.make.
Tue Oct 28 11:24:40 1997 Ovidiu Predescu <ovidiu@net-community.com>
* Makefile: Changed to GNUmakefile.

View file

@ -32,7 +32,7 @@ include $(GNUSTEP_SYSTEM_ROOT)/Makefiles/common.make
#
# The list of subproject directories
#
SUBPROJECTS = Source Images Tools
SUBPROJECTS = Source Images Testing
-include GNUmakefile.preamble

View file

@ -31,12 +31,10 @@
#include <AppKit/NSActionCell.h>
@class NSTextFieldCell;
@interface NSFormCell : NSActionCell <NSCoding>
{
float titleWidth;
NSTextFieldCell* textCell;
NSCell* titleCell;
}
//
@ -60,8 +58,8 @@
//
// Displaying
//
- (void)drawInteriorWithFrame:(NSRect)cellFrame
inView:(NSView*)controlView;
- (void)drawWithFrame:(NSRect)cellFrame
inView:(NSView*)controlView;
//
// NSCoding protocol

View file

@ -34,7 +34,7 @@ include ../Version
LIBRARY_NAME=libgnustep-gui
# The Objective-C source files to be compiled
OBJC_FILES = libgnustep-gui.m \
libgnustep-gui_OBJC_FILES = libgnustep-gui.m \
NSActionCell.m \
NSApplication.m \
NSBitmapImageRep.m \
@ -104,10 +104,10 @@ tiff.m \
externs.m
# NSPasteboard.m
HEADER_FILES_DIR = ../Headers
HEADER_FILES_INSTALL_DIR = /gnustep/gui
libgnustep-gui_HEADER_FILES_DIR = ../Headers
libgnustep-gui_HEADER_FILES_INSTALL_DIR = /gnustep/gui
HEADER_FILES = \
libgnustep-gui_HEADER_FILES = \
AppKit/AppKit.h \
AppKit/NSActionCell.h \
AppKit/NSApplication.h \

View file

@ -70,6 +70,7 @@
//
- _init
{
self = [super init];
cell_type = NSNullCellType;
cell_image = nil;
cell_font = nil;
@ -92,9 +93,7 @@
- init
{
self = [super init];
[self _init];
return self;
return [self initTextCell:@""];
}
- (id)initImageCell:(NSImage *)anImage

View file

@ -64,8 +64,13 @@ static Class defaultCellClass = nil;
- (NSFormCell*)insertEntry:(NSString*)title
atIndex:(int)index
{
NSFormCell *new_cell = [[[isa cellClass] alloc] initTextCell:title];
[self insertRow:index];
return [self cellAtRow:index column:0];
[self putCell:new_cell atRow:index column:0];
[new_cell release];
return new_cell;
}
- (void)removeEntryAtIndex:(int)index

View file

@ -37,40 +37,47 @@
- init
{
self = [super init];
[self setBordered:NO];
[self setBezeled:NO];
return [self initTextCell:@"Field:"];
}
- initTextCell: (NSString *)aString
{
self = [super initTextCell:@""];
[self setBordered:YES];
[self setBezeled:YES];
[self setAlignment:NSLeftTextAlignment];
titleWidth = -1;
textCell = [NSTextFieldCell new];
[textCell setBordered:YES];
[textCell setBezeled:YES];
titleCell = [[NSCell alloc] initTextCell:aString];
[titleCell setBordered:NO];
[titleCell setBezeled:NO];
[titleCell setAlignment:NSRightTextAlignment];
return self;
}
- (void)dealloc
{
[textCell release];
[titleCell release];
[super dealloc];
}
- (BOOL)isOpaque
{
return [super isOpaque] && [textCell isOpaque];
return [super isOpaque] && [titleCell isOpaque];
}
- (void)setTitle:(NSString*)aString
{
[self setStringValue:aString];
[titleCell setStringValue:aString];
}
- (void)setTitleAlignment:(NSTextAlignment)mode
{
[self setAlignment:mode];
[titleCell setAlignment:mode];
}
- (void)setTitleFont:(NSFont*)fontObject
{
[self setFont:fontObject];
[titleCell setFont:fontObject];
}
- (void)setTitleWidth:(float)width
@ -80,23 +87,23 @@
- (NSString*)title
{
return [self stringValue];
return [titleCell stringValue];
}
- (NSTextAlignment)titleAlignment
{
return [self alignment];
return [titleCell alignment];
}
- (NSFont*)titleFont
{
return [self font];
return [titleCell font];
}
- (float)titleWidth
{
if (titleWidth < 0)
return [[self font] widthOfString:[self title]];
return [[titleCell font] widthOfString:[self title]];
else
return titleWidth;
}
@ -107,20 +114,17 @@
return 0;
}
- (void)drawInteriorWithFrame:(NSRect)cellFrame
- (void)drawWithFrame:(NSRect)cellFrame
inView:(NSView*)controlView
{
NSRect titleRect = cellFrame;
NSRect textRect;
NSRect titleFrame;
NSRect textFrame;
titleRect.size.width = [self titleWidth] + 4;
[super drawInteriorWithFrame:titleRect inView:controlView];
NSDivideRect(cellFrame, &titleFrame, &textFrame,
[self titleWidth] + 4, NSMinXEdge);
textRect.origin.x = cellFrame.origin.x + titleRect.size.width;
textRect.origin.y = cellFrame.origin.y;
textRect.size.width = cellFrame.size.width - titleRect.size.width;
textRect.size.height = cellFrame.size.height;
[textCell drawInteriorWithFrame:textRect inView:controlView];
[titleCell drawWithFrame:titleFrame inView:controlView];
[super drawWithFrame:textFrame inView:controlView];
}
- (void)encodeWithCoder:aCoder

View file

@ -259,7 +259,10 @@ static NSRecursiveLock *gnustep_gui_nsview_lock = nil;
- (NSView *)opaqueAncestor
{
return nil;
if ([self isOpaque] || !super_view)
return self;
else
return [super_view opaqueAncestor];
}
- (void)removeFromSuperview
@ -833,7 +836,7 @@ static NSRecursiveLock *gnustep_gui_nsview_lock = nil;
NSRect superviewsVisibleRect
= [self convertRect:[super_view visibleRect] fromView:super_view];
return NSIntersectionRect (superviewsVisibleRect, frame);
return NSIntersectionRect (superviewsVisibleRect, bounds);
}
}