mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:50:48 +00:00
Some optms in init (with ivar change), bug fix for tracking mouse
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5695 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f9383496f8
commit
46a718fbfe
1 changed files with 44 additions and 45 deletions
|
@ -114,24 +114,24 @@ static NSColor *shadowCol;
|
||||||
|
|
||||||
- (id) initImageCell: (NSImage*)anImage
|
- (id) initImageCell: (NSImage*)anImage
|
||||||
{
|
{
|
||||||
[super init];
|
|
||||||
|
|
||||||
_cell.type = NSImageCellType;
|
_cell.type = NSImageCellType;
|
||||||
_cell_image = RETAIN(anImage);
|
_cell_image = RETAIN(anImage);
|
||||||
_cell.image_position = NSImageOnly;
|
_cell.image_position = NSImageOnly;
|
||||||
_cell_font = RETAIN([fontClass userFontOfSize: 0]);
|
_cell_font = RETAIN([fontClass userFontOfSize: 0]);
|
||||||
_cell.state = 0;
|
// Implicitly set by allocation:
|
||||||
_cell.is_highlighted = NO;
|
//
|
||||||
_cell.is_enabled = YES;
|
//_cell.is_disabled = NO;
|
||||||
_cell.is_editable = NO;
|
//_cell.state = 0;
|
||||||
_cell.is_bordered = NO;
|
//_cell.is_highlighted = NO;
|
||||||
_cell.is_bezeled = NO;
|
//_cell.is_editable = NO;
|
||||||
_cell.is_scrollable = NO;
|
//_cell.is_bordered = NO;
|
||||||
_cell.is_selectable = NO;
|
//_cell.is_bezeled = NO;
|
||||||
_cell.is_continuous = NO;
|
//_cell.is_scrollable = NO;
|
||||||
_cell.float_autorange = NO;
|
//_cell.is_selectable = NO;
|
||||||
_cell_float_left = 0;
|
//_cell.is_continuous = NO;
|
||||||
_cell_float_right = 0;
|
//_cell.float_autorange = NO;
|
||||||
|
//_cell_float_left = 0;
|
||||||
|
//_cell_float_right = 0;
|
||||||
_action_mask = NSLeftMouseUpMask;
|
_action_mask = NSLeftMouseUpMask;
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
@ -139,26 +139,26 @@ static NSColor *shadowCol;
|
||||||
|
|
||||||
- (id) initTextCell: (NSString*)aString
|
- (id) initTextCell: (NSString*)aString
|
||||||
{
|
{
|
||||||
[super init];
|
|
||||||
|
|
||||||
_cell.type = NSTextCellType;
|
_cell.type = NSTextCellType;
|
||||||
_cell_font = RETAIN([fontClass userFontOfSize: 0]);
|
_cell_font = RETAIN([fontClass userFontOfSize: 0]);
|
||||||
_contents = RETAIN(aString);
|
_contents = RETAIN(aString);
|
||||||
_cell.text_align = NSCenterTextAlignment;
|
_cell.text_align = NSCenterTextAlignment;
|
||||||
_cell_image = nil;
|
// Implicitly set by allocation:
|
||||||
_cell.image_position = NSNoImage;
|
//
|
||||||
_cell.state = 0;
|
//_cell_image = nil;
|
||||||
_cell.is_highlighted = NO;
|
//_cell.image_position = NSNoImage;
|
||||||
_cell.is_enabled = YES;
|
//_cell.is_disabled = NO;
|
||||||
_cell.is_editable = NO;
|
//_cell.state = 0;
|
||||||
_cell.is_bordered = NO;
|
//_cell.is_highlighted = NO;
|
||||||
_cell.is_bezeled = NO;
|
//_cell.is_editable = NO;
|
||||||
_cell.is_scrollable = NO;
|
//_cell.is_bordered = NO;
|
||||||
_cell.is_selectable = NO;
|
//_cell.is_bezeled = NO;
|
||||||
_cell.is_continuous = NO;
|
//_cell.is_scrollable = NO;
|
||||||
|
//_cell.is_selectable = NO;
|
||||||
|
//_cell.is_continuous = NO;
|
||||||
_cell.float_autorange = YES;
|
_cell.float_autorange = YES;
|
||||||
_cell_float_right = 6;
|
_cell_float_right = 6;
|
||||||
_cell_float_left = 0;
|
//_cell_float_left = 0;
|
||||||
_action_mask = NSLeftMouseUpMask;
|
_action_mask = NSLeftMouseUpMask;
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
@ -281,12 +281,12 @@ static NSColor *shadowCol;
|
||||||
*/
|
*/
|
||||||
- (BOOL) isEnabled
|
- (BOOL) isEnabled
|
||||||
{
|
{
|
||||||
return _cell.is_enabled;
|
return !_cell.is_disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setEnabled: (BOOL)flag
|
- (void) setEnabled: (BOOL)flag
|
||||||
{
|
{
|
||||||
_cell.is_enabled = flag;
|
_cell.is_disabled = !flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -294,7 +294,7 @@ static NSColor *shadowCol;
|
||||||
*/
|
*/
|
||||||
- (BOOL) acceptsFirstResponder
|
- (BOOL) acceptsFirstResponder
|
||||||
{
|
{
|
||||||
return _cell.is_enabled;
|
return !_cell.is_disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -483,10 +483,10 @@ static NSColor *shadowCol;
|
||||||
*/
|
*/
|
||||||
- (NSText*) setUpFieldEditorAttributes: (NSText*)textObject
|
- (NSText*) setUpFieldEditorAttributes: (NSText*)textObject
|
||||||
{
|
{
|
||||||
if (_cell.is_enabled)
|
if (_cell.is_disabled)
|
||||||
[textObject setTextColor: txtCol];
|
|
||||||
else
|
|
||||||
[textObject setTextColor: dtxtCol];
|
[textObject setTextColor: dtxtCol];
|
||||||
|
else
|
||||||
|
[textObject setTextColor: txtCol];
|
||||||
|
|
||||||
[textObject setFont: _cell_font];
|
[textObject setFont: _cell_font];
|
||||||
[textObject setAlignment: _cell.text_align];
|
[textObject setAlignment: _cell.text_align];
|
||||||
|
@ -626,10 +626,10 @@ static NSColor *shadowCol;
|
||||||
|
|
||||||
- (NSColor*) textColor
|
- (NSColor*) textColor
|
||||||
{
|
{
|
||||||
if (_cell.is_enabled)
|
if (_cell.is_disabled)
|
||||||
return txtCol;
|
|
||||||
else
|
|
||||||
return dtxtCol;
|
return dtxtCol;
|
||||||
|
else
|
||||||
|
return txtCol;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) _drawText: (NSString *) title inFrame: (NSRect) cellFrame
|
- (void) _drawText: (NSString *) title inFrame: (NSRect) cellFrame
|
||||||
|
@ -1016,8 +1016,8 @@ static NSColor *shadowCol;
|
||||||
{
|
{
|
||||||
NSDebugLog(@"NSCell point not in cell frame\n");
|
NSDebugLog(@"NSCell point not in cell frame\n");
|
||||||
|
|
||||||
pointIsInCell = NO; // Do we return now or keep tracking?
|
pointIsInCell = NO;
|
||||||
if (![[self class] prefersTrackingUntilMouseUp] && flag)
|
if (flag == NO)
|
||||||
{
|
{
|
||||||
NSDebugLog(@"NSCell return immediately\n");
|
NSDebugLog(@"NSCell return immediately\n");
|
||||||
done = YES;
|
done = YES;
|
||||||
|
@ -1055,13 +1055,12 @@ static NSColor *shadowCol;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tell ourselves to stop tracking
|
// Hook called when stop tracking
|
||||||
[self stopTracking: last_point
|
[self stopTracking: last_point
|
||||||
at: point
|
at: point
|
||||||
inView: controlView
|
inView: controlView
|
||||||
mouseIsUp: mouseWentUp];
|
mouseIsUp: mouseWentUp];
|
||||||
|
|
||||||
|
|
||||||
if (_cell.is_continuous)
|
if (_cell.is_continuous)
|
||||||
[NSEvent stopPeriodicEvents];
|
[NSEvent stopPeriodicEvents];
|
||||||
|
|
||||||
|
@ -1081,7 +1080,7 @@ static NSColor *shadowCol;
|
||||||
*/
|
*/
|
||||||
- (void) resetCursorRect: (NSRect)cellFrame inView: (NSView *)controlView
|
- (void) resetCursorRect: (NSRect)cellFrame inView: (NSView *)controlView
|
||||||
{
|
{
|
||||||
if (_cell.type == NSTextCellType && _cell.is_enabled == YES
|
if (_cell.type == NSTextCellType && _cell.is_disabled == NO
|
||||||
&& (_cell.is_selectable == YES || _cell.is_editable == YES))
|
&& (_cell.is_selectable == YES || _cell.is_editable == YES))
|
||||||
{
|
{
|
||||||
static NSCursor *c = nil;
|
static NSCursor *c = nil;
|
||||||
|
@ -1140,7 +1139,7 @@ static NSColor *shadowCol;
|
||||||
ASSIGN(c->_cell_font, _cell_font);
|
ASSIGN(c->_cell_font, _cell_font);
|
||||||
c->_cell.state = _cell.state;
|
c->_cell.state = _cell.state;
|
||||||
c->_cell.is_highlighted = _cell.is_highlighted;
|
c->_cell.is_highlighted = _cell.is_highlighted;
|
||||||
c->_cell.is_enabled = _cell.is_enabled;
|
c->_cell.is_disabled = _cell.is_disabled;
|
||||||
c->_cell.is_editable = _cell.is_editable;
|
c->_cell.is_editable = _cell.is_editable;
|
||||||
c->_cell.is_bordered = _cell.is_bordered;
|
c->_cell.is_bordered = _cell.is_bordered;
|
||||||
c->_cell.is_bezeled = _cell.is_bezeled;
|
c->_cell.is_bezeled = _cell.is_bezeled;
|
||||||
|
@ -1174,7 +1173,7 @@ static NSColor *shadowCol;
|
||||||
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &tmp_int];
|
||||||
flag = _cell.is_highlighted;
|
flag = _cell.is_highlighted;
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
flag = _cell.is_enabled;
|
flag = _cell.is_disabled;
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
flag = _cell.is_editable;
|
flag = _cell.is_editable;
|
||||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
@ -1216,7 +1215,7 @@ static NSColor *shadowCol;
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
_cell.is_highlighted = flag;
|
_cell.is_highlighted = flag;
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
_cell.is_enabled = flag;
|
_cell.is_disabled = flag;
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
_cell.is_editable = flag;
|
_cell.is_editable = flag;
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &flag];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue