French updates
[adiumx.git] / Source / AIInterfaceController.h
blobf6ec7301d0ac708941d29441d0b3350e6b2127b9
1 /*
2 * Adium is the legal property of its developers, whose names are listed in the copyright file included
3 * with this source distribution.
4 *
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.
8 *
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;
50 @end
52 //Controls a contact list view
53 @protocol AIContactListViewController <NSObject>
54 - (NSView *)contactListView;
55 @end
57 @protocol AIMessageViewController <NSObject>
58 - (NSView *)messageView;
59 - (NSView *)messageScrollView;
60 @end
62 //Manages contact list view controllers
63 @protocol AIContactListViewPlugin <NSObject>
64 - (id <AIContactListViewController>)contactListViewController;
65 @end
67 //manages message view controllers
68 @protocol AIMessageViewPlugin <NSObject>
69 - (id <AIMessageViewController>)messageViewControllerForChat:(AIChat *)inChat;
70 @end
72 @protocol AIContactListTooltipEntry <NSObject>
73 - (NSString *)labelForObject:(AIListObject *)inObject;
74 - (NSAttributedString *)entryForObject:(AIListObject *)inObject;
75 @end
77 @protocol AIFlashObserver <NSObject>
78 - (void)flash:(int)value;
79 @end
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;
88 - (AIChat *)chat;
89 @end
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;
106 @end
108 @protocol AIContactListController <NSObject>
109 - (void)showContactListAndBringToFront:(BOOL)bringToFront;
110 - (BOOL)contactListIsVisibleAndMain;
111 - (void)closeContactList;
112 @end
114 typedef enum {
115 AINormalWindowLevel = 0,
116 AIFloatingWindowLevel = 1,
117 AIDesktopWindowLevel = 2
118 } AIWindowLevel;
120 //Identifiers for the various message views
121 typedef enum {
122 DCStandardMessageView = 1, //10.2 only, unless webkit is not available
123 DCWebkitMessageView //Preferred message view
124 } DCMessageViewType;
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;
149 float maxLabelWidth;
151 NSMutableArray *flashObserverArray;
152 NSTimer *flashTimer;
153 int flashState;
154 AIListObject *tooltipListObject;
155 NSMutableAttributedString *tooltipBody;
156 NSMutableAttributedString *tooltipTitle;
157 NSImage *tooltipImage;
159 NSString *errorTitle;
160 NSString *errorDesc;
163 BOOL closeMenuConfiguredForChat;
165 NSArray *_cachedOpenChats;
167 NSMutableArray *windowMenuArray;
169 AIChat *activeChat;
170 AIChat *mostRecentActiveChat;
172 BOOL tabbedChatting;
174 id <AIInterfaceController> interfacePlugin;
175 id <AIContactListController> contactListPlugin;
177 BOOL groupChatsByContactGroup;
178 BOOL arrangeChats;
181 - (void)registerInterfaceController:(id <AIInterfaceController>)inController;
182 - (void)registerContactListController:(id <AIContactListController>)inController;
183 - (BOOL)handleReopenWithVisibleWindows:(BOOL)visibleWindows;
185 //Contact List
186 - (IBAction)toggleContactList:(id)sender;
187 - (IBAction)showContactList:(id)sender;
188 - (IBAction)showContactListAndBringToFront:(id)sender;
189 - (IBAction)closeContactList:(id)sender;
191 //Messaging
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;
212 //Chat close menus
213 - (IBAction)closeMenu:(id)sender;
214 - (IBAction)closeChatMenu:(id)sender;
215 - (void)updateCloseMenuKeys;
217 //Window Menu
218 - (IBAction)showChatWindow:(id)sender;
219 - (void)updateActiveWindowMenuItem;
220 - (void)buildWindowMenu;
222 //Chat Cycling
223 - (IBAction)nextMessage:(id)sender;
224 - (IBAction)previousMessage:(id)sender;
226 //Message View
227 - (void)registerMessageViewPlugin:(id <AIMessageViewPlugin>)inPlugin;
228 - (id <AIMessageViewController>)messageViewControllerForChat:(AIChat *)inChat;
230 //Error Display
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;
238 - (int)flashState;
240 //Tooltips
241 - (void)registerContactListTooltipEntry:(id <AIContactListTooltipEntry>)inEntry secondaryEntry:(BOOL)isSecondary;
242 - (void)showTooltipForListObject:(AIListObject *)object atScreenPoint:(NSPoint)point onWindow:(NSWindow *)inWindow;
244 //Custom pasting
245 - (IBAction)paste:(id)sender;
246 - (IBAction)pasteFormatted:(id)sender;
248 //Custom printing
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;
256 //Window levels menu
257 - (NSMenu *)menuForWindowLevelsNotifyingTarget:(id)target;
259 //Private
260 - (void)initController;
261 - (void)finishIniting;
262 - (void)closeController;
264 @end
266 //Custom printing informal protocol
267 @interface NSObject (AdiumPrinting)
268 - (void)adiumPrint:(id)sender;
269 @end