From 76c09cb339e07671abc457b23e561b6565ecb91e Mon Sep 17 00:00:00 2001 From: Evan Schoenberg Date: Thu, 11 Jan 2007 01:49:27 +0000 Subject: [PATCH] Merged [18670]: Patch from Lex Nicolaes, who writes: 1) The splitview-handle could disappear under the right tableview when decreasing the size of the Xtras manager-window. I'm fixing this by making sure the width of the self is always 50% of the view max. when resizing the window. 2) The aqua-look implementation had a minor fault; it worked but would have shown faulty when adding buttons. git-svn-id: svn://svn.adiumx.com/adium/branches/adium-1.0@18671 1c916fce-81e2-0310-a464-8ca513f45935 --- Source/KNShelfSplitView.m | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/Source/KNShelfSplitView.m b/Source/KNShelfSplitView.m index c944fd73d..f2d3589af 100644 --- a/Source/KNShelfSplitView.m +++ b/Source/KNShelfSplitView.m @@ -91,6 +91,11 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMA [self setShelfView: aShelfView]; [self setContentView: aContentView]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(windowDidResize:) + name:NSWindowDidResizeNotification + object:[self window]]; } return self; } @@ -101,9 +106,16 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMA if( actionButtonImage ){ [actionButtonImage release]; } if( shelfBackgroundColor ){ [shelfBackgroundColor release]; } if( contextButtonMenu ){ [contextButtonMenu release]; } + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidResizeNotification object:self]; [super dealloc]; } +- (void)windowDidResize:(NSNotification *)aNotification +{ + [self setShelfWidth: [self shelfWidth]]; + [self recalculateSizes]; +} + -(void)setDelegate:(id)aDelegate{ delegate = aDelegate; @@ -558,26 +570,23 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMA } } -//This glass implementation is actually broken but works for Adium -- a proper one would take the width of aRect into account. --(void)drawControlBackgroundInRect:(NSRect)aRect active:(BOOL)isActive{ - NSRect frame = [self frame]; - - //Draw the background, tiling across +-(void)drawControlBackgroundInRect:(NSRect)aRect active:(BOOL)isActive{ + //Draw the background, tiling across NSRect sourceRect = NSMakeRect(0, 0, backgroundSize.width, backgroundSize.height); - NSRect destRect = NSMakeRect(frame.origin.x, frame.origin.y, sourceRect.size.width, aRect.size.height); - - while ((destRect.origin.x < NSMaxX(frame)) && destRect.size.width > 0) { + NSRect destRect = NSMakeRect(aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height); + + while ((destRect.origin.x < NSMaxX(aRect)) && destRect.size.width > 0) { //Crop - if (NSMaxX(destRect) > NSMaxX(frame)) { + if (NSMaxX(destRect) > NSMaxX(aRect)) { sourceRect.size.width = NSWidth(destRect); } - + [background drawInRect:destRect - fromRect:sourceRect - operation:NSCompositeSourceOver - fraction:1.0]; + fromRect:sourceRect + operation:NSCompositeSourceOver + fraction:1.0]; destRect.origin.x += destRect.size.width; - } + } } -(void)setFrame:(NSRect)aRect{ -- 2.11.4.GIT