Skip to content

Commit

Permalink
Merge pull request #265 from gnustep/NSTableRowView_branch
Browse files Browse the repository at this point in the history
NSTableRowView class implementation
  • Loading branch information
gcasa authored Jun 17, 2024
2 parents c93ee13 + baca2ae commit 422649a
Show file tree
Hide file tree
Showing 8 changed files with 916 additions and 597 deletions.
19 changes: 18 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
2024-06-07 Gregory John Casamento <[email protected]>

* Headers/Additions/GNUstepGUI/GSTheme.h: Add new methods
for rendering view-based outline/table views.
* Headers/AppKit/NSTableRowView.h: Add implementation
* Headers/AppKit/NSTableView.h: Add references to
NSTableRowView.h
* Source/GSThemeDrawing.m: Factor out NSTableView and
NSOutlineView rendering so that GSThemeDrawing methods
are as minimal as possible.
* Source/NSOutlineView.m: Refactor to use new methods
to generate NSTableRowView when it is view-based.
* Source/NSTableRowView.m: Add implementation of
NSTableRowView implementation.
* Source/NSTableView.m: Update to use NSTableRowView
when it is view-based.

2024-06-05 Richard Frith-Macdonald <[email protected]>

* ChangeLog: Update for new release
Expand All @@ -20,7 +37,7 @@

2024-05-26 Fred Kiefer <[email protected]>

* ChangeLog: Update for new release
* ChangeLog: Update for new release
* ANNOUNCE:
* NEWS:
* Documentation/news.texi: Update of release notes for 0.31.0.
Expand Down
9 changes: 6 additions & 3 deletions Headers/Additions/GNUstepGUI/GSTheme.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@
@class NSPopUpButtonCell;
@class NSMenuView;
@class NSProgressIndicator;
@class NSTableColumn;
@class NSTableHeaderCell;
@class NSTableView;
@class NSTabViewItem;
Expand Down Expand Up @@ -1341,9 +1342,11 @@ APPKIT_EXPORT_CLASS
clipRect: (NSRect)clipRect
inView: (NSTableView *)view;

- (void) drawCellViewRow: (NSInteger)rowIndex
clipRect: (NSRect)clipRect
inView: (NSTableView *)v;
- (NSRect) drawOutlineCell: (NSTableColumn *)tb
outlineView: (NSOutlineView *)outlineView
item: (id)item
drawingRect: (NSRect)inputRect
rowIndex: (NSInteger)rowIndex;

