Merged [21104]: Using NSBundle's methods properly rather than making up our own paths...
[adiumx.git] / Source / AIMessageWindow.m
blob752ec8e29f3cfabe82f52f305167461524558041
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>
12 /*!
13  * @class AIMessageWindow
14  * @brief This AIDockingWindow subclass serves message windows.
15  *
16  * It overrides the standardWindowButton:forStyleMask: class method to provide
17  * AIClickThroughThemeDocumentButton objects for NSWindowDocumentIconButton requests on 10.4 and earlier.
18  * Delegate methods in 10.5+ handle what we need.
19  */
20 @implementation AIMessageWindow
22 /*!
23  * @brief Return the standard window button for a mask
24  *
25  * We return AIClickThroughThemeDocumentButton instead of NSThemeDocumentButton to provide
26  * click-through dragging behavior on 10.4 and earlier.
27  */
28 + (NSButton *)standardWindowButton:(NSWindowButton)button forStyleMask:(unsigned int)styleMask
30         NSButton *standardWindowButton = [super standardWindowButton:button forStyleMask:styleMask];
32         if (![NSApp isOnLeopardOrBetter]) {
33                 if (button == NSWindowDocumentIconButton) {
34                         [NSKeyedArchiver setClassName:@"AIClickThroughThemeDocumentButton" forClass:[NSThemeDocumentButton class]];
35                         standardWindowButton = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:standardWindowButton]];
36                         
37                         [[standardWindowButton retain] autorelease];
38                 }
39         }
40         
41         return standardWindowButton;
44 @end