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
David@0
     1
//
David@0
     2
//  AIBorderlessListController.m
David@0
     3
//  Adium
David@0
     4
//
David@0
     5
//  Created by Evan Schoenberg on 1/8/06.
David@0
     6
//
David@0
     7
David@0
     8
#import "AIBorderlessListController.h"
David@0
     9
#import "AIListOutlineView.h"
David@0
    10
David@0
    11
@implementation AIBorderlessListController
David@0
    12
David@0
    13
- (id)initWithContactList:(AIListObject<AIContainingObject> *)aContactList
David@0
    14
			inOutlineView:(AIListOutlineView *)inContactListView
David@0
    15
			 inScrollView:(AIAutoScrollView *)inScrollView_contactList
David@0
    16
				 delegate:(id<AIListControllerDelegate>)inDelegate
David@0
    17
{
David@0
    18
	if ((self = [super initWithContactList:aContactList
David@0
    19
							 inOutlineView:inContactListView
David@0
    20
							  inScrollView:inScrollView_contactList
David@0
    21
								  delegate:inDelegate])) {
David@0
    22
		emptyListHiding = NO;
David@375
    23
		[self reloadListObject:nil];
David@0
    24
	}
David@0
    25
	
David@0
    26
	return self;
David@0
    27
}
David@0
    28
David@0
    29
- (void)configureViewsAndTooltips
David@0
    30
{
David@0
    31
	[super configureViewsAndTooltips];
David@0
    32
	
David@375
    33
	[self reloadListObject:nil];
David@0
    34
}
David@0
    35
/*!
Evan@2557
    36
 * @brief When asked to reload a list object, check to ensure we have 1 or more visible rows
David@0
    37
 *
David@0
    38
 * If we have no rows visible, hide the contact list, redisplaying it when rows are visible again.
David@0
    39
 * orderOut: doesn't appear to work for borderless windows, so we just go to an alpha value of 0.
David@0
    40
 */
Evan@2557
    41
- (void)reloadListObject:(NSNotification *)notification
David@0
    42
{
David@375
    43
	[super reloadListObject:notification];
David@0
    44
David@3
    45
	NSInteger numberOfRows = [contactListView numberOfRows];
David@0
    46
David@0
    47
	if (numberOfRows && emptyListHiding) {	
David@0
    48
		emptyListHiding = NO;		
David@0
    49
		[[contactListView window] setAlphaValue:previousAlpha];
David@0
    50
		[[contactListView window] orderFront:nil];
David@0
    51
David@0
    52
	} else if (!numberOfRows && !emptyListHiding) {	
David@0
    53
		emptyListHiding = YES;
David@0
    54
		previousAlpha = [[contactListView window] alphaValue];
David@0
    55
		[[contactListView window] setAlphaValue:0.0];
David@0
    56
	}
David@0
    57
}
David@0
    58
David@0
    59
@end