mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 09:31:19 +00:00
* 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:
parent
08e26e278c
commit
3803d50e89
3 changed files with 157 additions and 153 deletions
|
@ -1,4 +1,10 @@
|
||||||
<<<<<<< ChangeLog
|
<<<<<<< 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>
|
Weds July 29 1998 Felipe A. Rodriguez <far@ix.netcom.com>
|
||||||
|
|
||||||
* NSMatrix.m in mouseDown adjusted the selection process when in List mode
|
* NSMatrix.m in mouseDown adjusted the selection process when in List mode
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
Author: Scott Christley <scottc@net-community.com>
|
Author: Scott Christley <scottc@net-community.com>
|
||||||
Date: 1996
|
Date: 1996
|
||||||
|
Author: Felipe A. Rodriguez <far@ix.netcom.com>
|
||||||
|
Date: July 1998
|
||||||
|
|
||||||
This file is part of the GNUstep GUI Library.
|
This file is part of the GNUstep GUI Library.
|
||||||
|
|
||||||
|
@ -73,6 +75,7 @@ enum {
|
||||||
BOOL is_vertically_resizable;
|
BOOL is_vertically_resizable;
|
||||||
BOOL is_ruler_visible;
|
BOOL is_ruler_visible;
|
||||||
BOOL is_field_editor;
|
BOOL is_field_editor;
|
||||||
|
BOOL draws_background;
|
||||||
NSColor *background_color;
|
NSColor *background_color;
|
||||||
NSColor *text_color;
|
NSColor *text_color;
|
||||||
NSFont *default_font;
|
NSFont *default_font;
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
Author: Scott Christley <scottc@net-community.com>
|
Author: Scott Christley <scottc@net-community.com>
|
||||||
Date: 1996
|
Date: 1996
|
||||||
|
Author: Felipe A. Rodriguez <far@ix.netcom.com>
|
||||||
|
Date: July 1998
|
||||||
|
|
||||||
This file is part of the GNUstep GUI Library.
|
This file is part of the GNUstep GUI Library.
|
||||||
|
|
||||||
|
@ -50,10 +52,7 @@
|
||||||
+ (void)initialize
|
+ (void)initialize
|
||||||
{
|
{
|
||||||
if (self == [NSText class])
|
if (self == [NSText class])
|
||||||
{
|
[self setVersion:1]; // Initial version
|
||||||
// Initial version
|
|
||||||
[self setVersion:1];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -66,7 +65,7 @@
|
||||||
{
|
{
|
||||||
[super initWithFrame:frameRect];
|
[super initWithFrame:frameRect];
|
||||||
|
|
||||||
text_contents = @"Field";
|
text_contents = @"Mary had a little lamb";
|
||||||
alignment = NSLeftTextAlignment;
|
alignment = NSLeftTextAlignment;
|
||||||
is_editable = YES;
|
is_editable = YES;
|
||||||
is_rich_text = NO;
|
is_rich_text = NO;
|
||||||
|
@ -77,9 +76,11 @@
|
||||||
is_vertically_resizable = YES;
|
is_vertically_resizable = YES;
|
||||||
is_ruler_visible = NO;
|
is_ruler_visible = NO;
|
||||||
is_field_editor = NO;
|
is_field_editor = NO;
|
||||||
|
draws_background = YES;
|
||||||
background_color = [NSColor whiteColor];
|
background_color = [NSColor whiteColor];
|
||||||
text_color = [NSColor blackColor];
|
text_color = [NSColor blackColor];
|
||||||
default_font = [NSFont userFontOfSize:12];
|
default_font = [NSFont userFontOfSize:12];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,12 +94,10 @@
|
||||||
//
|
//
|
||||||
// Getting and Setting Contents
|
// Getting and Setting Contents
|
||||||
//
|
//
|
||||||
- (void)replaceRange:(NSRange)range
|
- (void)replaceRange:(NSRange)range withRTF:(NSData *)rtfData
|
||||||
withRTF:(NSData *)rtfData
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
- (void)replaceRange:(NSRange)range
|
- (void)replaceRange:(NSRange)range withRTFD:(NSData *)rtfdData
|
||||||
withRTFD:(NSData *)rtfdData
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
- (NSData *)RTFDFromRange:(NSRange)range
|
- (NSData *)RTFDFromRange:(NSRange)range
|
||||||
|
@ -113,11 +112,10 @@
|
||||||
|
|
||||||
- (void)setText:(NSString *)string
|
- (void)setText:(NSString *)string
|
||||||
{
|
{
|
||||||
text_contents = string;
|
ASSIGN(text_contents, string);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setText:(NSString *)string
|
- (void)setText:(NSString *)string range:(NSRange)range
|
||||||
range:(NSRange)range
|
|
||||||
{
|
{
|
||||||
[self setSelectedRange:range];
|
[self setSelectedRange:range];
|
||||||
}
|
}
|
||||||
|
@ -137,7 +135,7 @@
|
||||||
|
|
||||||
- (BOOL)drawsBackground
|
- (BOOL)drawsBackground
|
||||||
{
|
{
|
||||||
return YES;
|
return draws_background;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)importsGraphics
|
- (BOOL)importsGraphics
|
||||||
|
@ -166,14 +164,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setDrawsBackground:(BOOL)flag
|
- (void)setDrawsBackground:(BOOL)flag
|
||||||
{}
|
{
|
||||||
|
draws_background = flag;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)setEditable:(BOOL)flag
|
- (void)setEditable:(BOOL)flag
|
||||||
{
|
{
|
||||||
is_editable = flag;
|
is_editable = flag;
|
||||||
// If we are editable then we are selectable
|
if (flag) // If we are editable then we
|
||||||
if (flag)
|
is_selectable = YES; // are selectable
|
||||||
is_selectable = YES;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setImportsGraphics:(BOOL)flag
|
- (void)setImportsGraphics:(BOOL)flag
|
||||||
|
@ -189,9 +188,8 @@
|
||||||
- (void)setSelectable:(BOOL)flag
|
- (void)setSelectable:(BOOL)flag
|
||||||
{
|
{
|
||||||
is_selectable = flag;
|
is_selectable = flag;
|
||||||
// If we are not selectable then we must not be editable
|
if (!flag) // If we are not selectable
|
||||||
if (!flag)
|
is_editable = NO; // then we must not be editable
|
||||||
is_editable = NO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -216,8 +214,7 @@
|
||||||
ASSIGN(background_color, color);
|
ASSIGN(background_color, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setColor:(NSColor *)color
|
- (void)setColor:(NSColor *)color ofRange:(NSRange)range
|
||||||
ofRange:(NSRange)range
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,8 +222,7 @@
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setFont:(NSFont *)font
|
- (void)setFont:(NSFont *)font ofRange:(NSRange)range
|
||||||
ofRange:(NSRange)range
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,10 +293,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setMaxSize:(NSSize)newMaxSize
|
- (void)setMaxSize:(NSSize)newMaxSize
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
- (void)setMinSize:(NSSize)newMinSize
|
- (void)setMinSize:(NSSize)newMinSize
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
- (void)setVerticallyResizable:(BOOL)flag
|
- (void)setVerticallyResizable:(BOOL)flag
|
||||||
{
|
{
|
||||||
|
@ -427,34 +425,33 @@
|
||||||
//
|
//
|
||||||
- (void)mouseDown:(NSEvent *)theEvent
|
- (void)mouseDown:(NSEvent *)theEvent
|
||||||
{
|
{
|
||||||
// If not selectable then don't recognize the mouse down
|
if (!is_selectable) // If not selectable then don't
|
||||||
if (!is_selectable) return;
|
return; // recognize the mouse down
|
||||||
|
|
||||||
[[self window] makeFirstResponder:self];
|
[[self window] makeFirstResponder:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)mouseUp:(NSEvent *)theEvent
|
- (void)mouseUp:(NSEvent *)theEvent
|
||||||
{
|
{
|
||||||
// If not selectable then don't recognize the mouse up
|
if (!is_selectable) // If not selectable then don't
|
||||||
if (!is_selectable) return;
|
return; // recognize the mouse up
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)mouseMoved:(NSEvent *)theEvent
|
- (void)mouseMoved:(NSEvent *)theEvent
|
||||||
{
|
{
|
||||||
// If not selectable then don't recognize the mouse moved
|
if (!is_selectable) // If not selectable then don't
|
||||||
if (!is_selectable) return;
|
return; // recognize the mouse moved
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)keyDown:(NSEvent *)theEvent
|
- (void)keyDown:(NSEvent *)theEvent
|
||||||
{
|
{
|
||||||
// If not editable then don't recognize the key down
|
if (!is_editable) // If not editable then don't
|
||||||
if (!is_editable) return;
|
return; // recognize the key down
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)keyUp:(NSEvent *)theEvent
|
- (void)keyUp:(NSEvent *)theEvent
|
||||||
{
|
{
|
||||||
// If not editable then don't recognize the key up
|
if (!is_editable) // If not editable then don't
|
||||||
if (!is_editable) return;
|
return; // recognize the key up
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)acceptsFirstResponder
|
- (BOOL)acceptsFirstResponder
|
||||||
|
@ -468,14 +465,10 @@
|
||||||
- (BOOL)becomeFirstResponder
|
- (BOOL)becomeFirstResponder
|
||||||
{
|
{
|
||||||
if ([self isEditable])
|
if ([self isEditable])
|
||||||
{
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Managing the Delegate
|
// Managing the Delegate
|
||||||
|
@ -546,6 +539,7 @@
|
||||||
#else
|
#else
|
||||||
[aCoder encodeConditionalObject:delegate];
|
[aCoder encodeConditionalObject:delegate];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
[aCoder encodeObject: text_contents];
|
[aCoder encodeObject: text_contents];
|
||||||
[aCoder encodeValueOfObjCType: "I" at: &alignment];
|
[aCoder encodeValueOfObjCType: "I" at: &alignment];
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &is_editable];
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &is_editable];
|
||||||
|
@ -572,6 +566,7 @@
|
||||||
#else
|
#else
|
||||||
delegate = [aDecoder decodeObject];
|
delegate = [aDecoder decodeObject];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
text_contents = [aDecoder decodeObject];
|
text_contents = [aDecoder decodeObject];
|
||||||
[aDecoder decodeValueOfObjCType: "I" at: &alignment];
|
[aDecoder decodeValueOfObjCType: "I" at: &alignment];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &is_editable];
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &is_editable];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue