mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 18:11:06 +00:00
commit
80140c6336
3 changed files with 80 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
2022-03-22 Riccardo Mottola <rm@gnu.org>
|
||||
|
||||
* Source/NSImageCell.m: subclass initImageCell, so that
|
||||
RefusesFirstResponder can be set, matching Mac.
|
||||
|
||||
2022-02-26 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* Source/NSPopUpButtonCell.m(setMenu:): Select the first item of
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<abstract>The image cell class</abstract>
|
||||
|
||||
Copyright (C) 1999, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2005-2022 Free Software Foundation, Inc.
|
||||
|
||||
Author: Jonathan Gapen <jagapen@smithlab.chem.wisc.edu>
|
||||
Date: 1999
|
||||
|
@ -51,7 +51,7 @@
|
|||
{
|
||||
if (self == [NSImageCell class])
|
||||
{
|
||||
[self setVersion: 1];
|
||||
[self setVersion: 2];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,15 @@
|
|||
return [self initImageCell: nil];
|
||||
}
|
||||
|
||||
- (id) initImageCell: (NSImage*)anImage
|
||||
{
|
||||
if (self = [super initImageCell: anImage])
|
||||
{
|
||||
[self setRefusesFirstResponder: YES];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) setImage:(NSImage *)anImage
|
||||
{
|
||||
[super setImage:anImage];
|
||||
|
@ -344,7 +353,13 @@ yBottomInRect(NSSize innerSize, NSRect outerRect, BOOL flipped)
|
|||
else
|
||||
{
|
||||
NSInteger tmp;
|
||||
|
||||
NSUInteger version = [aDecoder versionForClassName: @"NSImageCell"];
|
||||
|
||||
if (version == 1)
|
||||
{
|
||||
[self setRefusesFirstResponder: YES];
|
||||
}
|
||||
|
||||
decode_NSInteger(aDecoder, &tmp);
|
||||
_imageAlignment = tmp;
|
||||
decode_NSInteger(aDecoder, &tmp);
|
||||
|
|
57
Tests/gui/NSCell/properties.m
Normal file
57
Tests/gui/NSCell/properties.m
Normal file
|
@ -0,0 +1,57 @@
|
|||
#include "Testing.h"
|
||||
|
||||
#include <Foundation/NSAutoreleasePool.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
|
||||
#include <AppKit/NSApplication.h>
|
||||
#include <AppKit/NSCell.h>
|
||||
#include <AppKit/NSImageCell.h>
|
||||
#include <AppKit/NSActionCell.h>
|
||||
#include <AppKit/NSTextFieldCell.h>
|
||||
#include <AppKit/NSButtonCell.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
CREATE_AUTORELEASE_POOL(arp);
|
||||
NSImageCell *imgCell;
|
||||
NSActionCell *actCell;
|
||||
NSButtonCell *buttCell;
|
||||
NSTextFieldCell *tfCell;
|
||||
NSCell *cell;
|
||||
|
||||
START_SET("NSCell RefusesResponder")
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
[NSApplication sharedApplication];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
if ([[localException name] isEqualToString: NSInternalInconsistencyException ])
|
||||
SKIP("It looks like GNUstep backend is not yet installed")
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
|
||||
imgCell = [[NSImageCell alloc] initImageCell:nil];
|
||||
pass([imgCell refusesFirstResponder] == YES, "NSImageCell initImageCell refusesFirstResponder");
|
||||
|
||||
cell = [[NSCell alloc] initImageCell:nil];
|
||||
pass([cell refusesFirstResponder] == NO, "NSCell initImageCell refusesFirstResponder");
|
||||
|
||||
buttCell = [[NSButtonCell alloc] init];
|
||||
pass([buttCell refusesFirstResponder] == NO, "NSButtonCell init refusesFirstResponder");
|
||||
|
||||
tfCell = [[NSTextFieldCell alloc] initTextCell:@""];
|
||||
pass([tfCell refusesFirstResponder] == NO, "NSTextFieldCell initTextCell refusesFirstResponder");
|
||||
|
||||
actCell = [[NSActionCell alloc] init];
|
||||
pass([actCell refusesFirstResponder] == NO, "NSActionCell init refusesFirstResponder");
|
||||
|
||||
cell = [[NSCell alloc] init];
|
||||
pass([cell refusesFirstResponder] == NO, "NSCell init refusesFirstResponder");
|
||||
|
||||
END_SET("NSCell RefusesResponder")
|
||||
|
||||
DESTROY(arp);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue