* NSText in setText modified to use ASSIGN macro.

* NSText added draws_background ivar and implemented it's set method.
	* NSText reformatted code.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@2889 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
far 1998-08-01 15:41:49 +00:00
parent 08e26e278c
commit 3803d50e89
3 changed files with 157 additions and 153 deletions

View file

@ -1,4 +1,10 @@
<<<<<<< ChangeLog
Sat Aug 1 1998 Felipe A. Rodriguez <far@ix.netcom.com>
* NSText in setText modified to use ASSIGN macro.
* NSText added draws_background ivar and implemented it's set method.
* NSText reformatted code.
Weds July 29 1998 Felipe A. Rodriguez <far@ix.netcom.com>
* NSMatrix.m in mouseDown adjusted the selection process when in List mode

View file

@ -7,6 +7,8 @@
Author: Scott Christley <scottc@net-community.com>
Date: 1996
Author: Felipe A. Rodriguez <far@ix.netcom.com>
Date: July 1998
This file is part of the GNUstep GUI Library.
@ -73,6 +75,7 @@ enum {
BOOL is_vertically_resizable;
BOOL is_ruler_visible;
BOOL is_field_editor;
BOOL draws_background;
NSColor *background_color;
NSColor *text_color;
NSFont *default_font;

View file

@ -7,6 +7,8 @@
Author: Scott Christley <scottc@net-community.com>
Date: 1996
Author: Felipe A. Rodriguez <far@ix.netcom.com>
Date: July 1998
This file is part of the GNUstep GUI Library.
@ -50,10 +52,7 @@
+ (void)initialize
{
if (self == [NSText class])
{
// Initial version
[self setVersion:1];
}
[self setVersion:1]; // Initial version
}
//
@ -66,7 +65,7 @@
{
[super initWithFrame:frameRect];
text_contents = @"Field";
text_contents = @"Mary had a little lamb";
alignment = NSLeftTextAlignment;
is_editable = YES;
is_rich_text = NO;
@ -77,9 +76,11 @@
is_vertically_resizable = YES;
is_ruler_visible = NO;
is_field_editor = NO;
draws_background = YES;
background_color = [NSColor whiteColor];
text_color = [NSColor blackColor];
default_font = [NSFont userFontOfSize:12];
return self;
}
@ -93,12 +94,10 @@
//
// Getting and Setting Contents
//
- (void)replaceRange:(NSRange)range
withRTF:(NSData *)rtfData
- (void)replaceRange:(NSRange)range withRTF:(NSData *)rtfData
{}
- (void)replaceRange:(NSRange)range
withRTFD:(NSData *)rtfdData
- (void)replaceRange:(NSRange)range withRTFD:(NSData *)rtfdData
{}
- (NSData *)RTFDFromRange:(NSRange)range
@ -113,11 +112,10 @@
- (void)setText:(NSString *)string
{
text_contents = string;
ASSIGN(text_contents, string);
}
- (void)setText:(NSString *)string
range:(NSRange)range
- (void)setText:(NSString *)string range:(NSRange)range
{
[self setSelectedRange:range];
}
@ -137,7 +135,7 @@
- (BOOL)drawsBackground
{
return YES;
return draws_background;
}
- (BOOL)importsGraphics
@ -166,14 +164,15 @@
}
- (void)setDrawsBackground:(BOOL)flag
{}
{
draws_background = flag;
}
- (void)setEditable:(BOOL)flag
{
is_editable = flag;
// If we are editable then we are selectable
if (flag)
is_selectable = YES;
if (flag) // If we are editable then we
is_selectable = YES; // are selectable
}
- (void)setImportsGraphics:(BOOL)flag
@ -189,9 +188,8 @@
- (void)setSelectable:(BOOL)flag
{
is_selectable = flag;
// If we are not selectable then we must not be editable
if (!flag)
is_editable = NO;
if (!flag) // If we are not selectable
is_editable = NO; // then we must not be editable
}
//
@ -216,8 +214,7 @@
ASSIGN(background_color, color);
}
- (void)setColor:(NSColor *)color
ofRange:(NSRange)range
- (void)setColor:(NSColor *)color ofRange:(NSRange)range
{
}
@ -225,8 +222,7 @@
{
}
- (void)setFont:(NSFont *)font
ofRange:(NSRange)range
- (void)setFont:(NSFont *)font ofRange:(NSRange)range
{
}
@ -297,10 +293,12 @@
}
- (void)setMaxSize:(NSSize)newMaxSize
{}
{
}
- (void)setMinSize:(NSSize)newMinSize
{}
{
}
- (void)setVerticallyResizable:(BOOL)flag
{
@ -427,34 +425,33 @@
//
- (void)mouseDown:(NSEvent *)theEvent
{
// If not selectable then don't recognize the mouse down
if (!is_selectable) return;
if (!is_selectable) // If not selectable then don't
return; // recognize the mouse down
[[self window] makeFirstResponder:self];
}
- (void)mouseUp:(NSEvent *)theEvent
{
// If not selectable then don't recognize the mouse up
if (!is_selectable) return;
if (!is_selectable) // If not selectable then don't
return; // recognize the mouse up
}
- (void)mouseMoved:(NSEvent *)theEvent
{
// If not selectable then don't recognize the mouse moved
if (!is_selectable) return;
if (!is_selectable) // If not selectable then don't
return; // recognize the mouse moved
}
- (void)keyDown:(NSEvent *)theEvent
{
// If not editable then don't recognize the key down
if (!is_editable) return;
if (!is_editable) // If not editable then don't
return; // recognize the key down
}
- (void)keyUp:(NSEvent *)theEvent
{
// If not editable then don't recognize the key up
if (!is_editable) return;
if (!is_editable) // If not editable then don't
return; // recognize the key up
}
- (BOOL)acceptsFirstResponder
@ -468,14 +465,10 @@
- (BOOL)becomeFirstResponder
{
if ([self isEditable])
{
return YES;
}
else
{
return NO;
}
}
//
// Managing the Delegate
@ -546,6 +539,7 @@
#else
[aCoder encodeConditionalObject:delegate];
#endif
[aCoder encodeObject: text_contents];
[aCoder encodeValueOfObjCType: "I" at: &alignment];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &is_editable];
@ -572,6 +566,7 @@
#else
delegate = [aDecoder decodeObject];
#endif
text_contents = [aDecoder decodeObject];
[aDecoder decodeValueOfObjCType: "I" at: &alignment];
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &is_editable];