Implemented `-[AIMessageWindow handleCloseScriptCommand:]` to just close the window...
[adiumx.git] / Source / AIMessageWindow.m
blob0ca28093cc441718069814f7575c11b9eb2998d7
1 //
2 //  AIMessageWindow.m
3 //  Adium
4 //
5 //  Created by Evan Schoenberg on 12/26/05.
6 //
8 #import "AIMessageWindow.h"
9 #import "AIClickThroughThemeDocumentButton.h"
10 #import <AIUtilities/AIApplicationAdditions.h>
11 #import "AIMessageWindowController.h"
12 #import "AIInterfaceControllerProtocol.h"
14 /*!
15  * @class AIMessageWindow
16  * @brief This AIDockingWindow subclass serves message windows.
17  *
18  * It overrides the standardWindowButton:forStyleMask: class method to provide
19  * AIClickThroughThemeDocumentButton objects for NSWindowDocumentIconButton requests on 10.4 and earlier.
20  * Delegate methods in 10.5+ handle what we need.
21  */
22 @implementation AIMessageWindow
24 - (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation
26         if (!(self = [super initWithContentRect:contentRect styleMask:styleMask backing:bufferingType defer:deferCreation]))
27                 return nil;
29         return self;
32 /*!
33  * @brief Return the standard window button for a mask
34  *
35  * We return AIClickThroughThemeDocumentButton instead of NSThemeDocumentButton to provide
36  * click-through dragging behavior on 10.4 and earlier.
37  */
38 + (NSButton *)standardWindowButton:(NSWindowButton)button forStyleMask:(unsigned int)styleMask
40         NSButton *standardWindowButton = [super standardWindowButton:button forStyleMask:styleMask];
42         if (![NSApp isOnLeopardOrBetter]) {
43                 if (button == NSWindowDocumentIconButton) {
44                         [NSKeyedArchiver setClassName:@"AIClickThroughThemeDocumentButton" forClass:[NSThemeDocumentButton class]];
45                         standardWindowButton = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:standardWindowButton]];
46                         
47                         [[standardWindowButton retain] autorelease];
48                 }
49         }
50         
51         return standardWindowButton;
54 - (NSScriptObjectSpecifier *)objectSpecifier
56         NSScriptClassDescription *containerClassDesc = (NSScriptClassDescription *)[NSScriptClassDescription classDescriptionForClass:[NSApp class]];
57         return [[NSUniqueIDSpecifier alloc]
58                         initWithContainerClassDescription:containerClassDesc
59                         containerSpecifier:nil key:@"chatWindows"
60                         uniqueID:[NSNumber numberWithUnsignedInt:[self hash]]];
63 - (NSArray *)chats
65         return [(AIMessageWindowController *)[self windowController] containedChats];
68 - (id)handleCloseScriptCommand:(NSCloseCommand *)command
70         [self performClose:nil];
72         return nil;
75 @end