Fix some warnings
[adiumx.git] / Source / AIBorderlessListController.m
blob55ef09b70dd8fc18a4dd5205df6d68bb20fd09d1
1 //
2 //  AIBorderlessListController.m
3 //  Adium
4 //
5 //  Created by Evan Schoenberg on 1/8/06.
6 //
8 #import "AIBorderlessListController.h"
9 #import "AIListOutlineView.h"
11 @implementation AIBorderlessListController
13 - (id)initWithContactListView:(AIListOutlineView *)inContactListView inScrollView:(AIAutoScrollView *)inScrollView_contactList delegate:(id<AIListControllerDelegate>)inDelegate
15         if ((self = [super initWithContactListView:inContactListView
16                                                                   inScrollView:inScrollView_contactList
17                                                                           delegate:inDelegate])) {
18                 emptyListHiding = NO;
19                 [self contactOrderChanged:nil];
20         }
21         
22         return self;
25 /*!
26  * @brief When the contact order changes, check to ensure we have 1 or more visible rows
27  *
28  * If we have no rows visible, hide the contact list, redisplaying it when rows are visible again.
29  * orderOut: doesn't appear to work for borderless windows, so we just go to an alpha value of 0.
30  */
31 - (void)contactOrderChanged:(NSNotification *)notification
33         [super contactOrderChanged:notification];
35         int numberOfRows = [contactListView numberOfRows];
37         if (numberOfRows && emptyListHiding) {  
38                 emptyListHiding = NO;           
39                 [[contactListView window] setAlphaValue:previousAlpha];
40                 [[contactListView window] orderFront:nil];
42         } else if (!numberOfRows && !emptyListHiding) { 
43                 emptyListHiding = YES;
44                 previousAlpha = [[contactListView window] alphaValue];
45                 [[contactListView window] setAlphaValue:0.0];
46         }
49 @end