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,7 +3,7 @@
|
||||||
|
|
||||||
Allows multiple views to share a region in a window
|
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
|
Date: Jul 1998
|
||||||
|
@ -11,6 +11,8 @@
|
||||||
Date: November 1998
|
Date: November 1998
|
||||||
Author: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
Author: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||||
Date: January 1999
|
Date: January 1999
|
||||||
|
Author: Nicola Pero <n.pero@mi.flashnet.it>
|
||||||
|
Date: 2000, 2001
|
||||||
|
|
||||||
This file is part of the GNUstep GUI Library.
|
This file is part of the GNUstep GUI Library.
|
||||||
|
|
||||||
|
@ -56,6 +58,7 @@
|
||||||
ASSIGN (_backgroundColor, [NSColor controlBackgroundColor]);
|
ASSIGN (_backgroundColor, [NSColor controlBackgroundColor]);
|
||||||
ASSIGN (_dimpleImage, [NSImage imageNamed: @"common_Dimple.tiff"]);
|
ASSIGN (_dimpleImage, [NSImage imageNamed: @"common_Dimple.tiff"]);
|
||||||
|
|
||||||
|
_never_displayed_before = YES;
|
||||||
_autoresizes_subviews = NO;
|
_autoresizes_subviews = NO;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
|
@ -392,21 +395,24 @@
|
||||||
[self display];
|
[self display];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) adjustSubviews
|
- (void) _adjustSubviews
|
||||||
{
|
{
|
||||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
SEL delegateMethod = @selector (splitView:resizeSubviewsWithOldSize:);
|
||||||
|
|
||||||
[nc postNotificationName: NSSplitViewWillResizeSubviewsNotification
|
if (_delegate != nil && [_delegate respondsToSelector: delegateMethod])
|
||||||
object: self];
|
|
||||||
|
|
||||||
if (_delegate && [_delegate
|
|
||||||
respondsToSelector:
|
|
||||||
@selector(splitView:resizeSubviewsWithOldSize:)])
|
|
||||||
{
|
{
|
||||||
[_delegate splitView: self resizeSubviewsWithOldSize: _frame.size];
|
[_delegate splitView: self resizeSubviewsWithOldSize: _frame.size];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* split the area up evenly */
|
{
|
||||||
|
[self adjustSubviews];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) adjustSubviews
|
||||||
|
{
|
||||||
|
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||||
NSArray *subs = [self subviews];
|
NSArray *subs = [self subviews];
|
||||||
unsigned count = [subs count];
|
unsigned count = [subs count];
|
||||||
NSView *views[count];
|
NSView *views[count];
|
||||||
|
@ -420,6 +426,10 @@
|
||||||
float scale;
|
float scale;
|
||||||
float running;
|
float running;
|
||||||
|
|
||||||
|
[nc postNotificationName: NSSplitViewWillResizeSubviewsNotification
|
||||||
|
object: self];
|
||||||
|
|
||||||
|
|
||||||
[subs getObjects: views];
|
[subs getObjects: views];
|
||||||
if (_isVertical == NO)
|
if (_isVertical == NO)
|
||||||
{
|
{
|
||||||
|
@ -484,25 +494,10 @@
|
||||||
[views[i] setFrameOrigin: newPoint];
|
[views[i] setFrameOrigin: newPoint];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
[nc postNotificationName: NSSplitViewDidResizeSubviewsNotification
|
[nc postNotificationName: NSSplitViewDidResizeSubviewsNotification
|
||||||
object: self];
|
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
|
- (float) dividerThickness
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -603,7 +598,6 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* draw the dimples */
|
/* draw the dimples */
|
||||||
{
|
|
||||||
for (i = 0; i < (count-1); i++)
|
for (i = 0; i < (count-1); i++)
|
||||||
{
|
{
|
||||||
v = [subs objectAtIndex: i];
|
v = [subs objectAtIndex: i];
|
||||||
|
@ -621,7 +615,6 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
|
||||||
[self drawDividerInRect: divRect];
|
[self drawDividerInRect: divRect];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
- (NSImage*) dimpleImage
|
- (NSImage*) dimpleImage
|
||||||
{
|
{
|
||||||
|
@ -642,10 +635,44 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
|
||||||
- (void) resizeWithOldSuperviewSize: (NSSize)oldSize
|
- (void) resizeWithOldSuperviewSize: (NSSize)oldSize
|
||||||
{
|
{
|
||||||
[super resizeWithOldSuperviewSize: oldSize];
|
[super resizeWithOldSuperviewSize: oldSize];
|
||||||
[self adjustSubviews];
|
[self _adjustSubviews];
|
||||||
[_window invalidateCursorRectsForView: self];
|
[_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
|
- (id) delegate
|
||||||
{
|
{
|
||||||
return _delegate;
|
return _delegate;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue