Source/AIBorderlessListController.m
author Evan Schoenberg
Mon Jul 27 16:27:22 2009 -0500 (2009-07-27)
changeset 2557 77528d1c767b
parent 375 2cfd66328ee2
child 2937 6018d546f035
permissions -rw-r--r--
The notification selector in the superclass was changed, but this subclassing of it wasn't fully updated. Fixes updating of the hidden/visible state of a borderless contact list based upon whether or not it contains any rows and is supposed to hide when empty. Fixes #12206
     1 //
     2 //  AIBorderlessListController.m
     3 //  Adium
     4 //
     5 //  Created by Evan Schoenberg on 1/8/06.
     6 //
     7 
     8 #import "AIBorderlessListController.h"
     9 #import "AIListOutlineView.h"
    10 
    11 @implementation AIBorderlessListController
    12 
    13 - (id)initWithContactList:(AIListObject<AIContainingObject> *)aContactList
    14 			inOutlineView:(AIListOutlineView *)inContactListView
    15 			 inScrollView:(AIAutoScrollView *)inScrollView_contactList
    16 				 delegate:(id<AIListControllerDelegate>)inDelegate
    17 {
    18 	if ((self = [super initWithContactList:aContactList
    19 							 inOutlineView:inContactListView
    20 							  inScrollView:inScrollView_contactList
    21 								  delegate:inDelegate])) {
    22 		emptyListHiding = NO;
    23 		[self reloadListObject:nil];
    24 	}
    25 	
    26 	return self;
    27 }
    28 
    29 - (void)configureViewsAndTooltips
    30 {
    31 	[super configureViewsAndTooltips];
    32 	
    33 	[self reloadListObject:nil];
    34 }
    35 /*!
    36  * @brief When asked to reload a list object, check to ensure we have 1 or more visible rows
    37  *
    38  * If we have no rows visible, hide the contact list, redisplaying it when rows are visible again.
    39  * orderOut: doesn't appear to work for borderless windows, so we just go to an alpha value of 0.
    40  */
    41 - (void)reloadListObject:(NSNotification *)notification
    42 {
    43 	[super reloadListObject:notification];
    44 
    45 	NSInteger numberOfRows = [contactListView numberOfRows];
    46 
    47 	if (numberOfRows && emptyListHiding) {	
    48 		emptyListHiding = NO;		
    49 		[[contactListView window] setAlphaValue:previousAlpha];
    50 		[[contactListView window] orderFront:nil];
    51 
    52 	} else if (!numberOfRows && !emptyListHiding) {	
    53 		emptyListHiding = YES;
    54 		previousAlpha = [[contactListView window] alphaValue];
    55 		[[contactListView window] setAlphaValue:0.0];
    56 	}
    57 }
    58 
    59 @end