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 #define Interface_ContactSelectionChanged @"Interface_ContactSelectionChanged"
18 #define Interface_SendEnteredMessage @"Interface_SendEnteredMessage"
19 #define Interface_WillSendEnteredMessage @"Interface_WillSendEnteredMessage"
20 #define Interface_DidSendEnteredMessage @"Interface_DidSendEnteredMessage"
21 #define Interface_ShouldClearTextEntryView @"Interface_ShouldClearTextEntryView"
22 #define Interface_ShouldDisplayErrorMessage @"Interface_ShouldDisplayErrorMessage"
23 #define Interface_ContactListDidBecomeMain @"Interface_ContactListDidBecomeMain"
24 #define Interface_ContactListDidResignMain @"Interface_contactListDidResignMain"
25 #define Interface_ContactListDidClose @"Interface_contactListDidClose"
26 #define Interface_TabArrangingPreferenceChanged @"Interface_TabArrangingPreferenceChanged"
27 #define AIViewDesiredSizeDidChangeNotification @"AIViewDesiredSizeDidChangeNotification"
29 #define PREF_GROUP_INTERFACE @"Interface"
30 #define KEY_TABBED_CHATTING @"Tabbed Chatting"
31 #define KEY_SORT_CHATS @"Sort Chats"
32 #define KEY_GROUP_CHATS_BY_GROUP @"Group Chats By Group"
34 #define PREF_GROUP_CONTACT_LIST @"Contact List"
35 #define KEY_CL_WINDOW_LEVEL @"Window Level"
36 #define KEY_CL_HIDE @"Hide While in Background"
37 #define KEY_CL_FLASH_UNVIEWED_CONTENT @"Flash Unviewed Content"
38 #define KEY_CL_SHOW_TRANSITIONS @"Show Transitions"
39 #define KEY_CL_SHOW_TOOLTIPS @"Show Tooltips"
40 #define KEY_CL_SHOW_TOOLTIPS_IN_BACKGROUND @"Show Tooltips in Background"
41 #define KEY_CL_WINDOW_HAS_SHADOW @"Window Has Shadow"
43 #define CONTACT_LIST_TITLE AILocalizedString(@"Contact List","Name of the window which lists contacts")
45 @
class AIMenuController
, AIChat
, AIListObject
;
47 //Sends Interface_ViewDesiredSizeDidChange notifications
48 @protocol AIAutoSizingView
49 - (NSSize
)desiredSize
;
52 //Controls a contact list view
53 @protocol AIContactListViewController
<NSObject
>
54 - (NSView
*)contactListView
;
57 @protocol AIMessageViewController
<NSObject
>
58 - (NSView
*)messageView
;
59 - (NSView
*)messageScrollView
;
62 //Manages contact list view controllers
63 @protocol AIContactListViewPlugin
<NSObject
>
64 - (id
<AIContactListViewController
>)contactListViewController
;
67 //manages message view controllers
68 @protocol AIMessageViewPlugin
<NSObject
>
69 - (id
<AIMessageViewController
>)messageViewControllerForChat
:(AIChat
*)inChat
;
72 @protocol AIContactListTooltipEntry
<NSObject
>
73 - (NSString
*)labelForObject
:(AIListObject
*)inObject
;
74 - (NSAttributedString
*)entryForObject
:(AIListObject
*)inObject
;
77 @protocol AIFlashObserver
<NSObject
>
78 - (void)flash
:(int)value
;
81 //Handles any attributed text entry
82 @protocol AITextEntryView
83 - (NSAttributedString
*)attributedString
;
84 - (void)setAttributedString
:(NSAttributedString
*)inAttributedString
;
85 - (void)setTypingAttributes
:(NSDictionary
*)attrs
;
86 - (BOOL
)availableForSending
;
87 - (BOOL
)isSendingContent
;
91 @protocol AIInterfaceController
<NSObject
>
92 - (void)openInterface
;
93 - (void)closeInterface
;
94 - (id
)openChat
:(AIChat
*)chat inContainerWithID
:(NSString
*)containerName atIndex
:(int)index
;
95 - (void)closeChat
:(AIChat
*)chat
;
96 - (AIChat
*)activeChat
;
97 - (void)setActiveChat
:(AIChat
*)inChat
;
98 - (void)moveChat
:(AIChat
*)chat toContainerWithID
:(NSString
*)containerID index
:(int)index
;
99 - (NSArray
*)openContainersAndChats
;
100 - (NSArray
*)openContainers
;
101 - (NSArray
*)openChats
;
102 - (NSArray
*)openChatsInContainerWithID
:(NSString
*)containerID
;
103 - (NSString
*)containerIDForChat
:(AIChat
*)chat
;
104 - (NSWindow
*)windowForChat
:(AIChat
*)chat
;
105 - (AIChat
*)activeChatInWindow
:(NSWindow
*)window
;
108 @protocol AIContactListController
<NSObject
>
109 - (void)showContactListAndBringToFront
:(BOOL
)bringToFront
;
110 - (BOOL
)contactListIsVisibleAndMain
;
111 - (void)closeContactList
;
115 AINormalWindowLevel
= 0,
116 AIFloatingWindowLevel
= 1,
117 AIDesktopWindowLevel
= 2
120 //Identifiers for the various message views
122 DCStandardMessageView
= 1, //10.2 only, unless webkit is not available
123 DCWebkitMessageView
//Preferred message view
126 @interface AIInterfaceController
: NSObject
{
127 IBOutlet AIMenuController
*menuController
;
128 IBOutlet AIAdium
*adium
;
130 IBOutlet NSMenuItem
*menuItem_close
;
131 IBOutlet NSMenuItem
*menuItem_closeChat
;
133 IBOutlet NSMenuItem
*menuItem_paste
;
134 IBOutlet NSMenuItem
*menuItem_pasteFormatted
;
136 IBOutlet NSMenuItem
*menuItem_bold
;
137 IBOutlet NSMenuItem
*menuItem_italic
;
139 IBOutlet NSMenuItem
*menuItem_showToolbar
;
140 IBOutlet NSMenuItem
*menuItem_customizeToolbar
;
142 IBOutlet NSMenuItem
*menuItem_print
;
144 NSMutableArray
*contactListViewArray
;
145 NSMutableArray
*messageViewArray
;
146 NSMutableArray
*interfaceArray
;
147 NSMutableArray
*contactListTooltipEntryArray
;
148 NSMutableArray
*contactListTooltipSecondaryEntryArray
;
151 NSMutableArray
*flashObserverArray
;
154 AIListObject
*tooltipListObject
;
155 NSMutableAttributedString
*tooltipBody
;
156 NSMutableAttributedString
*tooltipTitle
;
157 NSImage
*tooltipImage
;
159 NSString
*errorTitle
;
163 BOOL closeMenuConfiguredForChat
;
165 NSArray
*_cachedOpenChats
;
167 NSMutableArray
*windowMenuArray
;
170 AIChat
*mostRecentActiveChat
;
174 id
<AIInterfaceController
> interfacePlugin
;
175 id
<AIContactListController
> contactListPlugin
;
177 BOOL groupChatsByContactGroup
;
181 - (void)registerInterfaceController
:(id
<AIInterfaceController
>)inController
;
182 - (void)registerContactListController
:(id
<AIContactListController
>)inController
;
183 - (BOOL
)handleReopenWithVisibleWindows
:(BOOL
)visibleWindows
;
186 - (IBAction
)toggleContactList
:(id
)sender
;
187 - (IBAction
)showContactList
:(id
)sender
;
188 - (IBAction
)showContactListAndBringToFront
:(id
)sender
;
189 - (IBAction
)closeContactList
:(id
)sender
;
192 - (void)openChat
:(AIChat
*)inChat
;
193 - (void)closeChat
:(AIChat
*)inChat
;
194 - (void)consolidateChats
;
195 - (void)setActiveChat
:(AIChat
*)inChat
;
196 - (AIChat
*)activeChat
;
197 - (NSArray
*)openChats
;
198 - (NSArray
*)openChatsInContainerWithID
:(NSString
*)containerID
;
199 - (BOOL
)allowChatOrdering
;
200 - (int)indexForInsertingChat
:(AIChat
*)chat intoContainerWithID
:(NSString
*)containerID
;
202 //Interface plugin callbacks
203 - (void)chatDidOpen
:(AIChat
*)inChat
;
204 - (void)chatDidBecomeActive
:(AIChat
*)inChat
;
205 - (void)chatDidBecomeVisible
:(AIChat
*)inChat inWindow
:(NSWindow
*)inWindow
;
206 - (void)chatDidClose
:(AIChat
*)inChat
;
207 - (void)chatOrderDidChange
;
208 - (void)clearUnviewedContentOfChat
:(AIChat
*)inChat
;
209 - (NSWindow
*)windowForChat
:(AIChat
*)inChat
;
210 - (AIChat
*)activeChatInWindow
:(NSWindow
*)window
;
213 - (IBAction
)closeMenu
:(id
)sender
;
214 - (IBAction
)closeChatMenu
:(id
)sender
;
215 - (void)updateCloseMenuKeys
;
218 - (IBAction
)showChatWindow
:(id
)sender
;
219 - (void)updateActiveWindowMenuItem
;
220 - (void)buildWindowMenu
;
223 - (IBAction
)nextMessage
:(id
)sender
;
224 - (IBAction
)previousMessage
:(id
)sender
;
227 - (void)registerMessageViewPlugin
:(id
<AIMessageViewPlugin
>)inPlugin
;
228 - (id
<AIMessageViewController
>)messageViewControllerForChat
:(AIChat
*)inChat
;
231 - (void)handleErrorMessage
:(NSString
*)inTitle withDescription
:(NSString
*)inDesc
;
232 - (void)handleMessage
:(NSString
*)inTitle withDescription
:(NSString
*)inDesc withWindowTitle
:(NSString
*)inWindowTitle
;
234 //Synchronized Flashing
235 - (void)registerFlashObserver
:(id
<AIFlashObserver
>)inObserver
;
236 - (void)unregisterFlashObserver
:(id
<AIFlashObserver
>)inObserver
;
237 - (void)flashTimer
:(NSTimer
*)inTimer
;
241 - (void)registerContactListTooltipEntry
:(id
<AIContactListTooltipEntry
>)inEntry secondaryEntry
:(BOOL
)isSecondary
;
242 - (void)showTooltipForListObject
:(AIListObject
*)object atScreenPoint
:(NSPoint
)point onWindow
:(NSWindow
*)inWindow
;
245 - (IBAction
)paste
:(id
)sender
;
246 - (IBAction
)pasteFormatted
:(id
)sender
;
249 - (IBAction
)adiumPrint
:(id
)sender
;
251 //Custom Dimming menu items
252 - (IBAction
)toggleFontTrait
:(id
)sender
;
253 - (void)toggleToolbarShown
:(id
)sender
;
254 - (void)runToolbarCustomizationPalette
:(id
)sender
;
257 - (NSMenu
*)menuForWindowLevelsNotifyingTarget
:(id
)target
;
260 - (void)initController
;
261 - (void)finishIniting
;
262 - (void)closeController
;
266 //Custom printing informal protocol
267 @interface
NSObject (AdiumPrinting
)
268 - (void)adiumPrint
:(id
)sender
;