2 * Adium is the legal property of its developers, whose names are listed in the copyright file included
3 * with this source distribution.
5 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
6 * General Public License as published by the Free Software Foundation; either version 2 of the License,
7 * or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
10 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11 * Public License for more details.
13 * You should have received a copy of the GNU General Public License along with this program; if not,
14 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 #import "ESContactSortConfigurationWindowController.h"
18 #import <Adium/AISortController.h>
21 * @class ESContactSortConfigurationWindowController
22 * @brief Window controller for configuring sorting options for an <tt>AISortController</tt>
24 @implementation ESContactSortConfigurationWindowController
27 * @brief Show the sort configuration window for a controller
29 * @param controller The controller to configure
31 + (id)showSortConfigurationWindowForController:(AISortController *)controller
33 static ESContactSortConfigurationWindowController *sharedSortConfigInstance = nil;
35 if(!sharedSortConfigInstance){
36 sharedSortConfigInstance = [[self alloc] initWithWindowNibName:@"SortConfiguration"];
38 //Remove those buttons we don't want. removeFromSuperview will confuse the window, so just make them invisible.
39 NSButton *standardWindowButton = [[sharedSortConfigInstance window] standardWindowButton:NSWindowMiniaturizeButton];
40 [standardWindowButton setFrame:NSMakeRect(0,0,0,0)];
41 standardWindowButton = [[sharedSortConfigInstance window] standardWindowButton:NSWindowZoomButton];
42 [standardWindowButton setFrame:NSMakeRect(0,0,0,0)];
45 [sharedSortConfigInstance configureForController:controller];
47 [sharedSortConfigInstance showWindow:nil];
49 return sharedSortConfigInstance;
53 * @brief Configure our window and view for a passed controller
55 - (void)configureForController:(AISortController *)controller
58 [[self window] setTitle:[controller configureSortWindowTitle]];
61 NSView *configureView = [controller configureView];
63 NSSize newSize = [configureView frame].size;
65 //This will resize the view to the current window size...
66 [[self window] setContentView:configureView];
68 //...so restore the window to the size this view really wants to be
69 [[self window] setContentSize:newSize];
73 * @brief Window did load
77 [super windowDidLoad];
79 [[self window] setTitle:AILocalizedString(@"Configure Sorting","Configure Sort window title")];