Merge pull request #74 from gnustep/NSGridView_NSStackView_branch

NSGridView branch
This commit is contained in:
Gregory Casamento 2021-03-29 10:12:05 -04:00 committed by GitHub
commit 72d9db4e4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 1563 additions and 6 deletions

View file

@ -115,6 +115,7 @@ NSFontManager.m \
NSFontPanel.m \
NSForm.m \
NSFormCell.m \
NSGridView.m \
NSGroupTouchBarItem.m \
NSMagnificationGestureRecognizer.m \
NSPanGestureRecognizer.m \
@ -445,6 +446,7 @@ NSGradient.h \
NSGroupTouchBarItem.h \
NSGlyphGenerator.h \
NSGraphicsContext.h \
NSGridView.h \
NSHelpPanel.h \
NSHelpManager.h \
NSImage.h \

View file

@ -41,6 +41,7 @@
#import "AppKit/NSCell.h"
#import "AppKit/NSClipView.h"
#import "AppKit/NSFormCell.h"
#import "AppKit/NSGridView.h"
#import "AppKit/NSImage.h"
#import "AppKit/NSMatrix.h"
#import "AppKit/NSMenu.h"
@ -201,7 +202,10 @@ static NSArray *XmlBoolDefaultYes = nil;
@"NSMutableArray", @"allowedToolbarItems",
@"NSMutableArray", @"defaultToolbarItems",
@"NSMutableArray", @"rowTemplates",
@"NSMutableArray", @"constraints",
@"NSMutableArray", @"constraints",
@"NSMutableArray", @"rows",
@"NSMutableArray", @"columns",
@"NSMutableArray", @"gridCells",
@"NSSegmentItem", @"segment",
@"NSCell", @"customCell",
@"NSCustomObject5", @"customObject",
@ -227,7 +231,8 @@ static NSArray *XmlBoolDefaultYes = nil;
RETAIN(ClassNamePrefixes);
XmlReferenceAttributes = [NSArray arrayWithObjects: @"headerView", @"initialItem",
@"selectedItem", @"firstItem", @"secondItem", nil];
@"selectedItem", @"firstItem", @"secondItem",
@"row", @"column", nil];
RETAIN(XmlReferenceAttributes);
XmlConnectionRecordTags = [NSArray arrayWithObjects: @"action", @"outlet", @"binding", nil];
@ -287,6 +292,24 @@ static NSArray *XmlBoolDefaultYes = nil;
@"string", @"NS.relative",
@"canPropagateSelectedChildViewControllerTitle",
@"NSTabViewControllerCanPropagateSelectedChildViewControllerTitle",
@"rowAlignment", @"NSGrid_alignment",
@"rowSpacing", @"NSGrid_rowSpacing",
@"columnSpacing", @"NSGrid_columnSpacing",
@"hidden", @"NSGrid_hidden",
@"leadingPadding", @"NSGrid_leadingPadding",
@"bottomPadding", @"NSGrid_bottomPadding",
@"trailingPadding", @"NSGrid_trailingPadding",
@"topPadding", @"NSGrid_topPadding",
@"width", @"NSGrid_width",
@"height", @"NSGrid_height",
@"xPlacement", @"NSGrid_xPlacement",
@"yPlacement", @"NSGrid_yPlacement",
@"rows", @"NSGrid_rows",
@"columns", @"NSGrid_columns",
@"gridCells", @"NSGrid_cells",
@"contentView", @"NSGrid_content",
@"row", @"NSGrid_owningRow",
@"column", @"NSGrid_owningColumn",
nil];
RETAIN(XmlKeyMapTable);
@ -335,6 +358,9 @@ static NSArray *XmlBoolDefaultYes = nil;
// decoding the integer flag masks...
XmlKeyToDecoderSelectorMap =
[NSDictionary dictionaryWithObjectsAndKeys:
@"decodeXPlacementForElement:", @"NSGrid_xPlacement",
@"decodeYPlacementForElement:", @"NSGrid_yPlacement",
@"decodeRowAlignmentForElement:", @"NSGrid_alignment",
@"decodeIntercellSpacingHeightForElement:", @"NSIntercellSpacingHeight",
@"decodeIntercellSpacingWidthForElement:", @"NSIntercellSpacingWidth",
@"decodeColumnAutoresizingStyleForElement:", @"NSColumnAutoresizingStyle",
@ -2917,6 +2943,79 @@ didStartElement: (NSString*)elementName
return num;
}
- (id) _decodePlacementForObject: (id)obj
{
NSGridRowAlignment alignment = NSGridCellPlacementNone;
if ([obj isEqualToString: @"inherited"])
{
alignment = NSGridCellPlacementInherited;
}
else if ([obj isEqualToString: @"leading"])
{
alignment = NSGridCellPlacementLeading;
}
else if ([obj isEqualToString: @"top"])
{
alignment = NSGridCellPlacementTop;
}
else if ([obj isEqualToString: @"trailing"])
{
alignment = NSGridCellPlacementTrailing;
}
else if ([obj isEqualToString: @"bottom"])
{
alignment = NSGridCellPlacementBottom;
}
else if ([obj isEqualToString: @"center"])
{
alignment = NSGridCellPlacementCenter;
}
else if ([obj isEqualToString: @"fill"])
{
alignment = NSGridCellPlacementFill;
}
else // if not specified then assume none...
{
alignment = NSGridCellPlacementNone;
}
return [NSNumber numberWithInteger: alignment];
}
- (id) decodeXPlacementForElement: (GSXibElement *)element
{
id obj = [element attributeForKey: @"xPlacement"];
return [self _decodePlacementForObject: obj];
}
- (id) decodeYPlacementForElement: (GSXibElement *)element
{
id obj = [element attributeForKey: @"yPlacement"];
return [self _decodePlacementForObject: obj];
}
- (id) decodeRowAlignmentForElement: (GSXibElement *)element
{
id obj = [element attributeForKey: @"rowAlignment"];
NSGridRowAlignment alignment = NSGridRowAlignmentNone;
if ([obj isEqualToString: @"inherited"])
{
alignment = NSGridRowAlignmentInherited;
}
else if ([obj isEqualToString: @"firstBaseline"])
{
alignment = NSGridRowAlignmentFirstBaseline;
}
else if ([obj isEqualToString: @"lastBaseline"])
{
alignment = NSGridRowAlignmentLastBaseline;
}
else
{
alignment = NSGridRowAlignmentNone;
}
return [NSNumber numberWithInteger: alignment];
}
- (id) objectForXib: (GSXibElement*)element
{
id object = [super objectForXib: element];

1241
Source/NSGridView.m Normal file

File diff suppressed because it is too large Load diff

View file

@ -842,6 +842,8 @@ NSString *NSTextInputContextKeyboardSelectionDidChangeNotification =
NSPasteboardTypeTextFinderOptionKey const NSTextFinderCaseInsensitiveKey = @"NSTextFinderCaseInsensitiveKey";
NSPasteboardTypeTextFinderOptionKey const NSTextFinderMatchingTypeKey = @"NSTextFinderMatchingTypeKey";
CGFloat const NSGridViewSizeForContent = 0.0;
extern void __objc_gui_force_linking (void);
void