Merge branch 'master' of github.com:gnustep/libs-gui into NSBrowser_bindings_branch

This commit is contained in:
Gregory John Casamento 2024-10-30 19:10:04 -04:00
commit 10256c9a60
10 changed files with 97 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2024-10-29 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSLayoutAnchor.h: Add missing include that is required after a change in base.
* Source/NSTableView.m: Forward declare new methods.
2024-08-29 Gregory John Casamento <greg.casamento@gmail.com>
* Source/NSBundleAdditions.m: Quick fix for .gorm loading

View file

@ -1569,6 +1569,12 @@ withRepeatedImage: (NSImage*)image
- (void) organizeMenu: (NSMenu *)menu
isHorizontal: (BOOL)horizontal;
/**
* Used by the theme to override the proposed menu visibility. The default
* implementation simply returns the proposed visibility unmodified.
*/
- (BOOL) proposedVisibility: (BOOL)visible
forMenu: (NSMenu *) menu;
@end
@interface GSTheme (OpenSavePanels)

View file

@ -167,6 +167,9 @@ enum {
NSCellHitTrackableArea = 4
};
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
typedef NSUInteger NSCellHitResult;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
enum {
@ -492,10 +495,17 @@ APPKIT_EXPORT_CLASS
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
- (NSBackgroundStyle)backgroundStyle;
- (void)setBackgroundStyle:(NSBackgroundStyle)backgroundStyle;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
- (NSCellHitResult)hitTestForEvent:(NSEvent *)event
inRect:(NSRect)cellFrame
ofView:(NSView *)controlView;
#else
- (NSUInteger)hitTestForEvent:(NSEvent *)event
inRect:(NSRect)cellFrame
ofView:(NSView *)controlView;
#endif
#endif
//
// Managing the Cursor

View file

@ -27,6 +27,7 @@
#import <AppKit/AppKitDefines.h>
#import <Foundation/NSObject.h>
#import <Foundation/NSGeometry.h>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)

View file

@ -418,5 +418,11 @@
[[menu menuRepresentation] update];
[menu sizeToFit];
}
- (BOOL) proposedVisibility: (BOOL)visible
forMenu: (NSMenu *) menu
{
return visible;
}
@end

View file

@ -1752,7 +1752,19 @@
}
if ([aDecoder containsValueForKey: @"NSAlternateContents"])
{
[self setAlternateTitle: [aDecoder decodeObjectForKey: @"NSAlternateContents"]];
id alternateContents = [aDecoder decodeObjectForKey: @"NSAlternateContents"];
if ([alternateContents isKindOfClass:[NSString class]])
{
[self setAlternateTitle:alternateContents];
}
else if ([alternateContents isKindOfClass:[NSImage class]])
{
[self setAlternateImage:alternateContents];
}
else
{
NSLog(@"Invalid class for NSAlternateContents: %@", [alternateContents class]);
}
}
if ([aDecoder containsValueForKey: @"NSButtonFlags"])
{

View file

@ -383,7 +383,8 @@ static BOOL menuBarVisible = YES;
- (BOOL) _isVisible
{
return [_aWindow isVisible] || [_bWindow isVisible];
BOOL isVisible = [_aWindow isVisible] || [_bWindow isVisible];
return [[GSTheme theme] proposedVisibility: isVisible forMenu: self];
}
- (BOOL) _isMain

View file

@ -162,6 +162,9 @@ typedef struct _tableViewFlags
- (BOOL) _isCellEditableColumn: (NSInteger)columnIndex
row: (NSInteger)rowIndex;
- (NSInteger) _numRows;
- (CGFloat*) _columnOrigins;
- (NSView*) _renderedViewForPath: (NSIndexPath*)path;
- (void) _setRenderedView: (NSView*)view forPath: (NSIndexPath*)path;
@end
@interface NSTableView (SelectionHelper)

View file

@ -0,0 +1,51 @@
#include "Testing.h"
#include <Foundation/NSAutoreleasePool.h>
#include <Foundation/NSValue.h>
#include "GSCodingFlags.h"
int main()
{
CREATE_AUTORELEASE_POOL(arp);
GSCellFlagsUnion mask = { { 0 } };
START_SET("GSCodingFlags GNUstep CellFlags Union")
// first make sure flags translate to values
mask.flags.state = 1;
mask.flags.selectable = 1;
mask.flags.scrollable = 1;
mask.flags.editable = 1;
mask.flags.continuous = 1;
mask.flags.useUserKeyEquivalent = 1;
mask.flags.truncateLastLine = 1;
#if GS_WORDS_BIGENDIAN == 1
pass(mask.value == 0b00010010000000000001110000001001, "mask.flags translates to mask.value");
#else
pass(mask.value == 0b10010000001110000000000001001000, "mask.flags translates to mask.value");
#endif
// reset mask
mask.value = 0;
mask.flags = (GSCellFlags){0};
// now make sure values translate to flags
#if GS_WORDS_BIGENDIAN == 1
mask.value = 0b00010010000000000001110000001001;
#else
mask.value = 0b10010000001110000000000001001000;
#endif
pass(mask.flags.state == 1, "state is correctly set");
pass(mask.flags.selectable == 1, "selectable is correctly set");
pass(mask.flags.scrollable == 1, "scrollable is correctly set");
pass(mask.flags.editable == 1, "editable is correctly set");
pass(mask.flags.continuous == 1, "continuous is correctly set");
pass(mask.flags.useUserKeyEquivalent == 1, "useUserKeyEquivalent is correctly set");
pass(mask.flags.truncateLastLine == 1, "truncateLastLine is correctly set");
END_SET("GSCodingFlags GNUstep CellFlags Union")
DESTROY(arp);
return 0;
}

View file