- (void) drawOutlineViewRow: (NSInteger)rowIndex
clipRect: (NSRect)clipRect
Expand Down
83 changes: 78 additions & 5 deletions Headers/AppKit/NSTableRowView.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/* Definition of class NSTableRowView
Copyright (C) 2022 Free Software Foundation, Inc.
By: Gregory John Casamento <[email protected]>
Date: 03-09-2022
This file is part of the GNUstep 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.1 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; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Expand All @@ -25,7 +25,8 @@
#ifndef _NSTableRowView_h_GNUSTEP_GUI_INCLUDE
#define _NSTableRowView_h_GNUSTEP_GUI_INCLUDE

#import <AppKit/NSView.h>
#import <AppKit/NSTableView.h>
#import <AppKit/NSCell.h>

#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)

Expand All @@ -34,6 +35,78 @@ extern "C" {
#endif

@interface NSTableRowView : NSView
{
// Display style...
BOOL _emphasized;
NSBackgroundStyle _interiorBackgroundStyle;
BOOL _floating;

// Row selection...
BOOL _selected;
NSTableViewSelectionHighlightStyle _selectionHighlightStyle;

// Drag and Drop...
NSTableViewDraggingDestinationFeedbackStyle _draggingDestinationFeedbackStyle;
CGFloat _indentationForDropOperation;
BOOL _targetForDropOperation;

// Row grouping...
BOOL _groupRowStyle;
NSInteger _numberOfColumns;

// Overriding row view display characteristics...
NSColor *_backgroundColor;

BOOL _nextRowSelected;
BOOL _previousRowSelected;
}

- (BOOL) isEmphasized;
- (void) setEmphasized: (BOOL)flag;

- (NSBackgroundStyle) interiorBackgroundStyle;

- (BOOL) isFloating;
- (void) setFloating: (BOOL)flag;

- (BOOL) isSelected;
- (void) setSelected: (BOOL)flag;

- (NSTableViewSelectionHighlightStyle) selectionHighlightStyle;
- (void) setSelectionHighlightStyle: (NSTableViewSelectionHighlightStyle) selectionHighlightStyle;

- (NSTableViewDraggingDestinationFeedbackStyle) draggingDestinationFeedbackStyle;
- (void) setTableViewDraggingDestinationFeedbackStyle: (NSTableViewDraggingDestinationFeedbackStyle) draggingDestinationFeedbackStyle;

- (CGFloat) indentationForDropOperation;
- (void) setIndentationForDropOperation: (CGFloat)indentationForDropOperation;

- (BOOL) targetForDropOperation;
- (void) setTargetForDropOperation: (BOOL)flag;

- (BOOL) groupRowStyle;
- (void) setGroupRowStyle: (BOOL)flag;

- (NSInteger) numberOfColumns;

- (NSColor *) backgroundColor;
- (void) setBackgroundColor: (NSColor *)color;

- (void) drawBackgroundInRect: (NSRect)dirtyRect;

- (void) drawDraggingDestinationFeedbackInRect: (NSRect)dirtyRect;

- (void) drawSelectionInRect: (NSRect)dirtyRect;

- (void) drawSeparatorInRect: (NSRect)dirtyRect;

- (id) viewAtColumn: (NSInteger)column;

- (BOOL) isNextRowSelected;
- (void) setNextRowSelected: (BOOL)flag;

- (BOOL) isPreviousRowSelected;
- (void) setPreviousRowSelected: (BOOL)flag;

@end

Expand Down
14 changes: 14 additions & 0 deletions Headers/AppKit/NSTableView.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ typedef enum _NSTableViewRowSizeStyle
} NSTableViewRowSizeStyle;
#endif

#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
typedef enum _NSTableViewDraggingDestinationFeedbackStyle
{
NSTableViewDraggingDestinationFeedbackStyleNone = 0,
NSTableViewDraggingDestinationFeedbackStyleRegular,
NSTableViewDraggingDestinationFeedbackStyleSourceList,
NSTableViewDraggingDestinationFeedbackStyleGap,
} NSTableViewDraggingDestinationFeedbackStyle;
#endif

APPKIT_EXPORT_CLASS
@interface NSTableView : NSControl <NSUserInterfaceValidations>
Expand Down Expand Up @@ -195,6 +204,9 @@ APPKIT_EXPORT_CLASS
NSMapTable *_pathsToViews;
NSMutableDictionary *_registeredNibs;
NSMutableDictionary *_registeredViews;

/* NSTableRowView support */
NSMutableDictionary *_rowViews;
}

/* Data Source */
Expand Down Expand Up @@ -402,6 +414,8 @@ APPKIT_EXPORT_CLASS
- (void) removeRowsAtIndexes: (NSIndexSet*)indexes withAnimation: (NSTableViewAnimationOptions)animationOptions;
- (NSInteger) rowForView: (NSView*)view;
- (NSView *) makeViewWithIdentifier: (NSUserInterfaceItemIdentifier)identifier owner: (id)owner;
- (NSTableRowView *) rowViewAtRow: (NSInteger)row makeIfNecessary: (BOOL)flag;
- (NSView *) viewAtColumn: (NSInteger)column row: (NSInteger)row makeIfNecessary: (BOOL)flag;
#endif

#if OS_API_VERSION(MAC_OS_X_VERSION_10_8, GS_API_LATEST)
Expand Down
Loading

0 comments on commit 422649a

Please sign in to comment.