1996-05-30 20:03:15 +00:00
|
|
|
/*
|
|
|
|
NSButtonCell.m
|
|
|
|
|
|
|
|
The button cell class
|
|
|
|
|
|
|
|
Copyright (C) 1996 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Author: Scott Christley <scottc@net-community.com>
|
1998-11-25 17:16:48 +00:00
|
|
|
Ovidiu Predescu <ovidiu@net-community.com>
|
1996-05-30 20:03:15 +00:00
|
|
|
Date: 1996
|
1998-08-30 16:06:47 +00:00
|
|
|
Author: Felipe A. Rodriguez <far@ix.netcom.com>
|
|
|
|
Date: August 1998
|
1996-05-30 20:03:15 +00:00
|
|
|
|
|
|
|
This file is part of the GNUstep GUI Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
1996-10-18 17:14:13 +00:00
|
|
|
License along with this library; see the file COPYING.LIB.
|
|
|
|
If not, write to the Free Software Foundation,
|
|
|
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1996-05-30 20:03:15 +00:00
|
|
|
*/
|
|
|
|
|
1997-09-23 22:43:24 +00:00
|
|
|
#include <gnustep/gui/config.h>
|
1996-05-30 20:03:15 +00:00
|
|
|
#include <Foundation/NSLock.h>
|
|
|
|
#include <Foundation/NSArray.h>
|
1997-08-18 17:10:23 +00:00
|
|
|
#include <Foundation/NSString.h>
|
1998-12-15 16:20:22 +00:00
|
|
|
#include <Foundation/NSException.h>
|
1997-08-18 17:10:23 +00:00
|
|
|
|
1997-02-18 00:29:25 +00:00
|
|
|
#include <AppKit/NSButtonCell.h>
|
|
|
|
#include <AppKit/NSButton.h>
|
|
|
|
#include <AppKit/NSWindow.h>
|
|
|
|
#include <AppKit/NSEvent.h>
|
|
|
|
#include <AppKit/NSApplication.h>
|
|
|
|
#include <AppKit/NSFont.h>
|
|
|
|
#include <AppKit/NSImage.h>
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
|
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
@implementation NSButtonCell
|
|
|
|
|
|
|
|
//
|
|
|
|
// Class methods
|
|
|
|
//
|
|
|
|
+ (void)initialize
|
|
|
|
{
|
1998-11-25 17:16:48 +00:00
|
|
|
if (self == [NSButtonCell class])
|
|
|
|
[self setVersion:1]; // Initial version
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Instance methods
|
|
|
|
//
|
1998-08-30 16:06:47 +00:00
|
|
|
- _init
|
|
|
|
{
|
1998-11-25 17:16:48 +00:00
|
|
|
cell_enabled = YES;
|
|
|
|
transparent = NO;
|
|
|
|
cell_bordered = YES;
|
|
|
|
showAltStateMask = NSNoCellMask; // configure as a NSMomentaryPushButton
|
|
|
|
highlightsByMask = NSPushInCellMask | NSChangeGrayCellMask;
|
|
|
|
delayInterval = 0.4;
|
|
|
|
repeatInterval = 0.075;
|
|
|
|
altContents = nil;
|
1998-08-30 16:06:47 +00:00
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
return self;
|
1998-08-30 16:06:47 +00:00
|
|
|
}
|
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
- init
|
|
|
|
{
|
1998-11-25 17:16:48 +00:00
|
|
|
[self initTextCell:@"Button"];
|
1998-08-30 16:06:47 +00:00
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
return self;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- initImageCell:(NSImage *)anImage
|
|
|
|
{
|
1998-11-25 17:16:48 +00:00
|
|
|
[super initImageCell:anImage];
|
1998-08-30 16:06:47 +00:00
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
contents = nil;
|
1998-08-30 16:06:47 +00:00
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
return [self _init];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- initTextCell:(NSString *)aString
|
|
|
|
{
|
1998-11-25 17:16:48 +00:00
|
|
|
[super initTextCell:aString];
|
1998-08-30 16:06:47 +00:00
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
return [self _init];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)dealloc
|
|
|
|
{
|
1998-11-25 17:16:48 +00:00
|
|
|
[altContents release];
|
|
|
|
[altImage release];
|
|
|
|
[keyEquivalent release];
|
|
|
|
[keyEquivalentFont release];
|
|
|
|
|
|
|
|
[super dealloc];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Setting the Titles
|
|
|
|
//
|
1998-11-25 17:16:48 +00:00
|
|
|
- (NSString *)title { return [self stringValue]; }
|
|
|
|
- (NSString *)alternateTitle { return altContents; }
|
|
|
|
- (void)setFont:(NSFont *)fontObject { [super setFont:fontObject]; }
|
|
|
|
|
|
|
|
- (void)setTitle:(NSString *)aString
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1998-11-25 17:16:48 +00:00
|
|
|
[self setStringValue:aString];
|
|
|
|
[self setState:[self state]]; // update our state
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setAlternateTitle:(NSString *)aString
|
|
|
|
{
|
1998-08-30 16:06:47 +00:00
|
|
|
NSString* _string = [aString copy];
|
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
ASSIGN(altContents, _string);
|
|
|
|
[self setState:[self state]]; // update our state
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Setting the Images
|
|
|
|
//
|
1998-11-25 17:16:48 +00:00
|
|
|
- (NSImage *)alternateImage { return altImage; }
|
|
|
|
- (NSCellImagePosition)imagePosition { return image_position; }
|
|
|
|
- (void)setAlternateImage:(NSImage *)anImage { ASSIGN(altImage, anImage); }
|
1996-05-30 20:03:15 +00:00
|
|
|
|
|
|
|
- (void)setImagePosition:(NSCellImagePosition)aPosition
|
|
|
|
{
|
1998-11-25 17:16:48 +00:00
|
|
|
image_position = aPosition;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Setting the Repeat Interval
|
|
|
|
//
|
1998-11-25 17:16:48 +00:00
|
|
|
- (void)getPeriodicDelay:(float *)delay interval:(float *)interval
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
1998-11-25 17:16:48 +00:00
|
|
|
*delay = delayInterval;
|
|
|
|
*interval = repeatInterval;
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
- (void)setPeriodicDelay:(float)delay interval:(float)interval
|
1997-08-05 21:50:10 +00:00
|
|
|
{
|
1998-11-25 17:16:48 +00:00
|
|
|
delayInterval = delay;
|
|
|
|
repeatInterval = interval;
|
|
|
|
[self setContinuous:YES];
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1998-12-15 16:20:22 +00:00
|
|
|
- (void) performClick: (id)sender
|
|
|
|
{
|
|
|
|
NSView *cv = [self controlView];
|
|
|
|
|
|
|
|
[self highlight: YES withFrame: [cv frame] inView: cv];
|
|
|
|
if (action && target)
|
|
|
|
{
|
|
|
|
NS_DURING
|
|
|
|
{
|
|
|
|
[(NSControl*)cv sendAction: action to: target];
|
|
|
|
}
|
|
|
|
NS_HANDLER
|
|
|
|
{
|
|
|
|
[self highlight: NO withFrame: [cv frame] inView: cv];
|
|
|
|
[localException raise];
|
|
|
|
}
|
|
|
|
NS_ENDHANDLER
|
|
|
|
}
|
|
|
|
[self highlight: NO withFrame: [cv frame] inView: cv];
|
|
|
|
}
|
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
//
|
|
|
|
// Setting the Key Equivalent
|
|
|
|
//
|
1998-12-15 16:20:22 +00:00
|
|
|
- (NSString*) keyEquivalent
|
|
|
|
{
|
|
|
|
return keyEquivalent;
|
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1998-12-15 16:20:22 +00:00
|
|
|
- (NSFont*) keyEquivalentFont
|
|
|
|
{
|
|
|
|
return keyEquivalentFont;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (unsigned int) keyEquivalentModifierMask
|
1998-11-25 17:16:48 +00:00
|
|
|
{
|
1998-12-15 16:20:22 +00:00
|
|
|
return keyEquivalentModifierMask;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1998-12-15 16:20:22 +00:00
|
|
|
- (void) setKeyEquivalent: (NSString*)key
|
1998-08-30 16:06:47 +00:00
|
|
|
{
|
1998-12-15 16:20:22 +00:00
|
|
|
if (keyEquivalent != key)
|
|
|
|
{
|
|
|
|
[keyEquivalent release];
|
|
|
|
keyEquivalent = [key copy];
|
|
|
|
}
|
1997-02-18 00:29:25 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1998-12-15 16:20:22 +00:00
|
|
|
- (void) setKeyEquivalentModifierMask: (unsigned int)mask
|
1997-02-18 00:29:25 +00:00
|
|
|
{
|
1998-12-15 16:20:22 +00:00
|
|
|
keyEquivalentModifierMask = mask;
|
1997-02-18 00:29:25 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1998-12-15 16:20:22 +00:00
|
|
|
- (void) setKeyEquivalentFont: (NSFont*)fontObj
|
1997-02-18 00:29:25 +00:00
|
|
|
{
|
1998-12-15 16:20:22 +00:00
|
|
|
ASSIGN(keyEquivalentFont, fontObj);
|
1997-02-18 00:29:25 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1998-12-15 16:20:22 +00:00
|
|
|
- (void) setKeyEquivalentFont: (NSString*)fontName size: (float)fontSize
|
1997-02-18 00:29:25 +00:00
|
|
|
{
|
1998-12-15 16:20:22 +00:00
|
|
|
ASSIGN(keyEquivalentFont, [NSFont fontWithName: fontName size: fontSize]);
|
1997-02-18 00:29:25 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Modifying Graphic Attributes
|
|
|
|
//
|
1998-11-25 17:16:48 +00:00
|
|
|
- (BOOL)isTransparent { return transparent; }
|
|
|
|
- (void)setTransparent:(BOOL)flag { transparent = flag; }
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
- (BOOL)isOpaque
|
|
|
|
{
|
|
|
|
return !transparent && [self isBordered];
|
1997-02-18 00:29:25 +00:00
|
|
|
}
|
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
//
|
|
|
|
// Modifying Graphic Attributes
|
|
|
|
//
|
1998-11-25 17:16:48 +00:00
|
|
|
- (int)highlightsBy { return highlightsByMask; }
|
|
|
|
- (void)setHighlightsBy:(int)mask { highlightsByMask = mask; }
|
|
|
|
- (void)setShowsStateBy:(int)mask { showAltStateMask = mask; }
|
1996-05-30 20:03:15 +00:00
|
|
|
|
|
|
|
|
1997-02-18 00:29:25 +00:00
|
|
|
- (void)setButtonType:(NSButtonType)buttonType
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1997-02-18 00:29:25 +00:00
|
|
|
[super setType:buttonType];
|
|
|
|
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
switch (buttonType)
|
|
|
|
{
|
1997-02-18 00:29:25 +00:00
|
|
|
case NSMomentaryLight:
|
|
|
|
[self setHighlightsBy:NSChangeBackgroundCellMask];
|
|
|
|
[self setShowsStateBy:NSNoCellMask];
|
|
|
|
break;
|
|
|
|
case NSMomentaryPushButton:
|
|
|
|
[self setHighlightsBy:NSPushInCellMask | NSChangeGrayCellMask];
|
|
|
|
[self setShowsStateBy:NSNoCellMask];
|
|
|
|
break;
|
|
|
|
case NSMomentaryChangeButton:
|
|
|
|
[self setHighlightsBy:NSContentsCellMask];
|
|
|
|
[self setShowsStateBy:NSNoCellMask];
|
|
|
|
break;
|
|
|
|
case NSPushOnPushOffButton:
|
|
|
|
[self setHighlightsBy:NSPushInCellMask | NSChangeGrayCellMask];
|
|
|
|
[self setShowsStateBy:NSChangeBackgroundCellMask];
|
|
|
|
break;
|
|
|
|
case NSOnOffButton:
|
|
|
|
[self setHighlightsBy:NSChangeBackgroundCellMask];
|
|
|
|
[self setShowsStateBy:NSChangeBackgroundCellMask];
|
|
|
|
break;
|
|
|
|
case NSToggleButton:
|
|
|
|
[self setHighlightsBy:NSPushInCellMask | NSContentsCellMask];
|
|
|
|
[self setShowsStateBy:NSContentsCellMask];
|
|
|
|
break;
|
|
|
|
case NSSwitchButton:
|
1997-02-18 18:45:16 +00:00
|
|
|
[self setHighlightsBy:NSContentsCellMask];
|
|
|
|
[self setShowsStateBy:NSContentsCellMask];
|
|
|
|
[self setImage:[NSImage imageNamed:@"common_SwitchOff"]];
|
|
|
|
[self setAlternateImage:[NSImage imageNamed:@"common_SwitchOn"]];
|
|
|
|
[self setImagePosition:NSImageLeft];
|
|
|
|
[self setAlignment:NSLeftTextAlignment];
|
|
|
|
break;
|
1997-02-18 00:29:25 +00:00
|
|
|
case NSRadioButton:
|
|
|
|
[self setHighlightsBy:NSContentsCellMask];
|
|
|
|
[self setShowsStateBy:NSContentsCellMask];
|
1997-02-18 18:45:16 +00:00
|
|
|
[self setImage:[NSImage imageNamed:@"common_RadioOff"]];
|
|
|
|
[self setAlternateImage:[NSImage imageNamed:@"common_RadioOn"]];
|
|
|
|
[self setImagePosition:NSImageLeft];
|
|
|
|
[self setAlignment:NSLeftTextAlignment];
|
1997-02-18 00:29:25 +00:00
|
|
|
break;
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
|
|
|
// update our state
|
|
|
|
[self setState:[self state]];
|
|
|
|
}
|
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
- (int)showsStateBy { return showAltStateMask; }
|
|
|
|
- (void)setIntValue:(int)anInt { [self setState:(anInt != 0)]; }
|
|
|
|
- (void)setFloatValue:(float)aFloat { [self setState:(aFloat != 0)]; }
|
|
|
|
- (void)setDoubleValue:(double)aDouble { [self setState:(aDouble != 0)]; }
|
|
|
|
- (int)intValue { return [self state]; }
|
|
|
|
- (float)floatValue { return [self state]; }
|
|
|
|
- (double)doubleValue { return [self state]; }
|
1997-02-18 00:29:25 +00:00
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
//
|
|
|
|
// Displaying
|
|
|
|
//
|
1998-11-25 17:16:48 +00:00
|
|
|
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1998-11-25 17:16:48 +00:00
|
|
|
control_view = controlView; // Save last view cell was drawn to
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1997-04-22 18:23:58 +00:00
|
|
|
- (id)copyWithZone:(NSZone*)zone
|
|
|
|
{
|
|
|
|
NSButtonCell* c = [super copyWithZone:zone];
|
|
|
|
|
1998-08-30 16:06:47 +00:00
|
|
|
c->altContents = [[altContents copy] retain];
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
if(altImage)
|
|
|
|
c->altImage = [altImage retain];
|
1998-08-30 16:06:47 +00:00
|
|
|
c->keyEquivalent = [[keyEquivalent copy] retain];
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
if(keyEquivalentFont)
|
|
|
|
c->keyEquivalentFont = [keyEquivalentFont retain];
|
1998-08-30 16:06:47 +00:00
|
|
|
c->keyEquivalentModifierMask = keyEquivalentModifierMask;
|
|
|
|
c->transparent = transparent;
|
1997-04-22 18:23:58 +00:00
|
|
|
c->highlightsByMask = highlightsByMask;
|
|
|
|
c->showAltStateMask = showAltStateMask;
|
|
|
|
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
//
|
|
|
|
// NSCoding protocol
|
|
|
|
//
|
|
|
|
- (void)encodeWithCoder:aCoder
|
|
|
|
{
|
|
|
|
[super encodeWithCoder:aCoder];
|
|
|
|
|
1996-07-11 00:59:30 +00:00
|
|
|
NSDebugLog(@"NSButtonCell: start encoding\n");
|
1997-02-18 00:29:25 +00:00
|
|
|
[aCoder encodeObject: altContents];
|
|
|
|
[aCoder encodeObject: altImage];
|
1996-05-30 20:03:15 +00:00
|
|
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &transparent];
|
1996-07-11 00:59:30 +00:00
|
|
|
NSDebugLog(@"NSButtonCell: finish encoding\n");
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- initWithCoder:aDecoder
|
|
|
|
{
|
|
|
|
[super initWithCoder:aDecoder];
|
|
|
|
|
1996-07-11 00:59:30 +00:00
|
|
|
NSDebugLog(@"NSButtonCell: start decoding\n");
|
1997-02-18 00:29:25 +00:00
|
|
|
altContents = [aDecoder decodeObject];
|
|
|
|
altImage = [aDecoder decodeObject];
|
1996-05-30 20:03:15 +00:00
|
|
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &transparent];
|
1996-07-11 00:59:30 +00:00
|
|
|
NSDebugLog(@"NSButtonCell: finish decoding\n");
|
1998-08-30 16:06:47 +00:00
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|