mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 04:31:00 +00:00
Implemented adjusting subviews only the first time the splitview is
displayed; fixed some delegate messaging which was done the wrong way git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@9040 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d598cf4c69
commit
c5f8ada48b
1 changed files with 142 additions and 115 deletions
|
@ -3,14 +3,16 @@
|
|||
|
||||
Allows multiple views to share a region in a window
|
||||
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
Author: Robert Vasvari < vrobi@ddrummer.com >
|
||||
Author: Robert Vasvari <vrobi@ddrummer.com>
|
||||
Date: Jul 1998
|
||||
Author: Felipe A. Rodriguez < far@ix.netcom.com >
|
||||
Author: Felipe A. Rodriguez <far@ix.netcom.com>
|
||||
Date: November 1998
|
||||
Author: Richard Frith-Macdonald < richard@brainstorm.co.uk >
|
||||
Author: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Date: January 1999
|
||||
Author: Nicola Pero <n.pero@mi.flashnet.it>
|
||||
Date: 2000, 2001
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
|
@ -56,6 +58,7 @@
|
|||
ASSIGN (_backgroundColor, [NSColor controlBackgroundColor]);
|
||||
ASSIGN (_dimpleImage, [NSImage imageNamed: @"common_Dimple.tiff"]);
|
||||
|
||||
_never_displayed_before = YES;
|
||||
_autoresizes_subviews = NO;
|
||||
}
|
||||
return self;
|
||||
|
@ -392,21 +395,24 @@
|
|||
[self display];
|
||||
}
|
||||
|
||||
- (void) adjustSubviews
|
||||
- (void) _adjustSubviews
|
||||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
SEL delegateMethod = @selector (splitView:resizeSubviewsWithOldSize:);
|
||||
|
||||
[nc postNotificationName: NSSplitViewWillResizeSubviewsNotification
|
||||
object: self];
|
||||
|
||||
if (_delegate && [_delegate
|
||||
respondsToSelector:
|
||||
@selector(splitView:resizeSubviewsWithOldSize:)])
|
||||
if (_delegate != nil && [_delegate respondsToSelector: delegateMethod])
|
||||
{
|
||||
[_delegate splitView: self resizeSubviewsWithOldSize: _frame.size];
|
||||
}
|
||||
else
|
||||
{ /* split the area up evenly */
|
||||
{
|
||||
[self adjustSubviews];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void) adjustSubviews
|
||||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
NSArray *subs = [self subviews];
|
||||
unsigned count = [subs count];
|
||||
NSView *views[count];
|
||||
|
@ -420,6 +426,10 @@
|
|||
float scale;
|
||||
float running;
|
||||
|
||||
[nc postNotificationName: NSSplitViewWillResizeSubviewsNotification
|
||||
object: self];
|
||||
|
||||
|
||||
[subs getObjects: views];
|
||||
if (_isVertical == NO)
|
||||
{
|
||||
|
@ -484,25 +494,10 @@
|
|||
[views[i] setFrameOrigin: newPoint];
|
||||
}
|
||||
}
|
||||
}
|
||||
[nc postNotificationName: NSSplitViewDidResizeSubviewsNotification
|
||||
object: self];
|
||||
}
|
||||
|
||||
- (void) addSubview: (NSView*)aView
|
||||
positioned: (NSWindowOrderingMode)place
|
||||
relativeTo: (NSView*)otherView
|
||||
{
|
||||
[super addSubview: aView positioned: place relativeTo: otherView];
|
||||
[self adjustSubviews];
|
||||
}
|
||||
|
||||
- (void) addSubview: aView
|
||||
{
|
||||
[super addSubview: aView];
|
||||
[self adjustSubviews];
|
||||
}
|
||||
|
||||
- (float) dividerThickness
|
||||
{
|
||||
/*
|
||||
|
@ -603,7 +598,6 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
|
|||
}
|
||||
|
||||
/* draw the dimples */
|
||||
{
|
||||
for (i = 0; i < (count-1); i++)
|
||||
{
|
||||
v = [subs objectAtIndex: i];
|
||||
|
@ -620,7 +614,6 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
|
|||
}
|
||||
[self drawDividerInRect: divRect];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (NSImage*) dimpleImage
|
||||
|
@ -642,10 +635,44 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
|
|||
- (void) resizeWithOldSuperviewSize: (NSSize)oldSize
|
||||
{
|
||||
[super resizeWithOldSuperviewSize: oldSize];
|
||||
[self adjustSubviews];
|
||||
[self _adjustSubviews];
|
||||
[_window invalidateCursorRectsForView: self];
|
||||
}
|
||||
|
||||
- (void) displayIfNeededInRectIgnoringOpacity: (NSRect)aRect
|
||||
{
|
||||
if (_window == nil)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_never_displayed_before == YES)
|
||||
{
|
||||
[self _adjustSubviews];
|
||||
_never_displayed_before = NO;
|
||||
}
|
||||
|
||||
[super displayIfNeededInRectIgnoringOpacity: aRect];
|
||||
}
|
||||
|
||||
- (void) displayRectIgnoringOpacity: (NSRect)aRect
|
||||
{
|
||||
if (_window == nil)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_never_displayed_before == YES)
|
||||
{
|
||||
[self _adjustSubviews];
|
||||
_never_displayed_before = NO;
|
||||
}
|
||||
|
||||
[super displayRectIgnoringOpacity: aRect];
|
||||
}
|
||||
|
||||
|
||||
|
||||
- (id) delegate
|
||||
{
|
||||
return _delegate;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue