mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 16:10:48 +00:00
Merge pull request #69 from gnustep/NSSplitViewController_branch
NSSplitViewController branch implements NSSplitViewController, NSTabViewController, and NSPageController. Also makes the needed changes elsewhere.
This commit is contained in:
commit
641978c9c0
27 changed files with 1543 additions and 26 deletions
31
ChangeLog
31
ChangeLog
|
@ -1,8 +1,31 @@
|
|||
2020-07-20 Gregory John Casamento <greg.casamento@gmail.com>
|
||||
2020-07-28 Gregory John Casamento <greg.casamento@gmail.com>
|
||||
|
||||
* Source/NSAlert.m: Fix NSAlert to have an OK button if none other
|
||||
is specified. This appears to be the default behavior at this point
|
||||
according to testing on macOS.
|
||||
* Headers/AppKit/AppKit.h: Add includes for splitviewcontroller, pagecontroller and tabviewcontroller.
|
||||
* Headers/AppKit/NSPageController.h: Interface for page view controller
|
||||
* Headers/AppKit/NSSplitViewController.h: Interface for splitview controller
|
||||
* Headers/AppKit/NSSplitViewItem.h: Enhancements to splitview item to add logic for controller
|
||||
* Headers/AppKit/NSStoryboardSegue.h: Add methods to handle popovers
|
||||
* Headers/AppKit/NSTabViewController.h: Interface for tabViewController
|
||||
* Headers/AppKit/NSTabViewItem.h: methods to support NSViewController
|
||||
* Headers/AppKit/NSToolbar.h: Minor changes to support tabview controller
|
||||
* Headers/AppKit/NSViewController.h: Additional enum
|
||||
* MISSING: Remove implemented classes from list
|
||||
* Source/GNUmakefile: Add new classes
|
||||
* Source/GSStoryboardTransform.h: Additional methods on proxy
|
||||
* Source/GSStoryboardTransform.m: Additional methods on proxy
|
||||
* Source/GSThemeDrawing.m: minor changes
|
||||
* Source/GSXib5KeyedUnarchiver.m: Handle pagecontroller element, set certain things to true if abesnt
|
||||
* Source/NSPageController.m: Implementation of NSPageController
|
||||
* Source/NSSplitViewController.m: Implementation of NSSplitViewController
|
||||
* Source/NSSplitViewItem.m: Implementation
|
||||
* Source/NSStoryboardSegue.m: New methods for segue
|
||||
* Source/NSTabViewController.m: Implementation of NSTabViewController
|
||||
* Source/NSTabViewItem.m: New methods implementation
|
||||
* Source/NSTabView.m: Add methods to handle NSViewController changes
|
||||
* Source/NSViewController.m: New methods.
|
||||
* Source/NSView.m: Private methods to insert a view
|
||||
* Source/NSViewPrivate.h: Private method to insert view, declaration
|
||||
* Source/NSWindow.m: Minor fixes.
|
||||
|
||||
2020-07-19 Gregory John Casamento <greg.casamento@gmail.com>
|
||||
|
||||
|
|
|
@ -185,6 +185,7 @@
|
|||
#import <AppKit/NSMediaLibraryBrowserController.h>
|
||||
#import <AppKit/NSMovie.h>
|
||||
#import <AppKit/NSMovieView.h>
|
||||
#import <AppKit/NSPageController.h>
|
||||
#import <AppKit/NSPanGestureRecognizer.h>
|
||||
#import <AppKit/NSNib.h>
|
||||
#import <AppKit/NSNibControlConnector.h>
|
||||
|
@ -229,11 +230,14 @@
|
|||
#import <AppKit/NSStoryboardSegue.h>
|
||||
#import <AppKit/NSSeguePerforming.h>
|
||||
#import <AppKit/NSSwitch.h>
|
||||
#import <AppKit/NSSplitViewController.h>
|
||||
#import <AppKit/NSSplitViewItem.h>
|
||||
#import <AppKit/NSTableColumn.h>
|
||||
#import <AppKit/NSTableHeaderCell.h>
|
||||
#import <AppKit/NSTableHeaderView.h>
|
||||
#import <AppKit/NSTableView.h>
|
||||
#import <AppKit/NSTabView.h>
|
||||
#import <AppKit/NSTabViewController.h>
|
||||
#import <AppKit/NSTabViewItem.h>
|
||||
#import <AppKit/NSTextAlternatives.h>
|
||||
#import <AppKit/NSTextAttachment.h>
|
||||
|
|
101
Headers/AppKit/NSPageController.h
Normal file
101
Headers/AppKit/NSPageController.h
Normal file
|
@ -0,0 +1,101 @@
|
|||
/* Definition of class NSPageController
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento
|
||||
Date: 27-07-2020
|
||||
|
||||
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,
|
||||
Boston, MA 02110 USA.
|
||||
*/
|
||||
|
||||
#ifndef _NSPageController_h_GNUSTEP_GUI_INCLUDE
|
||||
#define _NSPageController_h_GNUSTEP_GUI_INCLUDE
|
||||
|
||||
#import <Foundation/NSGeometry.h>
|
||||
#import <AppKit/NSViewController.h>
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_8, GS_API_LATEST)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@class NSView, NSArray, NSMutableArray;
|
||||
@protocol NSPageControllerDelegate;
|
||||
|
||||
typedef NSString* NSPageControllerObjectIdentifier;
|
||||
|
||||
enum
|
||||
{
|
||||
NSPageControllerTransitionStyleStackHistory,
|
||||
NSPageControllerTransitionStyleStackBook,
|
||||
NSPageControllerTransitionStyleHorizontalStrip
|
||||
};
|
||||
typedef NSUInteger NSPageControllerTransitionStyle;
|
||||
|
||||
@interface NSPageController : NSViewController
|
||||
{
|
||||
NSPageControllerTransitionStyle _transitionStyle;
|
||||
id _delegate;
|
||||
NSMutableArray *_arrangedObjects;
|
||||
NSInteger _selectedIndex;
|
||||
NSViewController *_selectedViewController;
|
||||
}
|
||||
|
||||
// Set/Get properties
|
||||
- (NSPageControllerTransitionStyle) transitionStyle;
|
||||
- (void) setTransitionStyle: (NSPageControllerTransitionStyle)style;
|
||||
|
||||
- (id) delegate;
|
||||
- (void) setDelegate: (id)delegate;
|
||||
|
||||
- (NSArray *) arrangedObjects;
|
||||
- (void) setArrangedObjects: (NSArray *)array;
|
||||
|
||||
- (NSInteger) selectedIndex;
|
||||
- (void) setSelectedIndex: (NSInteger)index;
|
||||
|
||||
- (NSViewController *) selectedViewController;
|
||||
|
||||
// Handle page transitions
|
||||
- (void) navigateForwardToObject: (id)object;
|
||||
|
||||
- (void) completeTransition;
|
||||
|
||||
- (IBAction) navigateBack: (id)sender;
|
||||
- (IBAction) navigateForward: (id)sender;
|
||||
- (IBAction) takeSelectedIndexFrom: (id)sender; // uses integerValue from sender
|
||||
@end
|
||||
|
||||
@protocol NSPageControllerDelegate
|
||||
- (NSPageControllerObjectIdentifier) pageController: (NSPageController *)pageController identifierForObject: (id)object;
|
||||
- (NSViewController *) pageController: (NSPageController *)pageController viewControllerForIdentifier: (NSPageControllerObjectIdentifier)identifier;
|
||||
- (NSRect) pageController: (NSPageController *)pageController frameForObject: (id)object;
|
||||
- (void) pageController: (NSPageController *)pageController prepareViewController: (NSViewController *)viewController withObject: (id)object;
|
||||
- (void) pageController: (NSPageController *)pageController didTransitionToObject: (id)object;
|
||||
- (void) pageControllerWillStartLiveTransition: (NSPageController *)pageController;
|
||||
- (void) pageControllerDidEndLiveTransition: (NSPageController *)pageController;
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GS_API_MACOSX */
|
||||
|
||||
#endif /* _NSPageController_h_GNUSTEP_GUI_INCLUDE */
|
||||
|
78
Headers/AppKit/NSSplitViewController.h
Normal file
78
Headers/AppKit/NSSplitViewController.h
Normal file
|
@ -0,0 +1,78 @@
|
|||
/* Definition of class NSSplitViewController
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento
|
||||
Date: Mon 20 Jul 2020 12:55:02 AM EDT
|
||||
|
||||
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,
|
||||
Boston, MA 02110 USA.
|
||||
*/
|
||||
|
||||
#ifndef _NSSplitViewController_h_GNUSTEP_GUI_INCLUDE
|
||||
#define _NSSplitViewController_h_GNUSTEP_GUI_INCLUDE
|
||||
|
||||
#import <Foundation/NSGeometry.h>
|
||||
#import <AppKit/NSViewController.h>
|
||||
#import <AppKit/NSUserInterfaceValidation.h>
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@class NSSplitView, NSSplitViewItem, NSArray, NSMutableArray;
|
||||
|
||||
@interface NSSplitViewController : NSViewController
|
||||
{
|
||||
CGFloat _minimumThicknessForInlineSidebars;
|
||||
NSMutableArray *_splitViewItems;
|
||||
}
|
||||
|
||||
// return splitview...
|
||||
- (NSSplitView *) splitView;
|
||||
- (void) setSplitView: (NSSplitView *)splitView;
|
||||
- (NSSplitViewItem *) splitViewItemForViewController: (NSViewController *)vc;
|
||||
- (CGFloat) minimumThicknessForInlineSidebars;
|
||||
- (void) setMinimumThicknessForInlineSidebars: (CGFloat)value;
|
||||
|
||||
// manage splitview items...
|
||||
- (NSArray *) splitViewItems;
|
||||
- (void) setSplitViewItems: (NSArray *)items;
|
||||
- (void) addSplitViewItem: (NSSplitViewItem *)item;
|
||||
- (void) insertSplitViewItem: (NSSplitViewItem *)item atIndex: (NSInteger)index;
|
||||
- (void) removeSplitViewItem: (NSSplitViewItem *)item;
|
||||
|
||||
// instance methods...
|
||||
- (NSRect) splitView: (NSSplitView *)splitView additionalEffectiveRectOfDividerAtIndex: (NSInteger)dividerIndex;
|
||||
- (BOOL) splitView: (NSSplitView *)splitView canCollapseSubview: (NSView *)subview;
|
||||
- (NSRect) splitView: (NSSplitView *)splitView effectiveRect: (NSRect)proposedEffectiveRect
|
||||
forDrawnRect: (NSRect)drawnRect ofDividerAtIndex: (NSInteger)dividerIndex;
|
||||
- (BOOL) splitView: (NSSplitView *)splitView shouldCollapseSubview: (NSView *)subview
|
||||
forDoubleClickOnDividerAtIndex: (NSInteger)dividerIndex;
|
||||
- (BOOL) splitView: (NSSplitView *)splitView shouldHideDividerAtIndex: (NSInteger)dividerIndex;
|
||||
- (IBAction)toggleSidebar:(id)sender;
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GS_API_MACOSX */
|
||||
|
||||
#endif /* _NSSplitViewController_h_GNUSTEP_GUI_INCLUDE */
|
||||
|
119
Headers/AppKit/NSSplitViewItem.h
Normal file
119
Headers/AppKit/NSSplitViewItem.h
Normal file
|
@ -0,0 +1,119 @@
|
|||
/* Interface of class NSSplitViewItem
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento
|
||||
Date: Mon 20 Jul 2020 12:56:20 AM EDT
|
||||
|
||||
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,
|
||||
Boston, MA 02110 USA.
|
||||
*/
|
||||
|
||||
#ifndef _NSSplitViewItem_h_GNUSTEP_GUI_INCLUDE
|
||||
#define _NSSplitViewItem_h_GNUSTEP_GUI_INCLUDE
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <AppKit/AppKitDefines.h>
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
NSSplitViewItemBehaviorDefault,
|
||||
NSSplibViewItemBehaviorSidebar,
|
||||
NSSplitViewItemBehaviorContentList
|
||||
};
|
||||
typedef NSInteger NSSplitViewItemBehavior;
|
||||
|
||||
enum
|
||||
{
|
||||
NSSplitViewItemCollapseBehaviorDefault,
|
||||
NSSplitViewItemCollapseBehaviorPreferResizingSiblingsWithFixedSplitView,
|
||||
NSSplitViewItemCollapseBehaviorPreferResizingSplitViewWithFixedSiblings,
|
||||
NSSplitViewItemCollapseBehaviorUseConstraints
|
||||
};
|
||||
typedef NSInteger NSSplitViewItemCollapseBehavior;
|
||||
|
||||
enum
|
||||
{
|
||||
NSTitlebarSeparatorStyleAutomatic,
|
||||
NSTitlebarSeparatorStyleLine,
|
||||
NSTitlebarSeparatorStyleNone,
|
||||
NSTitlebarSeparatorStyleShadow
|
||||
};
|
||||
typedef NSInteger NSTitlebarSeparatorStyle;
|
||||
|
||||
@class NSViewController;
|
||||
|
||||
@interface NSSplitViewItem : NSObject <NSCoding>
|
||||
{
|
||||
CGFloat _automaticMaximumThickness;
|
||||
CGFloat _preferredThicknessFraction;
|
||||
CGFloat _minimumThickness;
|
||||
CGFloat _maximumThickness;
|
||||
BOOL _springLoaded;
|
||||
BOOL _allowsFullHeightLayout;
|
||||
BOOL _canCollapse;
|
||||
CGFloat /*NSLayoutPriority*/ _holdingPriority;
|
||||
NSSplitViewItemCollapseBehavior _collapseBehavior;
|
||||
NSViewController *_viewController;
|
||||
NSTitlebarSeparatorStyle _titlebarSeparatorStyle;
|
||||
}
|
||||
|
||||
+ (instancetype)contentListWithViewController:(NSViewController *)viewController;
|
||||
+ (instancetype)sidebarWithViewController:(NSViewController *)viewController;
|
||||
+ (instancetype)splitViewItemWithViewController:(NSViewController *)viewController;
|
||||
|
||||
- (CGFloat) automaticMaximumThickness;
|
||||
- (void) setAutomaticMaximumThickness: (CGFloat)f;
|
||||
- (CGFloat) preferredThicknessFraction;
|
||||
- (void) setPreferredThicknessFraction: (CGFloat)f;
|
||||
- (CGFloat) minimumThickness;
|
||||
- (void) setMinimumThickness: (CGFloat)f;
|
||||
- (CGFloat) maximumThickness;
|
||||
- (void) setMaximumThickness: (CGFloat)f;
|
||||
|
||||
- (/* NSLayoutPriority */ CGFloat) holdingPriority;
|
||||
|
||||
- (BOOL) canCollapse;
|
||||
- (NSSplitViewItemCollapseBehavior) collapseBehavior;
|
||||
- (BOOL) isSpringLoaded;
|
||||
- (void) setSpringLoaded: (BOOL)flag;
|
||||
|
||||
- (BOOL) allowsFullHeightLayout;
|
||||
- (void) setAllowsFullHeightLayout: (BOOL)flag;
|
||||
|
||||
- (NSTitlebarSeparatorStyle) titlebarSeparatorStyle;
|
||||
- (void) setTitlebarSeparatorStyle: (NSTitlebarSeparatorStyle)style;
|
||||
|
||||
- (NSViewController *) viewController;
|
||||
- (void) setViewController: (NSViewController *)vc;
|
||||
@end
|
||||
|
||||
APPKIT_EXPORT const CGFloat NSSplitViewItemUnspecifiedDimension;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GS_API_MACOSX */
|
||||
|
||||
#endif /* _NSSplitViewItem_h_GNUSTEP_GUI_INCLUDE */
|
||||
|
|
@ -26,6 +26,8 @@
|
|||
#define _NSStoryboardSegue_h_GNUSTEP_GUI_INCLUDE
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <Foundation/NSGeometry.h>
|
||||
#import <AppKit/NSPopover.h>
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
|
||||
|
||||
|
@ -44,6 +46,9 @@ DEFINE_BLOCK_TYPE_NO_ARGS(GSStoryboardSeguePerformHandler, void);
|
|||
NSStoryboardSegueIdentifier _identifier;
|
||||
NSString *_kind;
|
||||
NSString *_relationship;
|
||||
id _popoverAnchorView;
|
||||
NSPopoverBehavior _popoverBehavior;
|
||||
NSRectEdge _preferredEdge;
|
||||
GSStoryboardSeguePerformHandler _handler;
|
||||
}
|
||||
|
||||
|
|
101
Headers/AppKit/NSTabViewController.h
Normal file
101
Headers/AppKit/NSTabViewController.h
Normal file
|
@ -0,0 +1,101 @@
|
|||
/* Definition of class NSTabViewController
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento
|
||||
Date: 23-07-2020
|
||||
|
||||
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,
|
||||
Boston, MA 02110 USA.
|
||||
*/
|
||||
|
||||
#ifndef _NSTabViewController_h_GNUSTEP_GUI_INCLUDE
|
||||
#define _NSTabViewController_h_GNUSTEP_GUI_INCLUDE
|
||||
|
||||
#import <AppKit/NSViewController.h>
|
||||
#import <AppKit/NSToolbar.h>
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@class NSArray, NSTabViewItem, NSTabView, NSMutableArray;
|
||||
|
||||
enum
|
||||
{
|
||||
NSTabViewControllerTabStyleSegmentedControlOnTop,
|
||||
NSTabViewControllerTabStyleSegmentedControlOnBottom,
|
||||
NSTabViewControllerTabStyleToolbar,
|
||||
NSTabViewControllerTabStyleUnspecified
|
||||
};
|
||||
typedef NSUInteger NSTabViewControllerTabStyle;
|
||||
|
||||
@interface NSTabViewController : NSViewController
|
||||
{
|
||||
NSTabViewControllerTabStyle _tabStyle;
|
||||
NSViewControllerTransitionOptions _transitionOptions;
|
||||
BOOL _canPropagateSelectedChildViewControllerTitle;
|
||||
}
|
||||
|
||||
- (NSTabViewControllerTabStyle) tabStyle;
|
||||
- (void) setTabStyle: (NSTabViewControllerTabStyle)ts;
|
||||
|
||||
- (NSTabView *) tabView;
|
||||
- (void) setTabView: (NSTabView *)tv;
|
||||
|
||||
- (NSViewControllerTransitionOptions) transitionOptions;
|
||||
- (void) setTransitionOptions: (NSViewControllerTransitionOptions)options;
|
||||
|
||||
- (BOOL) canPropagateSelectedChildViewControllerTitle;
|
||||
- (void) setCanPropagateSelectedChildViewControllerTitle: (BOOL)flag;
|
||||
|
||||
// Managing tabViewItems...
|
||||
- (NSArray *) tabViewItems;
|
||||
- (void) setTabViewItems: (NSArray *)items;
|
||||
- (NSTabViewItem *) tabViewItemForViewController: (NSViewController *)controller;
|
||||
- (void) addTabViewItem: (NSTabViewItem *)item;
|
||||
- (void) insertTabViewItem: (NSTabViewItem *)item
|
||||
atIndex: (NSInteger)index;
|
||||
- (void) removeTabViewItem: (NSTabViewItem *)item;
|
||||
- (NSInteger) selectedTabViewItemIndex;
|
||||
- (void) setSelectedTabViewItemIndex: (NSInteger)idx;
|
||||
|
||||
// Responding to tabview actions...
|
||||
- (BOOL)tabView:(NSTabView *)tabView
|
||||
shouldSelectTabViewItem:(NSTabViewItem *)tabViewItem;
|
||||
- (void)tabView:(NSTabView *)tabView
|
||||
willSelectTabViewItem:(NSTabViewItem *)tabViewItem;
|
||||
- (void)tabView:(NSTabView *)tabView
|
||||
didSelectTabViewItem:(NSTabViewItem *)tabViewItem;
|
||||
|
||||
// Responding to toolbar actions...
|
||||
- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar
|
||||
itemForItemIdentifier:(NSToolbarItemIdentifier)itemIdentifier
|
||||
willBeInsertedIntoToolbar:(BOOL)flag;
|
||||
- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar;
|
||||
- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar;
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GS_API_MACOSX */
|
||||
|
||||
#endif /* _NSTabViewController_h_GNUSTEP_GUI_INCLUDE */
|
||||
|
|
@ -41,6 +41,7 @@ typedef enum {
|
|||
@class NSColor;
|
||||
@class NSTabView;
|
||||
@class NSView;
|
||||
@class NSViewController;
|
||||
|
||||
@interface NSTabViewItem : NSObject <NSCoding>
|
||||
{
|
||||
|
@ -53,7 +54,9 @@ typedef enum {
|
|||
NSTabView *_tabview;
|
||||
NSRect _rect; // cached
|
||||
NSString *_toolTip;
|
||||
NSViewController *_viewController;
|
||||
}
|
||||
|
||||
- (id) initWithIdentifier:(id)identifier;
|
||||
|
||||
- (void)setIdentifier:(id)identifier;
|
||||
|
@ -78,6 +81,13 @@ typedef enum {
|
|||
- (void)drawLabel:(BOOL)shouldTruncateLabel
|
||||
inRect:(NSRect)tabRect;
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
|
||||
- (NSViewController *) viewController;
|
||||
- (void) setViewController: (NSViewController *)vc;
|
||||
|
||||
+ (instancetype) tabViewItemWithViewController: (NSViewController *)vc;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
||||
- (NSString *)toolTip;
|
||||
- (void)setToolTip:(NSString *)newToolTip;
|
||||
|
|
|
@ -72,6 +72,8 @@ typedef enum
|
|||
APPKIT_EXPORT NSString *NSToolbarDidRemoveItemNotification;
|
||||
APPKIT_EXPORT NSString *NSToolbarWillAddItemNotification;
|
||||
|
||||
typedef NSString* NSToolbarItemIdentifier;
|
||||
|
||||
@interface NSToolbar : NSObject
|
||||
{
|
||||
NSDictionary *_configurationDictionary;
|
||||
|
|
|
@ -34,6 +34,22 @@ Boston, MA 02110-1301, USA.
|
|||
|
||||
@class NSArray, NSBundle, NSPointerArray, NSView, NSMapTable, NSStoryboard;
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
|
||||
enum
|
||||
{
|
||||
NSViewControllerTransitionNone = 0x0,
|
||||
NSViewControllerTransitionCrossfade = 0x1,
|
||||
NSViewControllerTransitionSlideUp = 0x10,
|
||||
NSViewControllerTransitionSlideDown = 0x20,
|
||||
NSViewControllerTransitionSlideLeft = 0x40,
|
||||
NSViewControllerTransitionSlideRight = 0x80,
|
||||
NSViewControllerTransitionSlideForward = 0x140,
|
||||
NSViewControllerTransitionSlideBackward = 0x180,
|
||||
NSViewControllerTransitionAllowUserInteraction = 0x1000,
|
||||
};
|
||||
typedef NSUInteger NSViewControllerTransitionOptions;
|
||||
#endif
|
||||
|
||||
@interface NSViewController : NSResponder <NSSeguePerforming>
|
||||
{
|
||||
@private
|
||||
|
|
4
MISSING
4
MISSING
|
@ -20,14 +20,10 @@ MISSING HEADERS
|
|||
> NSLayoutGuide.h
|
||||
> NSMenuToolbarItem.h
|
||||
> NSOpenGLLayer.h
|
||||
> NSPageController.h
|
||||
> NSRuleEditor.h
|
||||
> NSSliderAccessory.h
|
||||
> NSSplitViewController.h
|
||||
> NSSplitViewItem.h
|
||||
> NSStackView.h
|
||||
> NSStatusBarButton.h
|
||||
> NSTabViewController.h
|
||||
> NSTableCellView.h
|
||||
> NSTableRowView.h
|
||||
> NSTableViewRowAction.h
|
||||
|
|
|
@ -185,6 +185,7 @@ NSOpenGLPixelFormat.m \
|
|||
NSOpenGLView.m \
|
||||
NSOpenPanel.m \
|
||||
NSOutlineView.m \
|
||||
NSPageController.m \
|
||||
NSPageLayout.m \
|
||||
NSPanel.m \
|
||||
NSPanGestureRecognizer.m \
|
||||
|
@ -239,12 +240,15 @@ NSSpeechSynthesizer.m \
|
|||
NSStepperTouchBarItem.m \
|
||||
NSSpellChecker.m \
|
||||
NSSplitView.m \
|
||||
NSSplitViewController.m \
|
||||
NSSplitViewItem.m \
|
||||
NSStepper.m \
|
||||
NSStepperCell.m \
|
||||
NSStringDrawing.m \
|
||||
NSStatusBar.m \
|
||||
NSStatusItem.m \
|
||||
NSTabView.m \
|
||||
NSTabViewController.m \
|
||||
NSTabViewItem.m \
|
||||
NSTableColumn.m \
|
||||
NSTableHeaderView.m \
|
||||
|
@ -461,6 +465,7 @@ NSOpenPanel.h \
|
|||
NSOpenGL.h \
|
||||
NSOpenGLView.h \
|
||||
NSOutlineView.h \
|
||||
NSPageController.h \
|
||||
NSPageLayout.h \
|
||||
NSPanel.h \
|
||||
NSPanGestureRecognizer.h \
|
||||
|
@ -521,6 +526,8 @@ NSSpeechSynthesizer.h \
|
|||
NSSpellChecker.h \
|
||||
NSSpellServer.h \
|
||||
NSSplitView.h \
|
||||
NSSplitViewController.h \
|
||||
NSSplitViewItem.h \
|
||||
NSStepper.h \
|
||||
NSStepperCell.h \
|
||||
NSStepperTouchBarItem.h \
|
||||
|
@ -532,6 +539,7 @@ NSStatusBar.h \
|
|||
NSStatusItem.h \
|
||||
NSSwitch.h \
|
||||
NSTabView.h \
|
||||
NSTabViewController.h \
|
||||
NSTabViewItem.h \
|
||||
NSTableColumn.h \
|
||||
NSTableHeaderCell.h \
|
||||
|
|
|
@ -66,6 +66,7 @@ extern "C" {
|
|||
id _sender;
|
||||
NSString *_identifier;
|
||||
NSString *_kind;
|
||||
id _popoverAnchorView;
|
||||
NSStoryboardSegue *_storyboardSegue;
|
||||
NSStoryboard *_storyboard;
|
||||
}
|
||||
|
@ -88,6 +89,9 @@ extern "C" {
|
|||
- (NSString *) kind;
|
||||
- (void) setKind: (NSString *)kind;
|
||||
|
||||
- (void) setPopoverAnchorView: (id)view;
|
||||
- (id) popoverAnchorView;
|
||||
|
||||
- (NSStoryboard *) storyboard;
|
||||
- (void) setStoryboard: (NSStoryboard *)storyboard;
|
||||
|
||||
|
|
|
@ -54,9 +54,15 @@
|
|||
@interface NSStoryboardSegue (__StoryboardPrivate__)
|
||||
// Private to this class...
|
||||
- (void) _setKind: (NSString *)k;
|
||||
- (void) _setRelationship: (NSString *)r;
|
||||
- (NSString *) _kind;
|
||||
- (void) _setRelationship: (NSString *)r;
|
||||
- (NSString *) _relationship;
|
||||
- (void) _setPopoverAnchorView: (id)view;
|
||||
- (id) _popoverAnchorView;
|
||||
- (void) _setPopoverBehavior: (NSPopoverBehavior)behavior;
|
||||
- (NSPopoverBehavior) _popoverBehavior;
|
||||
- (void) _setPreferredEdge: (NSRectEdge)edge;
|
||||
- (NSRectEdge) _preferredEdge;
|
||||
@end
|
||||
|
||||
// this needs to be set on segues
|
||||
|
@ -66,20 +72,50 @@
|
|||
ASSIGN(_kind, k);
|
||||
}
|
||||
|
||||
- (void) _setRelationship: (NSString *)r
|
||||
{
|
||||
ASSIGN(_relationship, r);
|
||||
}
|
||||
|
||||
- (NSString *) _kind
|
||||
{
|
||||
return _kind;
|
||||
}
|
||||
|
||||
- (void) _setRelationship: (NSString *)r
|
||||
{
|
||||
ASSIGN(_relationship, r);
|
||||
}
|
||||
|
||||
- (NSString *) _relationship
|
||||
{
|
||||
return _relationship;
|
||||
}
|
||||
|
||||
- (void) _setPopoverAnchorView: (id)view
|
||||
{
|
||||
ASSIGN(_popoverAnchorView, view);
|
||||
}
|
||||
|
||||
- (id) _popoverAnchorView
|
||||
{
|
||||
return _popoverAnchorView;
|
||||
}
|
||||
|
||||
- (void) _setPopoverBehavior: (NSPopoverBehavior)behavior
|
||||
{
|
||||
_popoverBehavior = behavior;
|
||||
}
|
||||
|
||||
- (NSPopoverBehavior) _popoverBehavior
|
||||
{
|
||||
return _popoverBehavior;
|
||||
}
|
||||
|
||||
- (void) _setPreferredEdge: (NSRectEdge)edge
|
||||
{
|
||||
_preferredEdge = edge;
|
||||
}
|
||||
|
||||
- (NSRectEdge) _preferredEdge
|
||||
{
|
||||
return _preferredEdge;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation NSStoryboardSeguePerformAction
|
||||
|
@ -143,6 +179,16 @@
|
|||
ASSIGN(_kind, kind);
|
||||
}
|
||||
|
||||
- (void) setPopoverAnchorView: (id)view
|
||||
{
|
||||
ASSIGN(_popoverAnchorView, view);
|
||||
}
|
||||
|
||||
- (id) popoverAnchorView
|
||||
{
|
||||
return _popoverAnchorView;
|
||||
}
|
||||
|
||||
- (NSStoryboard *) storyboard
|
||||
{
|
||||
return _storyboard;
|
||||
|
@ -168,6 +214,7 @@
|
|||
RELEASE(_storyboard);
|
||||
RELEASE(_kind);
|
||||
RELEASE(_identifier);
|
||||
RELEASE(_popoverAnchorView);
|
||||
RELEASE(_sender);
|
||||
RELEASE(_storyboardSegue);
|
||||
[super dealloc];
|
||||
|
@ -217,6 +264,7 @@
|
|||
[pa setSelector: [self selector]];
|
||||
[pa setSender: _sender];
|
||||
[pa setIdentifier: _identifier];
|
||||
[pa setPopoverAnchorView: _popoverAnchorView];
|
||||
[pa setStoryboardSegue: _storyboardSegue];
|
||||
[pa setStoryboard: _storyboard];
|
||||
return pa;
|
||||
|
@ -247,6 +295,10 @@
|
|||
{
|
||||
[self setKind: [coder decodeObjectForKey: @"NSKind"]];
|
||||
}
|
||||
if ([coder containsValueForKey: @"NSPopoverAnchorView"])
|
||||
{
|
||||
[self setPopoverAnchorView: [coder decodeObjectForKey: @"NSPopoverAnchorView"]];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -476,8 +528,10 @@
|
|||
NSString *xmlClassName = [NSString stringWithFormat: @"%@%@",
|
||||
[[classNameNoNamespace substringToIndex: 1] lowercaseString],
|
||||
[classNameNoNamespace substringFromIndex: 1]];
|
||||
NSString *lowerCaseName = [xmlClassName lowercaseString];
|
||||
|
||||
[result addObject: xmlClassName];
|
||||
[result addObject: lowerCaseName];
|
||||
}
|
||||
END_FOR_IN(subclasses);
|
||||
|
||||
|
@ -650,6 +704,7 @@
|
|||
segueIdentifier: (NSString *)ident
|
||||
sender: (NSString *)src
|
||||
kind: (NSString *)kind
|
||||
anchorView: (NSString *)anchorView
|
||||
{
|
||||
NSXMLElement *sbproxy = [NSXMLElement elementWithName: @"storyboardSeguePerformAction"];
|
||||
|
||||
|
@ -672,6 +727,9 @@
|
|||
NSXMLNode *pkind
|
||||
= [NSXMLNode attributeWithName: @"kind"
|
||||
stringValue: kind];
|
||||
NSXMLNode *panchorview
|
||||
= [NSXMLNode attributeWithName: @"popoverAnchorView"
|
||||
stringValue: anchorView];
|
||||
|
||||
[sbproxy addAttribute: pselector];
|
||||
[sbproxy addAttribute: ptarget];
|
||||
|
@ -679,6 +737,7 @@
|
|||
[sbproxy addAttribute: psegueIdent];
|
||||
[sbproxy addAttribute: psender];
|
||||
[sbproxy addAttribute: pkind];
|
||||
[sbproxy addAttribute: panchorview];
|
||||
|
||||
return sbproxy;
|
||||
}
|
||||
|
@ -706,7 +765,6 @@
|
|||
NSString *kind = [attr stringValue];
|
||||
attr = [obj attributeForName: @"relationship"];
|
||||
NSString *rel = [attr stringValue];
|
||||
[obj detach]; // segue can't be in the archive since it doesn't conform to NSCoding
|
||||
attr = [obj attributeForName: @"id"];
|
||||
NSString *uid = [attr stringValue];
|
||||
attr = [obj attributeForName: @"identifier"];
|
||||
|
@ -715,13 +773,52 @@
|
|||
{
|
||||
ident = [[NSUUID UUID] UUIDString];
|
||||
}
|
||||
attr = [obj attributeForName: @"popoverAnchorView"];
|
||||
NSString *av = [attr stringValue];
|
||||
attr = [obj attributeForName: @"popoverBehavior"];
|
||||
NSString *pb = [attr stringValue];
|
||||
NSPopoverBehavior behavior = NSPopoverBehaviorApplicationDefined;
|
||||
if ([pb isEqualToString: @"a"])
|
||||
{
|
||||
behavior = NSPopoverBehaviorApplicationDefined;
|
||||
}
|
||||
else if ([pb isEqualToString: @"t"])
|
||||
{
|
||||
behavior = NSPopoverBehaviorTransient;
|
||||
}
|
||||
else if ([pb isEqualToString: @"s"])
|
||||
{
|
||||
behavior = NSPopoverBehaviorSemitransient;
|
||||
}
|
||||
|
||||
attr = [obj attributeForName: @"preferredEdge"];
|
||||
NSString *pe = [attr stringValue];
|
||||
NSRectEdge edge = NSMinXEdge;
|
||||
if ([pe isEqualToString: @"maxY"])
|
||||
{
|
||||
edge = NSMaxYEdge;
|
||||
}
|
||||
else if ([pe isEqualToString: @"minY"])
|
||||
{
|
||||
edge = NSMinYEdge;
|
||||
}
|
||||
else if ([pe isEqualToString: @"maxX"])
|
||||
{
|
||||
edge = NSMaxXEdge;
|
||||
}
|
||||
else if ([pe isEqualToString: @"minX"])
|
||||
{
|
||||
edge = NSMinXEdge;
|
||||
}
|
||||
[obj detach]; // segue can't be in the archive since it doesn't conform to NSCoding
|
||||
|
||||
// Create proxy object to invoke methods on the window controller
|
||||
NSXMLElement *sbproxy = [self createStoryboardProxyElementWithSelector: @"doAction:"
|
||||
target: dst
|
||||
segueIdentifier: ident
|
||||
sender: src
|
||||
kind: kind];
|
||||
kind: kind
|
||||
anchorView: av];
|
||||
|
||||
NSUInteger count = [[objects children] count];
|
||||
[objects insertChild: sbproxy
|
||||
|
@ -754,7 +851,9 @@
|
|||
destination: dst];
|
||||
[ss _setKind: kind];
|
||||
[ss _setRelationship: rel];
|
||||
|
||||
[ss _setPopoverBehavior: behavior];
|
||||
[ss _setPreferredEdge: edge];
|
||||
|
||||
// Add to maptable...
|
||||
[mapTable setObject: ss
|
||||
forKey: ident];
|
||||
|
|
|
@ -2459,7 +2459,7 @@ typedef enum {
|
|||
[self drawTabViewBezelRect: aRect
|
||||
tabViewType: type
|
||||
inView: view];
|
||||
|
||||
|
||||
if (type == NSBottomTabsBezelBorder
|
||||
|| type == NSTopTabsBezelBorder)
|
||||
{
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
#import "AppKit/NSTabView.h"
|
||||
#import "AppKit/NSToolbarItem.h"
|
||||
#import "AppKit/NSView.h"
|
||||
#import "AppKit/NSPageController.h"
|
||||
#import "GSCodingFlags.h"
|
||||
|
||||
#define DEBUG_XIB5 0
|
||||
|
@ -208,6 +209,7 @@ static NSArray *XmlBoolDefaultYes = nil;
|
|||
@"NSView", @"tableCellView",
|
||||
@"IBUserDefinedRuntimeAttribute5", @"userDefinedRuntimeAttribute",
|
||||
@"NSURL", @"url",
|
||||
@"NSPageController", @"pagecontroller", // why is pagecontroller capitalized this way?
|
||||
nil];
|
||||
RETAIN(XmlTagToObjectClassMap);
|
||||
|
||||
|
@ -276,6 +278,8 @@ static NSArray *XmlBoolDefaultYes = nil;
|
|||
@"bordered", @"NSIsBordered",
|
||||
@"altersStateOfSelectedItem", @"NSAltersState",
|
||||
@"string", @"NS.relative",
|
||||
@"canPropagateSelectedChildViewControllerTitle",
|
||||
@"NSTabViewControllerCanPropagateSelectedChildViewControllerTitle",
|
||||
nil];
|
||||
RETAIN(XmlKeyMapTable);
|
||||
|
||||
|
@ -385,6 +389,7 @@ static NSArray *XmlBoolDefaultYes = nil;
|
|||
@"decodeToolbarImageForElement:", @"NSToolbarItemImage",
|
||||
@"decodeControlContentsForElement:", @"NSControlContents",
|
||||
@"decodePathStyle:", @"NSPathStyle",
|
||||
@"decodeTransitionStyle:", @"NSTransitionStyle",
|
||||
nil];
|
||||
RETAIN(XmlKeyToDecoderSelectorMap);
|
||||
|
||||
|
@ -395,6 +400,7 @@ static NSArray *XmlBoolDefaultYes = nil;
|
|||
@"prefersToBeShown",
|
||||
@"editable",
|
||||
@"enabled",
|
||||
@"canPropagateSelectedChildViewControllerTitle",
|
||||
nil];
|
||||
}
|
||||
}
|
||||
|
@ -2775,6 +2781,31 @@ didStartElement: (NSString*)elementName
|
|||
return num;
|
||||
}
|
||||
|
||||
- (id) decodeTransitionStyle: (GSXibElement *)element
|
||||
{
|
||||
NSNumber *num = [NSNumber numberWithInteger: 0];
|
||||
id obj = [element attributeForKey: @"transitionStyle"];
|
||||
|
||||
if ([obj isEqualToString: @"stackHistory"])
|
||||
{
|
||||
num = [NSNumber numberWithInteger: NSPageControllerTransitionStyleStackHistory];
|
||||
}
|
||||
else if ([obj isEqualToString: @"stackBook"])
|
||||
{
|
||||
num = [NSNumber numberWithInteger: NSPageControllerTransitionStyleStackBook];
|
||||
}
|
||||
else if ([obj isEqualToString: @"horizontalStrip"])
|
||||
{
|
||||
num = [NSNumber numberWithInteger: NSPageControllerTransitionStyleHorizontalStrip];
|
||||
}
|
||||
else // if not specified then assume standard...
|
||||
{
|
||||
num = [NSNumber numberWithInteger: NSPageControllerTransitionStyleStackHistory];
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
- (id) objectForXib: (GSXibElement*)element
|
||||
{
|
||||
id object = [super objectForXib: element];
|
||||
|
|
199
Source/NSPageController.m
Normal file
199
Source/NSPageController.m
Normal file
|
@ -0,0 +1,199 @@
|
|||
/* Implementation of class NSPageController
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento
|
||||
Date: 27-07-2020
|
||||
|
||||
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,
|
||||
Boston, MA 02110 USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSKeyValueObserving.h>
|
||||
#import <Foundation/NSArchiver.h>
|
||||
|
||||
#import "AppKit/NSPageController.h"
|
||||
#import "AppKit/NSView.h"
|
||||
|
||||
@implementation NSPageController
|
||||
|
||||
- (instancetype) init
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_transitionStyle = NSPageControllerTransitionStyleStackHistory;
|
||||
_delegate = nil;
|
||||
_arrangedObjects = [[NSMutableArray alloc] initWithCapacity: 10];
|
||||
_selectedIndex = 0;
|
||||
_selectedViewController = nil;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(_arrangedObjects);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (instancetype) initWithCoder: (NSCoder *)coder
|
||||
{
|
||||
self = [super initWithCoder: coder];
|
||||
if (self != nil)
|
||||
{
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
if ([coder containsValueForKey: @"NSTransitionStyle"])
|
||||
{
|
||||
_transitionStyle = [coder decodeIntForKey: @"NSTransitionStyle"];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[coder decodeValueOfObjCType: @encode(NSInteger)
|
||||
at: &_transitionStyle];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)coder
|
||||
{
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
[coder encodeInt: _transitionStyle
|
||||
forKey: @"NSTransitionStyle"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[coder encodeValueOfObjCType: @encode(NSInteger)
|
||||
at: &_transitionStyle];
|
||||
}
|
||||
}
|
||||
|
||||
// Set/Get properties
|
||||
- (NSPageControllerTransitionStyle) transitionStyle
|
||||
{
|
||||
return _transitionStyle;
|
||||
}
|
||||
|
||||
- (void) setTransitionStyle: (NSPageControllerTransitionStyle)style
|
||||
{
|
||||
_transitionStyle = style;
|
||||
}
|
||||
|
||||
- (id<NSPageControllerDelegate>) delegate
|
||||
{
|
||||
return _delegate;
|
||||
}
|
||||
|
||||
- (void) setDelegate: (id<NSPageControllerDelegate>)delegate
|
||||
{
|
||||
_delegate = delegate;
|
||||
}
|
||||
|
||||
- (NSArray *) arrangedObjects
|
||||
{
|
||||
return _arrangedObjects;
|
||||
}
|
||||
|
||||
- (void) setArrangedObjects: (NSArray *)array
|
||||
{
|
||||
[_arrangedObjects removeAllObjects];
|
||||
[_arrangedObjects addObjectsFromArray: array];
|
||||
}
|
||||
|
||||
- (NSInteger) selectedIndex
|
||||
{
|
||||
return _selectedIndex;
|
||||
}
|
||||
|
||||
- (void) setSelectedIndex: (NSInteger)index
|
||||
{
|
||||
if ([_delegate respondsToSelector: @selector(pageControllerWillStartLiveTransition:)])
|
||||
{
|
||||
[_delegate pageControllerWillStartLiveTransition: self];
|
||||
}
|
||||
[self willChangeValueForKey: @"selectedIndex"];
|
||||
_selectedIndex = index;
|
||||
_selectedViewController = [_arrangedObjects objectAtIndex: _selectedIndex];
|
||||
[self didChangeValueForKey: @"selectedIndex"];
|
||||
|
||||
// Complete...
|
||||
[self completeTransition];
|
||||
|
||||
// End transition...
|
||||
if ([_delegate respondsToSelector: @selector(pageControllerDidEndLiveTransition:)])
|
||||
{
|
||||
[_delegate pageControllerDidEndLiveTransition: self];
|
||||
}
|
||||
|
||||
// Notify delegate that transition is finished.
|
||||
if ([_delegate respondsToSelector: @selector(pageController:didTransitionToObject:)])
|
||||
{
|
||||
[_delegate pageController: self didTransitionToObject: _selectedViewController];
|
||||
}
|
||||
|
||||
// Resize based on frame...
|
||||
if ([_delegate respondsToSelector: @selector(pageController:frameForObject:)])
|
||||
{
|
||||
NSRect rect = [_delegate pageController: self frameForObject: _selectedViewController];
|
||||
[[_selectedViewController view] setFrame: rect];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSViewController *) selectedViewController
|
||||
{
|
||||
return _selectedViewController;
|
||||
}
|
||||
|
||||
// Handle page transitions
|
||||
- (void) navigateForwardToObject: (id)object
|
||||
{
|
||||
NSInteger index = [_arrangedObjects indexOfObject: object];
|
||||
[self setSelectedIndex: index];
|
||||
}
|
||||
|
||||
- (void) completeTransition
|
||||
{
|
||||
[self setView: [_selectedViewController view]];
|
||||
}
|
||||
|
||||
- (IBAction) navigateBack: (id)sender
|
||||
{
|
||||
NSInteger idx = [self selectedIndex] - 1;
|
||||
[self setSelectedIndex: (idx >= 0) ? idx : 0];
|
||||
}
|
||||
|
||||
- (IBAction) navigateForward: (id)sender
|
||||
{
|
||||
NSInteger idx = [self selectedIndex] + 1;
|
||||
NSInteger lastPage = ([_arrangedObjects count] - 1);
|
||||
[self setSelectedIndex: (idx > lastPage) ? lastPage : idx];
|
||||
}
|
||||
|
||||
- (IBAction) takeSelectedIndexFrom: (id)sender // uses integerValue from sender
|
||||
{
|
||||
if ([sender respondsToSelector: @selector(integerValue)])
|
||||
{
|
||||
NSInteger i = [sender integerValue];
|
||||
[self setSelectedIndex: i];
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
208
Source/NSSplitViewController.m
Normal file
208
Source/NSSplitViewController.m
Normal file
|
@ -0,0 +1,208 @@
|
|||
/* Implementation of class NSSplitViewController
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento
|
||||
Date: Mon 20 Jul 2020 12:55:02 AM EDT
|
||||
|
||||
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,
|
||||
Boston, MA 02110 USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSArchiver.h>
|
||||
|
||||
#import "AppKit/NSSplitView.h"
|
||||
#import "AppKit/NSSplitViewController.h"
|
||||
#import "AppKit/NSSplitViewItem.h"
|
||||
#import "AppKit/NSView.h"
|
||||
#import "NSViewPrivate.h"
|
||||
|
||||
#import "GSFastEnumeration.h"
|
||||
|
||||
@implementation NSSplitViewController
|
||||
// return splitview...
|
||||
- (NSSplitView *) splitView
|
||||
{
|
||||
return (NSSplitView *)[self view];
|
||||
}
|
||||
|
||||
- (void) setSplitView: (NSSplitView *)splitView
|
||||
{
|
||||
[self setView: splitView];
|
||||
[splitView setDelegate: self];
|
||||
}
|
||||
|
||||
- (NSSplitViewItem *) splitViewItemForViewController: (NSViewController *)vc
|
||||
{
|
||||
FOR_IN (NSSplitViewItem*, svi, _splitViewItems)
|
||||
if ([svi viewController] == vc)
|
||||
{
|
||||
return svi;
|
||||
}
|
||||
END_FOR_IN (_splitViewItems);
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (CGFloat) minimumThicknessForInlineSidebars
|
||||
{
|
||||
return _minimumThicknessForInlineSidebars;
|
||||
}
|
||||
|
||||
- (void) setMinimumThicknessForInlineSidebars: (CGFloat)value
|
||||
{
|
||||
_minimumThicknessForInlineSidebars = value;
|
||||
}
|
||||
|
||||
// manage splitview items...
|
||||
- (NSArray *) splitViewItems
|
||||
{
|
||||
return _splitViewItems;
|
||||
}
|
||||
|
||||
- (void) setSplitViewItems: (NSArray *)items
|
||||
{
|
||||
NSMutableArray *mutableItems = [items mutableCopy];
|
||||
ASSIGN(_splitViewItems, mutableItems);
|
||||
}
|
||||
|
||||
- (void) addSplitViewItem: (NSSplitViewItem *)item
|
||||
{
|
||||
[self insertSplitViewItem: item atIndex: [_splitViewItems count]];
|
||||
}
|
||||
|
||||
- (void) insertSplitViewItem: (NSSplitViewItem *)item atIndex: (NSInteger)index
|
||||
{
|
||||
NSSplitView *sv = [self splitView];
|
||||
NSViewController *vc = [item viewController];
|
||||
|
||||
if (vc != nil)
|
||||
{
|
||||
NSView *v = [vc view];
|
||||
if (v != nil)
|
||||
{
|
||||
[sv _insertSubview: v atIndex: index];
|
||||
}
|
||||
}
|
||||
[_splitViewItems insertObject: item atIndex: index];
|
||||
}
|
||||
|
||||
- (void) removeSplitViewItem: (NSSplitViewItem *)item
|
||||
{
|
||||
NSViewController *vc = [item viewController];
|
||||
if (vc != nil)
|
||||
{
|
||||
NSView *v = [vc view];
|
||||
if (v != nil)
|
||||
{
|
||||
[[self splitView] removeSubview: v];
|
||||
}
|
||||
}
|
||||
[_splitViewItems removeObject: item];
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(_splitViewItems);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
// instance methods...
|
||||
- (NSRect) splitView: (NSSplitView *)splitView additionalEffectiveRectOfDividerAtIndex: (NSInteger)dividerIndex
|
||||
{
|
||||
return [splitView frame];
|
||||
}
|
||||
|
||||
- (BOOL) splitView: (NSSplitView *)splitView canCollapseSubview: (NSView *)subview
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSRect) splitView: (NSSplitView *)splitView effectiveRect: (NSRect)proposedEffectiveRect forDrawnRect: (NSRect)drawnRect
|
||||
ofDividerAtIndex: (NSInteger)dividerIndex
|
||||
{
|
||||
return proposedEffectiveRect;
|
||||
}
|
||||
|
||||
- (BOOL) splitView:(NSSplitView *)splitView shouldCollapseSubview: (NSView *)subview forDoubleClickOnDividerAtIndex: (NSInteger)dividerIndex
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL) splitView: (NSSplitView *)splitView shouldHideDividerAtIndex: (NSInteger)dividerIndex
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (IBAction)toggleSidebar:(id)sender
|
||||
{
|
||||
NSLog(@"Toggle");
|
||||
}
|
||||
|
||||
// NSCoding
|
||||
- (instancetype) initWithCoder: (NSCoder *)coder
|
||||
{
|
||||
self = [super initWithCoder: coder];
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
if ([coder containsValueForKey: @"NSSplitView"])
|
||||
{
|
||||
NSSplitView *sv = [coder decodeObjectForKey: @"NSSplitView"];
|
||||
[self setSplitView: sv];
|
||||
}
|
||||
if ([coder containsValueForKey: @"NSSplitViewItems"])
|
||||
{
|
||||
NSArray *items = [coder decodeObjectForKey: @"NSSplitViewItems"];
|
||||
[_splitViewItems addObjectsFromArray: items];
|
||||
}
|
||||
if ([coder containsValueForKey: @"NSMinimumThicknessForInlineSidebars"])
|
||||
{
|
||||
_minimumThicknessForInlineSidebars =
|
||||
[coder decodeFloatForKey: @"NSMinimumThicknessForInlineSidebars"];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSSplitView *sv = [coder decodeObject];
|
||||
[self setSplitView: sv];
|
||||
NSArray *items = [coder decodeObject];
|
||||
[self setSplitViewItems: items];
|
||||
[coder decodeValueOfObjCType: @encode(CGFloat) at: &_minimumThicknessForInlineSidebars];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)coder
|
||||
{
|
||||
[super encodeWithCoder: coder];
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
NSSplitView *sv = [coder decodeObjectForKey: @"NSSplitView"];
|
||||
[self setSplitView: sv];
|
||||
NSArray *items = [coder decodeObjectForKey: @"NSSplitViewItems"];
|
||||
[_splitViewItems addObjectsFromArray: items];
|
||||
_minimumThicknessForInlineSidebars =
|
||||
[coder decodeFloatForKey: @"NSMinimumThicknessForInlineSidebars"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[coder encodeObject: [self splitView]];
|
||||
[coder encodeObject: [self splitViewItems]];
|
||||
[coder encodeValueOfObjCType: @encode(CGFloat)
|
||||
at: &_minimumThicknessForInlineSidebars];
|
||||
}
|
||||
}
|
||||
@end
|
177
Source/NSSplitViewItem.m
Normal file
177
Source/NSSplitViewItem.m
Normal file
|
@ -0,0 +1,177 @@
|
|||
/* Implementation of class NSSplitViewItem
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento
|
||||
Date: Mon 20 Jul 2020 12:56:20 AM EDT
|
||||
|
||||
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,
|
||||
Boston, MA 02110 USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSArchiver.h>
|
||||
#import "AppKit/NSSplitViewItem.h"
|
||||
|
||||
@implementation NSSplitViewItem
|
||||
- (instancetype) initWithViewController: (NSViewController *)viewController
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
ASSIGN(_viewController, viewController);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (instancetype) contentListWithViewController: (NSViewController *)viewController
|
||||
{
|
||||
return AUTORELEASE([[NSSplitViewItem alloc] initWithViewController: viewController]);
|
||||
}
|
||||
|
||||
+ (instancetype) sidebarWithViewController: (NSViewController *)viewController
|
||||
{
|
||||
return AUTORELEASE([[NSSplitViewItem alloc] initWithViewController: viewController]);
|
||||
}
|
||||
|
||||
+ (instancetype) splitViewItemWithViewController: (NSViewController *)viewController
|
||||
{
|
||||
return AUTORELEASE([[NSSplitViewItem alloc] initWithViewController: viewController]);
|
||||
}
|
||||
|
||||
- (CGFloat) automaticMaximumThickness
|
||||
{
|
||||
return _automaticMaximumThickness;
|
||||
}
|
||||
|
||||
- (void) setAutomaticMaximumThickness: (CGFloat)f
|
||||
{
|
||||
_automaticMaximumThickness = f;
|
||||
}
|
||||
|
||||
- (CGFloat) preferredThicknessFraction
|
||||
{
|
||||
return _preferredThicknessFraction;
|
||||
}
|
||||
|
||||
- (void) setPreferredThicknessFraction: (CGFloat)f
|
||||
{
|
||||
_preferredThicknessFraction = f;
|
||||
}
|
||||
|
||||
- (CGFloat) minimumThickness
|
||||
{
|
||||
return _minimumThickness;
|
||||
}
|
||||
|
||||
- (void) setMinimumThickness: (CGFloat)f
|
||||
{
|
||||
_minimumThickness = f;
|
||||
}
|
||||
|
||||
- (CGFloat) maximumThickness
|
||||
{
|
||||
return _maximumThickness;
|
||||
}
|
||||
|
||||
- (void) setMaximumThickness: (CGFloat)f
|
||||
{
|
||||
_maximumThickness = f;
|
||||
}
|
||||
|
||||
- (/* NSLayoutPriority */ CGFloat) holdingPriority
|
||||
{
|
||||
return _holdingPriority;
|
||||
}
|
||||
|
||||
- (void) setHoldingPriority: (/*NSLayoutPriority*/ CGFloat)hp
|
||||
{
|
||||
_holdingPriority = hp;
|
||||
}
|
||||
|
||||
- (BOOL) canCollapse
|
||||
{
|
||||
return _canCollapse;
|
||||
}
|
||||
|
||||
- (NSSplitViewItemCollapseBehavior) collapseBehavior
|
||||
{
|
||||
return _collapseBehavior;
|
||||
}
|
||||
|
||||
- (BOOL) isSpringLoaded
|
||||
{
|
||||
return _springLoaded;
|
||||
}
|
||||
|
||||
- (void) setSpringLoaded: (BOOL)flag
|
||||
{
|
||||
_springLoaded = flag;
|
||||
}
|
||||
|
||||
- (BOOL) allowsFullHeightLayout
|
||||
{
|
||||
return _allowsFullHeightLayout;
|
||||
}
|
||||
|
||||
- (void) setAllowsFullHeightLayout: (BOOL)flag
|
||||
{
|
||||
_allowsFullHeightLayout = flag;
|
||||
}
|
||||
|
||||
- (NSTitlebarSeparatorStyle) titlebarSeparatorStyle
|
||||
{
|
||||
return _titlebarSeparatorStyle;
|
||||
}
|
||||
|
||||
- (void) setTitlebarSeparatorStyle: (NSTitlebarSeparatorStyle)style
|
||||
{
|
||||
_titlebarSeparatorStyle = style;
|
||||
}
|
||||
|
||||
- (NSViewController *) viewController
|
||||
{
|
||||
return _viewController;
|
||||
}
|
||||
|
||||
- (void) setViewController: (NSViewController *)vc
|
||||
{
|
||||
_viewController = vc;
|
||||
}
|
||||
|
||||
// NSCoding
|
||||
- (instancetype) initWithCoder: (NSCoder *)coder
|
||||
{
|
||||
self = [super init];
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
if ([coder containsValueForKey: @"NSSplitViewItemViewController"])
|
||||
{
|
||||
_viewController = [coder decodeObjectForKey: @"NSSplitViewItemViewController"];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)coder
|
||||
{
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
[coder encodeObject: _viewController
|
||||
forKey: @"NSSplitViewItemViewController"];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
|
@ -23,12 +23,21 @@
|
|||
*/
|
||||
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSGeometry.h>
|
||||
|
||||
#import "AppKit/NSStoryboardSegue.h"
|
||||
#import "AppKit/NSWindowController.h"
|
||||
#import "AppKit/NSViewController.h"
|
||||
#import "AppKit/NSSplitViewController.h"
|
||||
#import "AppKit/NSSplitViewItem.h"
|
||||
#import "AppKit/NSSplitView.h"
|
||||
#import "AppKit/NSTabViewController.h"
|
||||
#import "AppKit/NSTabViewItem.h"
|
||||
#import "AppKit/NSTabView.h"
|
||||
#import "AppKit/NSWindow.h"
|
||||
#import "AppKit/NSApplication.h"
|
||||
#import "AppKit/NSView.h"
|
||||
#import "AppKit/NSPopover.h"
|
||||
|
||||
@implementation NSStoryboardSegue
|
||||
|
||||
|
@ -106,11 +115,29 @@
|
|||
// Perform segue based on it's kind...
|
||||
if ([_kind isEqualToString: @"relationship"])
|
||||
{
|
||||
NSWindow *w = [_sourceController window];
|
||||
NSView *v = [_destinationController view];
|
||||
[w setContentView: v];
|
||||
[w setTitle: [_destinationController title]];
|
||||
[_sourceController showWindow: self];
|
||||
if ([_relationship isEqualToString: @"window.shadowedContentViewController"])
|
||||
{
|
||||
NSWindow *w = [_sourceController window];
|
||||
NSView *v = [_destinationController view];
|
||||
[w setContentView: v];
|
||||
[w setTitle: [_destinationController title]];
|
||||
[_sourceController showWindow: self];
|
||||
}
|
||||
else if ([_relationship isEqualToString: @"splitItems"])
|
||||
{
|
||||
NSView *v = [_destinationController view];
|
||||
NSSplitViewController *svc = (NSSplitViewController *)_sourceController;
|
||||
[[svc splitView] addSubview: v];
|
||||
NSUInteger idx = [[[svc splitView] subviews] count] - 1;
|
||||
NSSplitViewItem *item = [[svc splitViewItems] objectAtIndex: idx];
|
||||
[item setViewController: _destinationController];
|
||||
}
|
||||
else if ([_relationship isEqualToString: @"tabItems"])
|
||||
{
|
||||
NSTabViewController *tvc = (NSTabViewController *)_sourceController;
|
||||
NSTabViewItem *item = [NSTabViewItem tabViewItemWithViewController: _destinationController];
|
||||
[tvc addTabViewItem: item];
|
||||
}
|
||||
}
|
||||
else if ([_kind isEqualToString: @"modal"])
|
||||
{
|
||||
|
@ -143,6 +170,23 @@
|
|||
RETAIN(w);
|
||||
}
|
||||
}
|
||||
else if ([_kind isEqualToString: @"popover"])
|
||||
{
|
||||
NSPopover *po = [[NSPopover alloc] init];
|
||||
NSRect rect = [_popoverAnchorView frame];
|
||||
|
||||
[po setBehavior: _popoverBehavior];
|
||||
[po setContentViewController: _destinationController];
|
||||
[po showRelativeToRect: rect
|
||||
ofView: _popoverAnchorView
|
||||
preferredEdge: _preferredEdge];
|
||||
}
|
||||
else if ([_kind isEqualToString: @"sheet"])
|
||||
{
|
||||
}
|
||||
else if ([_kind isEqualToString: @"custom"])
|
||||
{
|
||||
}
|
||||
|
||||
if (_handler != nil)
|
||||
{
|
||||
|
|
|
@ -111,10 +111,15 @@
|
|||
{
|
||||
if (tabViewItem == nil)
|
||||
return;
|
||||
|
||||
if (_items == nil)
|
||||
{
|
||||
ASSIGN(_items, [NSMutableArray array]);
|
||||
}
|
||||
|
||||
[tabViewItem _setTabView: self];
|
||||
[_items insertObject: tabViewItem atIndex: index];
|
||||
|
||||
|
||||
// If this is the first inserted then select it...
|
||||
if ([_items count] == 1)
|
||||
[self selectTabViewItem: tabViewItem];
|
||||
|
@ -564,7 +569,6 @@
|
|||
{
|
||||
ASSIGN(_items, [aDecoder decodeObjectForKey: @"NSTabViewItems"]);
|
||||
[_items makeObjectsPerformSelector: @selector(_setTabView:) withObject: self];
|
||||
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSSelectedTabViewItem"])
|
||||
{
|
||||
|
|
229
Source/NSTabViewController.m
Normal file
229
Source/NSTabViewController.m
Normal file
|
@ -0,0 +1,229 @@
|
|||
/* Implementation of class NSTabViewController
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento
|
||||
Date: 23-07-2020
|
||||
|
||||
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,
|
||||
Boston, MA 02110 USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
|
||||
#import "AppKit/NSTabViewController.h"
|
||||
#import "AppKit/NSTabViewItem.h"
|
||||
#import "AppKit/NSTabView.h"
|
||||
|
||||
#import "GSFastEnumeration.h"
|
||||
|
||||
@implementation NSTabViewController
|
||||
- (NSTabViewControllerTabStyle) tabStyle
|
||||
{
|
||||
return _tabStyle;
|
||||
}
|
||||
|
||||
- (void) setTabStyle: (NSTabViewControllerTabStyle)ts
|
||||
{
|
||||
_tabStyle = ts;
|
||||
}
|
||||
|
||||
- (NSTabView *) tabView
|
||||
{
|
||||
return (NSTabView *)[self view];
|
||||
}
|
||||
|
||||
- (void) setTabView: (NSTabView *)tv
|
||||
{
|
||||
[self setView: tv];
|
||||
[tv setDelegate: self];
|
||||
}
|
||||
|
||||
- (NSViewControllerTransitionOptions) transitionOptions
|
||||
{
|
||||
return _transitionOptions;
|
||||
}
|
||||
|
||||
- (void) setTransitionOptions: (NSViewControllerTransitionOptions)options
|
||||
{
|
||||
_transitionOptions = options;
|
||||
}
|
||||
|
||||
- (BOOL) canPropagateSelectedChildViewControllerTitle
|
||||
{
|
||||
return _canPropagateSelectedChildViewControllerTitle;
|
||||
}
|
||||
|
||||
- (void) setCanPropagateSelectedChildViewControllerTitle: (BOOL)flag
|
||||
{
|
||||
_canPropagateSelectedChildViewControllerTitle = flag;
|
||||
}
|
||||
|
||||
// Managing tabViewItems...
|
||||
- (NSArray *) tabViewItems
|
||||
{
|
||||
return [[self tabView] tabViewItems];
|
||||
}
|
||||
|
||||
- (void) setTabViewItems: (NSArray *)items
|
||||
{
|
||||
FOR_IN(NSTabViewItem*, item, items)
|
||||
[[self tabView] addTabViewItem: item];
|
||||
END_FOR_IN(items);
|
||||
}
|
||||
|
||||
- (NSTabViewItem *) tabViewItemForViewController: (NSViewController *)controller
|
||||
{
|
||||
NSArray *tabViewItems = [[self tabView] tabViewItems];
|
||||
FOR_IN(NSTabViewItem*, tvi, tabViewItems)
|
||||
if ([tvi viewController] == controller)
|
||||
{
|
||||
return tvi;
|
||||
}
|
||||
END_FOR_IN(tabViewItems);
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) addTabViewItem: (NSTabViewItem *)item
|
||||
{
|
||||
[[self tabView] addTabViewItem: item];
|
||||
}
|
||||
|
||||
- (void) insertTabViewItem: (NSTabViewItem *)item
|
||||
atIndex: (NSInteger)index
|
||||
{
|
||||
[[self tabView] insertTabViewItem: item atIndex: index];
|
||||
}
|
||||
|
||||
- (void) removeTabViewItem: (NSTabViewItem *)item
|
||||
{
|
||||
[[self tabView] removeTabViewItem: item];
|
||||
}
|
||||
|
||||
- (NSInteger) selectedTabViewItemIndex
|
||||
{
|
||||
return [[self tabView] indexOfTabViewItem: [[self tabView] selectedTabViewItem]];
|
||||
}
|
||||
|
||||
- (void) setSelectedTabViewItemIndex: (NSInteger)idx
|
||||
{
|
||||
[[self tabView] selectTabViewItemAtIndex: idx];
|
||||
if (_canPropagateSelectedChildViewControllerTitle)
|
||||
{
|
||||
NSString *title = [[[self tabView] tabViewItems] objectAtIndex: idx];
|
||||
if (title != nil)
|
||||
{
|
||||
[self setTitle: title];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Responding to tabview actions...
|
||||
- (BOOL)tabView:(NSTabView *)tabView
|
||||
shouldSelectTabViewItem:(NSTabViewItem *)tabViewItem
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)tabView:(NSTabView *)tabView
|
||||
willSelectTabViewItem:(NSTabViewItem *)tabViewItem
|
||||
{
|
||||
// not implemented
|
||||
}
|
||||
|
||||
- (void)tabView:(NSTabView *)tabView
|
||||
didSelectTabViewItem:(NSTabViewItem *)tabViewItem
|
||||
{
|
||||
// not implemented
|
||||
}
|
||||
|
||||
// Responding to toolbar actions...
|
||||
- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar
|
||||
itemForItemIdentifier:(NSToolbarItemIdentifier)itemIdentifier
|
||||
willBeInsertedIntoToolbar:(BOOL)flag
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar
|
||||
{
|
||||
return [NSArray array];
|
||||
}
|
||||
|
||||
- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar
|
||||
{
|
||||
return [NSArray array];
|
||||
}
|
||||
|
||||
// NSCoding
|
||||
- (instancetype) initWithCoder: (NSCoder *)coder
|
||||
{
|
||||
self = [super initWithCoder: coder];
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
if ([coder containsValueForKey: @"NSTabView"])
|
||||
{
|
||||
NSTabView *tv = [coder decodeObjectForKey: @"NSTabView"];
|
||||
[self setTabView: tv];
|
||||
|
||||
// Currently we only support the tabs being on the top or the bottom.
|
||||
// The rendering code doesn't support anything outside of these two
|
||||
// cases. Here we force the use of the top case, when it is outside
|
||||
// of either of the cases we handle... this is temporary. FIXME
|
||||
if ([tv tabViewType] != NSTopTabsBezelBorder &&
|
||||
[tv tabViewType] != NSBottomTabsBezelBorder)
|
||||
{
|
||||
[tv setTabViewType: NSTopTabsBezelBorder];
|
||||
}
|
||||
}
|
||||
|
||||
if ([coder containsValueForKey: @"NSTabViewControllerCanPropagateSelectedChildViewControllerTitle"])
|
||||
{
|
||||
BOOL flag = [coder decodeBoolForKey: @"NSTabViewControllerCanPropagateSelectedChildViewControllerTitle"];
|
||||
[self setCanPropagateSelectedChildViewControllerTitle: flag];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOL flag;
|
||||
[self setTabView: [coder decodeObject]]; // get tabview...
|
||||
[coder decodeValueOfObjCType: @encode(BOOL)
|
||||
at: &flag];
|
||||
[self setCanPropagateSelectedChildViewControllerTitle: flag];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)coder
|
||||
{
|
||||
[super encodeWithCoder: coder];
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
NSTabView *tv = [self tabView];
|
||||
[coder encodeObject: tv forKey: @"NSTabView"];
|
||||
[coder encodeBool: [self canPropagateSelectedChildViewControllerTitle]
|
||||
forKey: @"NSTabViewControllerCanPropagateSelectedChildViewControllerTitle"];
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOL flag = [self canPropagateSelectedChildViewControllerTitle];
|
||||
[coder encodeObject: [self tabView]]; // get tabview...
|
||||
[coder encodeValueOfObjCType: @encode(BOOL)
|
||||
at: &flag];
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
|
@ -33,6 +33,7 @@
|
|||
#import "AppKit/NSTabView.h"
|
||||
#import "AppKit/NSTabViewItem.h"
|
||||
#import "AppKit/PSOperators.h"
|
||||
#import "AppKit/NSViewController.h"
|
||||
|
||||
@implementation NSTabViewItem
|
||||
|
||||
|
@ -72,6 +73,33 @@
|
|||
NSStringFromClass([self class]), _label, _ident];
|
||||
}
|
||||
|
||||
- (NSViewController *) viewController
|
||||
{
|
||||
return _viewController;
|
||||
}
|
||||
|
||||
- (void) setViewController: (NSViewController *)vc
|
||||
{
|
||||
_viewController = vc; // weak
|
||||
[self setView: [vc view]];
|
||||
}
|
||||
|
||||
+ (instancetype) tabViewItemWithViewController: (NSViewController *)vc
|
||||
{
|
||||
NSTabViewItem *item = AUTORELEASE([[NSTabViewItem alloc] init]);
|
||||
if ([vc title] == nil || [[vc title] isEqualToString: @""])
|
||||
{
|
||||
NSString *className = [vc className];
|
||||
[item setLabel: className];
|
||||
}
|
||||
else
|
||||
{
|
||||
[item setLabel: [vc title]];
|
||||
}
|
||||
[item setViewController: vc];
|
||||
return item;
|
||||
}
|
||||
|
||||
// Set identifier.
|
||||
|
||||
- (void) setIdentifier: (id)identifier
|
||||
|
|
|
@ -205,7 +205,6 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
* Private methods.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* The [-_invalidateCoordinates] method marks the coordinate mapping
|
||||
* matrices (matrixFromWindow and _matrixToWindow) and the cached visible
|
||||
|
@ -5132,6 +5131,28 @@ static NSView* findByTag(NSView *view, NSInteger aTag, NSUInteger *level)
|
|||
|
||||
@end
|
||||
|
||||
@implementation NSView (__NSViewPrivateMethods__)
|
||||
|
||||
/*
|
||||
* This method inserts a view at a given place in the view hierarchy.
|
||||
*/
|
||||
- (void) _insertSubview: (NSView *)sv atIndex: (NSUInteger)idx
|
||||
{
|
||||
[sv _viewWillMoveToWindow: _window];
|
||||
[sv _viewWillMoveToSuperview: self];
|
||||
[sv setNextResponder: self];
|
||||
[_sub_views insertObject: sv atIndex: idx];
|
||||
_rFlags.has_subviews = 1;
|
||||
[sv resetCursorRects];
|
||||
[sv setNeedsDisplay: YES];
|
||||
[sv _viewDidMoveToWindow];
|
||||
[sv viewDidMoveToSuperview];
|
||||
[self didAddSubview: sv];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation NSView(KeyViewLoop)
|
||||
|
||||
static NSComparisonResult
|
||||
|
|
|
@ -84,6 +84,11 @@
|
|||
|
||||
- (void)setTitle:(NSString *)title
|
||||
{
|
||||
NSWindow *w = [[self view] window];
|
||||
if (w != nil)
|
||||
{
|
||||
[w setTitle: title]; // sync title with window...
|
||||
}
|
||||
ASSIGN(_title, title);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,4 +34,8 @@
|
|||
- (void) _recursiveSetUpKeyViewLoopWithNextKeyView: (NSView *)nextKeyView;
|
||||
@end
|
||||
|
||||
@interface NSView (__NSViewPrivateMethods__)
|
||||
- (void) _insertSubview: (NSView *)sv atIndex: (NSUInteger)idx;
|
||||
@end
|
||||
|
||||
#endif // _GNUstep_H_NSViewPrivate
|
||||
|
|
|
@ -739,6 +739,7 @@ static NSNotificationCenter *nc = nil;
|
|||
defer: NO];
|
||||
[window setTitle: title];
|
||||
[window setContentView: view];
|
||||
[view setNeedsDisplay: YES];
|
||||
AUTORELEASE(window);
|
||||
return window;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue