2003-07-31 23:52:10 +00:00
|
|
|
/* -*-objc-*-
|
|
|
|
NSSplitView.h
|
|
|
|
|
|
|
|
Allows multiple views to share a region in a window
|
|
|
|
|
|
|
|
Copyright (C) 1996 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Author: Robert Vasvari <vrobi@ddrummer.com>
|
|
|
|
Date: Jul 1998
|
|
|
|
|
|
|
|
This file is part of the GNUstep GUI Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
2007-10-29 21:16:17 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
2003-07-31 23:52:10 +00:00
|
|
|
License as published by the Free Software Foundation; either
|
2008-06-10 04:01:49 +00:00
|
|
|
version 2 of the License, or (at your option) any later version.
|
2007-10-29 21:16:17 +00:00
|
|
|
|
2003-07-31 23:52:10 +00:00
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2007-10-29 21:16:17 +00:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
2003-07-31 23:52:10 +00:00
|
|
|
|
2007-10-29 21:16:17 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2003-07-31 23:52:10 +00:00
|
|
|
License along with this library; see the file COPYING.LIB.
|
2007-10-29 21:16:17 +00:00
|
|
|
If not, see <http://www.gnu.org/licenses/> or write to the
|
|
|
|
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
2006-11-06 13:58:37 +00:00
|
|
|
Boston, MA 02110-1301, USA.
|
2003-07-31 23:52:10 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _GNUstep_H_NSSplitView
|
|
|
|
#define _GNUstep_H_NSSplitView
|
|
|
|
|
2010-03-31 08:14:50 +00:00
|
|
|
#import <AppKit/NSView.h>
|
2003-07-31 23:52:10 +00:00
|
|
|
|
|
|
|
@class NSImage, NSColor, NSNotification;
|
|
|
|
|
2011-05-27 08:35:24 +00:00
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
|
|
|
|
enum {
|
|
|
|
NSSplitViewDividerStyleThick = 1,
|
|
|
|
NSSplitViewDividerStyleThin = 2,
|
2017-03-05 22:12:15 +00:00
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
|
|
|
NSSplitViewDividerStylePaneSplitter = 3,
|
|
|
|
#endif
|
2011-05-27 08:35:24 +00:00
|
|
|
};
|
|
|
|
typedef NSInteger NSSplitViewDividerStyle;
|
|
|
|
#endif
|
|
|
|
|
2003-07-31 23:52:10 +00:00
|
|
|
@interface NSSplitView : NSView
|
|
|
|
{
|
2009-04-07 20:16:53 +00:00
|
|
|
id _delegate;
|
2008-04-01 01:37:52 +00:00
|
|
|
NSImage *_dimpleImage;
|
|
|
|
NSColor *_backgroundColor;
|
|
|
|
NSColor *_dividerColor;
|
|
|
|
NSString *_autosaveName;
|
2009-04-07 20:16:53 +00:00
|
|
|
CGFloat _dividerWidth;
|
|
|
|
CGFloat _draggedBarWidth;
|
|
|
|
BOOL _isVertical;
|
|
|
|
BOOL _never_displayed_before;
|
|
|
|
BOOL _is_pane_splitter;
|
2003-07-31 23:52:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setDelegate: (id)anObject;
|
|
|
|
- (id) delegate;
|
|
|
|
- (void) adjustSubviews;
|
|
|
|
- (void) drawDividerInRect: (NSRect)aRect;
|
2009-04-07 20:16:53 +00:00
|
|
|
- (CGFloat) dividerThickness;
|
2003-07-31 23:52:10 +00:00
|
|
|
|
|
|
|
/* Vertical splitview has a vertical split bar */
|
|
|
|
- (void) setVertical: (BOOL)flag;
|
|
|
|
- (BOOL) isVertical;
|
|
|
|
|
2006-11-06 13:58:37 +00:00
|
|
|
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
2003-07-31 23:52:10 +00:00
|
|
|
- (BOOL) isSubviewCollapsed: (NSView *)subview;
|
|
|
|
- (BOOL) isPaneSplitter;
|
|
|
|
- (void) setIsPaneSplitter: (BOOL)flag;
|
2009-04-07 20:16:53 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
|
2008-04-01 01:37:52 +00:00
|
|
|
- (void) setAutosaveName: (NSString *)autosaveName;
|
|
|
|
- (NSString *) autosaveName;
|
2009-04-07 20:16:53 +00:00
|
|
|
|
|
|
|
- (CGFloat) maxPossiblePositionOfDividerAtIndex: (NSInteger)dividerIndex;
|
|
|
|
- (CGFloat) minPossiblePositionOfDividerAtIndex: (NSInteger)dividerIndex;
|
|
|
|
- (void) setPosition: (CGFloat)position ofDividerAtIndex: (NSInteger)dividerIndex;
|
2011-05-27 08:35:24 +00:00
|
|
|
|
|
|
|
- (NSColor *) dividerColor;
|
|
|
|
- (NSSplitViewDividerStyle) dividerStyle;
|
|
|
|
- (void) setDividerStyle: (NSSplitViewDividerStyle)dividerStyle;
|
2003-07-31 23:52:10 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2006-11-06 13:58:37 +00:00
|
|
|
#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
|
2003-07-31 23:52:10 +00:00
|
|
|
@interface NSSplitView (GNUstepExtra)
|
|
|
|
/* extra methods to make it more usable */
|
2009-04-07 20:16:53 +00:00
|
|
|
- (CGFloat) draggedBarWidth;
|
|
|
|
- (void) setDraggedBarWidth: (CGFloat)newWidth;
|
2003-07-31 23:52:10 +00:00
|
|
|
/* if flag is yes, dividerThickness is reset to the height/width of the dimple
|
|
|
|
image + 1;
|
|
|
|
*/
|
|
|
|
- (void) setDimpleImage: (NSImage *)anImage resetDividerThickness: (BOOL)flag;
|
|
|
|
- (NSImage *) dimpleImage;
|
|
|
|
- (NSColor *) backgroundColor;
|
|
|
|
- (void) setBackgroundColor: (NSColor *)aColor;
|
|
|
|
- (void) setDividerColor: (NSColor *)aColor;
|
|
|
|
@end
|
|
|
|
#endif
|
|
|
|
|
|
|
|
@interface NSObject (NSSplitViewDelegate)
|
|
|
|
- (void) splitView: (NSSplitView *)sender
|
|
|
|
resizeSubviewsWithOldSize: (NSSize)oldSize;
|
|
|
|
|
|
|
|
- (void) splitView: (NSSplitView *)sender
|
2013-02-10 21:32:07 +00:00
|
|
|
constrainMinCoordinate: (CGFloat *)min
|
|
|
|
maxCoordinate: (CGFloat *)max
|
|
|
|
ofSubviewAt: (NSInteger)offset;
|
2003-07-31 23:52:10 +00:00
|
|
|
|
2013-02-10 21:32:07 +00:00
|
|
|
- (CGFloat) splitView: (NSSplitView *)sender
|
|
|
|
constrainSplitPosition: (CGFloat)proposedPosition
|
|
|
|
ofSubviewAt: (NSInteger)offset;
|
2003-07-31 23:52:10 +00:00
|
|
|
|
|
|
|
- (void) splitViewWillResizeSubviews: (NSNotification *)notification;
|
|
|
|
- (void) splitViewDidResizeSubviews: (NSNotification *)notification;
|
|
|
|
|
2006-11-06 13:58:37 +00:00
|
|
|
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
2003-07-31 23:52:10 +00:00
|
|
|
- (BOOL) splitView: (NSSplitView *)sender
|
|
|
|
canCollapseSubview: (NSView *)subview;
|
|
|
|
|
2013-02-10 21:32:07 +00:00
|
|
|
- (CGFloat) splitView: (NSSplitView *)sender
|
|
|
|
constrainMaxCoordinate: (CGFloat)proposedMax
|
|
|
|
ofSubviewAt: (NSInteger)offset;
|
2003-07-31 23:52:10 +00:00
|
|
|
|
2013-02-10 21:32:07 +00:00
|
|
|
- (CGFloat) splitView: (NSSplitView *)sender
|
|
|
|
constrainMinCoordinate: (CGFloat)proposedMin
|
|
|
|
ofSubviewAt: (NSInteger)offset;
|
2003-07-31 23:52:10 +00:00
|
|
|
#endif
|
|
|
|
|
2011-05-27 08:35:24 +00:00
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
|
|
|
|
- (NSRect) splitView: (NSSplitView *)splitView
|
|
|
|
additionalEffectiveRectOfDividerAtIndex: (NSInteger)dividerIndex;
|
|
|
|
|
|
|
|
- (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;
|
|
|
|
#endif
|
2012-03-27 04:32:57 +00:00
|
|
|
|
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
|
|
|
- (BOOL) splitView: (NSSplitView *)splitView
|
|
|
|
shouldAdjustSizeOfSubview: (NSView *)view;
|
|
|
|
#endif
|
2003-07-31 23:52:10 +00:00
|
|
|
@end
|
|
|
|
|
|
|
|
/* Notifications */
|
|
|
|
APPKIT_EXPORT NSString *NSSplitViewDidResizeSubviewsNotification;
|
|
|
|
APPKIT_EXPORT NSString *NSSplitViewWillResizeSubviewsNotification;
|
|
|
|
|
|
|
|
#endif
|