Add support for Thick/Thin/PaneSplitter NSSplitView settings

This commit is contained in:
Gregory John Casamento 2021-11-15 10:20:33 -05:00
parent 8ac4bf7547
commit 334e26eeb0
2 changed files with 29 additions and 13 deletions

View file

@ -1,3 +1,10 @@
2021-11-15 Gregory John Casamento <greg.casamento@gmail.com>
* Headers/AppKit/NSSplitView.h
* Source/NSSplitView.m: Incorporate and refactor changes to NSSplitView
to support Think, Thin, and PaneSplitter NSSplitViewDividerStyle
settings.
2021-11-15 Gregory John Casamento <greg.casamento@gmail.com>
* Source/NSView.m: Add cast to id in case nil is not "id". This

View file

@ -200,8 +200,8 @@ static NSNotificationCenter *nc = nil;
* It is only used in the non-live resize mode.
*/
- (BOOL) _drawHighlightedDividerWithSize: (NSRect) r
andOldSize: (NSRect) oldRect
isLit: (BOOL) lit
andOldSize: (NSRect) oldRect
isLit: (BOOL) lit
{
if (NSEqualRects(r, oldRect) == YES)
{
@ -1417,6 +1417,14 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
- (void) setDividerStyle: (NSSplitViewDividerStyle)dividerStyle
{
_dividerStyle = dividerStyle;
_dividerWidth = [self dividerThickness];
_draggedBarWidth = _dividerWidth + 2; // default bigger than dividerThickness
ASSIGN(_dividerColor, [NSColor controlShadowColor]);
ASSIGN(_dimpleImage, [NSImage imageNamed: @"common_Dimple"]);
_never_displayed_before = YES;
_is_pane_splitter = (dividerStyle == NSSplitViewDividerStylePaneSplitter);
[self setNeedsDisplay: YES];
}
@ -1483,14 +1491,12 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
[self setAutosaveName: [aDecoder decodeObjectForKey: @"NSAutosaveName"]];
}
_dividerWidth = [self dividerThickness];
_draggedBarWidth = 8; // default bigger than dividerThickness
ASSIGN(_dividerColor, [NSColor controlShadowColor]);
ASSIGN(_dimpleImage, [NSImage imageNamed: @"common_Dimple"]);
_never_displayed_before = YES;
_is_pane_splitter = YES;
if ([aDecoder containsValueForKey: @"NSDividerStyle"])
{
[self setDividerStyle: [aDecoder decodeIntegerForKey: @"NSDividerStyle"]];
}
[self setAutoresizesSubviews: YES];
while((subview = [en nextObject]) != nil)
{
[subview setAutoresizesSubviews: YES];
@ -1518,11 +1524,14 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
if (version >= 1)
{
decode_NSInteger(aDecoder, &_dividerStyle);
[self setDividerStyle: _dividerStyle];
}
_dividerWidth = [self dividerThickness];
_never_displayed_before = YES;
_draggedBarWidth = _dividerWidth + 2;
else
{
_dividerStyle = NSSplitViewDividerStyleThick;
}
[self setDividerStyle: _dividerStyle];
}
return self;