Remove GSXibInternal, since it is not needed for this PR. Make drawing method parameter types more explicit, correct delegate method name in NSOutlineView

This commit is contained in:
Gregory John Casamento 2024-04-22 04:33:38 -04:00
parent 48d031a14a
commit a11f562997
6 changed files with 24 additions and 92 deletions

View file

@ -249,10 +249,12 @@
@class NSColorWell;
@class NSImage;
@class NSMenuItemCell;
@class NSOutlineView;
@class NSPopUpButtonCell;
@class NSMenuView;
@class NSProgressIndicator;
@class NSTableHeaderCell;
@class NSTableView;
@class NSTabViewItem;
@class NSPathControl;
@class NSPathComponentCell;
@ -1337,15 +1339,15 @@ APPKIT_EXPORT_CLASS
- (void) drawTableViewRow: (NSInteger)rowIndex
clipRect: (NSRect)clipRect
inView: (NSView *)view;
inView: (NSTableView *)view;
- (void) drawCellViewRow: (NSInteger)rowIndex
clipRect: (NSRect)clipRect
inView: (id)v;
inView: (NSTableView *)v;
- (void) drawOutlineViewRow: (NSInteger)rowIndex
clipRect: (NSRect)clipRect
inView: (NSView *)view;
inView: (NSOutlineView *)view;
- (BOOL) isBoxOpaque: (NSBox *)box;

View file

@ -355,7 +355,6 @@ GSGormLoader.m \
GSGModelLoader.m \
GSNibLoader.m \
GSXibElement.m \
GSXibInternal.m \
GSXibLoader.m \
GSXibLoading.m \
GSXibKeyedUnarchiver.m \

View file

@ -58,6 +58,7 @@
#import "AppKit/NSTableColumn.h"
#import "AppKit/NSTableHeaderCell.h"
#import "AppKit/NSTableHeaderView.h"
#import "AppKit/NSTableView.h"
#import "AppKit/NSView.h"
#import "AppKit/NSTabView.h"
#import "AppKit/NSTabViewItem.h"
@ -3385,7 +3386,7 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
- (void) drawTableViewRow: (NSInteger)rowIndex
clipRect: (NSRect)clipRect
inView: (NSView *)view
inView: (NSTableView *)view
{
NSTableView *tableView = (NSTableView *)view;
// NSInteger numberOfRows = [tableView numberOfRows];
@ -3486,7 +3487,7 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
- (void) drawOutlineViewRow: (NSInteger)rowIndex
clipRect: (NSRect)clipRect
inView: (NSView *)view
inView: (NSOutlineView *)view
{
NSOutlineView *outlineView = (NSOutlineView *)view;
NSInteger numberOfColumns = [outlineView numberOfColumns];
@ -3633,7 +3634,7 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
- (void) drawCellViewRow: (NSInteger)rowIndex
clipRect: (NSRect)clipRect
inView: (id)v
inView: (NSTableView *)v
{
NSInteger numberOfColumns = [v numberOfColumns];
CGFloat *columnOrigins = [v _columnOrigins];
@ -3647,7 +3648,8 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
id delegate = [v delegate];
BOOL hasMethod = NO;
NSTableColumn *outlineTableColumn = nil;
NSOutlineView *ov = nil;
// If we have no data source, there is nothing to do...
if (dataSource == nil)
{
@ -3663,7 +3665,8 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
// Check the delegate method...
if ([v isKindOfClass: [NSOutlineView class]])
{
outlineTableColumn = [v outlineTableColumn];
ov = (NSOutlineView *)v;
outlineTableColumn = [ov outlineTableColumn];
hasMethod = [delegate respondsToSelector: @selector(outlineView:viewForTableColumn:item:)];
}
else if ([v isKindOfClass: [NSTableView class]])
@ -3708,8 +3711,8 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
if ([v isKindOfClass: [NSOutlineView class]])
{
id item = [v itemAtRow: rowIndex];
CGFloat indentationPerLevel = [v indentationPerLevel];
id item = [ov itemAtRow: rowIndex];
CGFloat indentationPerLevel = [ov indentationPerLevel];
if (tb == outlineTableColumn)
{
@ -3720,7 +3723,7 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
NSRect imageRect = NSZeroRect;
// display the correct arrow...
if ([v isItemExpanded: item])
if ([ov isItemExpanded: item])
{
image = [NSImage imageNamed: @"common_ArrowDownH"];
}
@ -3729,16 +3732,16 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
image = [NSImage imageNamed: @"common_ArrowRightH"];
}
if (![v isExpandable: item])
if (![ov isExpandable: item])
{
image = AUTORELEASE([[NSImage alloc] initWithSize: NSMakeSize(14.0,14.0)]);
}
level = [v levelForItem: item];
level = [ov levelForItem: item];
indentationFactor = indentationPerLevel * level;
imageView = [[NSImageView alloc] init];
[imageView setImage: image];
imageRect = [v frameOfOutlineCellAtRow: rowIndex];
imageRect = [ov frameOfOutlineCellAtRow: rowIndex];
/* Do not indent if the delegate set the image to nil. */
if ([imageView image])
@ -3748,7 +3751,7 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
// Place the image...
[imageView setFrame: imageRect];
[v addSubview: imageView];
[ov addSubview: imageView];
drawingRect.origin.x
+= indentationFactor + imageRect.size.width + 5;
@ -3768,7 +3771,7 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
{
if (hasMethod)
{
view = [delegate outlineView: v
view = [delegate outlineView: ov
viewForTableColumn: tb
item: item];
}
@ -3785,7 +3788,7 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
}
[paths setObject: view forKey: path];
[v addSubview: view];
[ov addSubview: view];
}
}
else if ([v isKindOfClass: [NSTableView class]])

View file

@ -1,42 +0,0 @@
/** -*- mode: ObjC -*-
<title>GSXibInternal</title>
<abstract>On macOS when a XIB is compiled it is broken into several
different NIB files representing different aspects of the data in
the XIB. This file is intended to implement a class which will allow
parts of the XIB which would be broken off into separate parts to be
loaded later on.</abstract>
Copyright (C) 2024 Free Software Foundation, Inc.
Author: Gregory John Casamento <greg.casamento@gmail.com>
Date: Mar 2024
This file is part of the GNU Objective C User Interface library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _GNUSTEP_H_GSXIBINTERNAL
#define _GNUSTEP_H_GSXIBINTERNAL
#import <Foundation/NSObject.h>
#import "GSXib5KeyedUnarchiver.h"
@interface GSXibInternal : NSObject
@end
#endif // _GNUSTEP_H_GSXIBINTERNAL

View file

@ -1,30 +0,0 @@
/** <title>GSXibInternal</title>
Copyright (C) 2024 Free Software Foundation, Inc.
Author: Gregory John Casamento <greg.casamento@gmail.com>
Date: Mar 2024
This file is part of the GNU Objective C User Interface Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#import "GSXibInternal.h"
@implementation GSXibInternal
@end

View file

@ -1688,9 +1688,9 @@ Also returns the child index relative to this parent. */
- (BOOL) _shouldSelectionChange
{
if ([_delegate respondsToSelector:
@selector (selectionShouldChangeInTableView:)] == YES)
@selector (selectionShouldChangeInOutlineView:)] == YES)
{
if ([_delegate selectionShouldChangeInTableView: self] == NO)
if ([_delegate selectionShouldChangeInOutlineView: self] == NO)
{
return NO;
}