Frameworks/Adium Framework/Source/AIInterfaceControllerProtocol.h
author Zachary West <zacw@adium.im>
Tue Jun 02 17:22:19 2009 -0400 (2009-06-02)
changeset 2450 08aa9c3a346c
parent 2131 0846c7e2b617
child 2846 28d2f716a225
permissions -rw-r--r--
Create a new advanced preference called "Confirmations". Move Quit Confirmations there.

Adds a new confirmation type for closing message windows with more than 1 tab open. Fixes #12006.

This new preference has two options: always confirm, only confirm when there's unread content. Displays an alert sheet when trying to close the window.
David@0
     1
/*
David@0
     2
 *  AIInterfaceControllerProtocol.h
David@0
     3
 *  Adium
David@0
     4
 *
David@0
     5
 *  Created by Evan Schoenberg on 7/31/06.
David@0
     6
 *
David@0
     7
 */
David@0
     8
David@0
     9
#import <Adium/AIControllerProtocol.h>
David@0
    10
David@0
    11
#define Interface_ContactSelectionChanged				@"Interface_ContactSelectionChanged"
David@0
    12
David@0
    13
/*!
David@0
    14
 * @brief AIContactInfoInspectorDidChangeInspectedObject notification name
David@0
    15
 *
David@0
    16
 * userinfo is an NSDictionary with keys KEY_PREVIOUS_INSPECTED_OBJECT and KEY_NEW_INSPECTED_OBJECT and objects of class AIListObject
David@0
    17
 */
David@0
    18
#define AIContactInfoInspectorDidChangeInspectedObject	@"AIContactInfoInspectorWillChangeInspectedObject"
David@0
    19
#define KEY_PREVIOUS_INSPECTED_OBJECT	@"PreviousInspectedObject"
David@0
    20
#define KEY_NEW_INSPECTED_OBJECT		@"NewInspectedObject"
David@0
    21
David@0
    22
#define Interface_SendEnteredMessage				@"Interface_SendEnteredMessage"
David@0
    23
#define Interface_WillSendEnteredMessage 			@"Interface_WillSendEnteredMessage"
David@0
    24
#define Interface_DidSendEnteredMessage				@"Interface_DidSendEnteredMessage"
David@0
    25
#define Interface_ShouldDisplayErrorMessage			@"Interface_ShouldDisplayErrorMessage"
David@0
    26
#define Interface_ShouldDisplayQuestion				@"Interface_ShouldDisplayQuestion"
David@0
    27
#define Interface_ContactListDidBecomeMain			@"Interface_ContactListDidBecomeMain"
David@0
    28
#define Interface_ContactListDidResignMain			@"Interface_contactListDidResignMain"
David@0
    29
#define Interface_ContactListDidClose				@"Interface_contactListDidClose"
David@0
    30
#define Interface_TabArrangingPreferenceChanged		@"Interface_TabArrangingPreferenceChanged"
David@0
    31
#define AIViewDesiredSizeDidChangeNotification		@"AIViewDesiredSizeDidChangeNotification"
David@0
    32
David@0
    33
#define PREF_GROUP_INTERFACE			@"Interface"
David@0
    34
#define KEY_TABBED_CHATTING				@"Tabbed Chatting"
David@0
    35
#define KEY_GROUP_CHATS_BY_GROUP		@"Group Chats By Group"
David@0
    36
#define KEY_SAVE_CONTAINERS				@"Save Containers On Quit"
David@0
    37
#define KEY_CONTAINERS					@"Containers"
David@0
    38
David@0
    39
#define KEY_CL_WINDOW_LEVEL					@"Window Level"
David@0
    40
#define KEY_CL_HIDE							@"Hide While in Background"
David@0
    41
#define KEY_CL_EDGE_SLIDE					@"Hide On Screen Edges"
David@0
    42
#define KEY_CL_FLASH_UNVIEWED_CONTENT		@"Flash Unviewed Content"
David@0
    43
#define KEY_CL_ANIMATE_CHANGES				@"Animate Changes"
David@0
    44
#define KEY_CL_SHOW_TOOLTIPS				@"Show Tooltips"
David@0
    45
#define KEY_CL_SHOW_TOOLTIPS_IN_BACKGROUND	@"Show Tooltips in Background"
David@0
    46
#define KEY_CL_WINDOW_HAS_SHADOW			@"Window Has Shadow"
David@0
    47
zacw@2450
    48
#define PREF_GROUP_CONFIRMATIONS		@"Confirmations"
zacw@2450
    49
#define KEY_CONFIRM_QUIT				@"Confirm Quit"
zacw@2450
    50
#define KEY_CONFIRM_QUIT_TYPE			@"Confirm Quit Type"
zacw@2450
    51
#define KEY_CONFIRM_QUIT_FT				@"Suppress Quit Confirmation for File Transfers"
zacw@2450
    52
#define KEY_CONFIRM_QUIT_OPEN			@"Suppress Quit Confirmation for Open Chats"
zacw@2450
    53
#define KEY_CONFIRM_QUIT_UNREAD			@"Suppress Quit Confirmation for Unread Messages"
zacw@2450
    54
#define KEY_CONFIRM_MSG_CLOSE			@"Confirm Message Window Close"
zacw@2450
    55
#define KEY_CONFIRM_MSG_CLOSE_TYPE		@"Confirm Message Window Close Type"
zacw@2450
    56
David@0
    57
typedef enum {
David@0
    58
	AINormalWindowLevel = 0,
David@0
    59
	AIFloatingWindowLevel = 1,
David@0
    60
	AIDesktopWindowLevel = 2
David@0
    61
} AIWindowLevel;
David@0
    62
David@0
    63
//Identifiers for the various message views
David@0
    64
typedef enum {
David@0
    65
	DCStandardMessageView = 1,	//webkit is not available
David@0
    66
	DCWebkitMessageView			//Preferred message view
David@0
    67
} DCMessageViewType;
David@0
    68
David@0
    69
@protocol AIInterfaceComponent, AIContactListComponent, AIMessageDisplayController, AIMessageDisplayPlugin;
David@0
    70
@protocol AIContactListTooltipEntry, AIFlashObserver;
David@0
    71
zacw@1588
    72
@class AIListWindowController, AIMessageWindowController, AIMessageViewController;
David@0
    73
David@52
    74
@class AIChat, AIListObject, AIListGroup, AIContactList;
David@0
    75
David@0
    76
@protocol AIInterfaceController <AIController>
David@0
    77
- (void)registerInterfaceController:(id <AIInterfaceComponent>)inController;
David@0
    78
- (void)registerContactListController:(id <AIContactListComponent>)inController;
David@0
    79
David@0
    80
/*!	@brief	Implement handling of the reopen Apple Event.
David@0
    81
 *
David@0
    82
 *	@par	The reopen handler should respond by making sure that at least one of Adium's windows is visible.
David@0
    83
 *
David@0
    84
 *	@par	Adium.app's implementation handles this event this way:
David@0
    85
 *
David@0
    86
 *	@li	If there are no chat windows, shows the Contact List.
David@0
    87
 *	@li	Else, if the foremost chat window and chat tab has unviewed content, make sure it stays foremost (bringing it forward of the Contact List, if necessary).
David@0
    88
 *	@li	Else, if any chat window has unviewed content, bring foremost the chat window and chat tab with the most recent unviewed content.
David@0
    89
 *	@li	Else, if all chat windows are minimized, unminimize one of them.
David@0
    90
 *	@li	If the application is hidden, unhide it.
David@0
    91
 *
David@0
    92
 *	@return	A value suitable for returning from the \c NSApplication delegate method <code>applicationShouldHandleReopen:hasVisibleWindows:
David@0
    93
</code>. Specifically: \c YES if AppKit should perform its usual response to the event; \c NO if AppKit should do nothing.
David@0
    94
 */
David@0
    95
- (BOOL)handleReopenWithVisibleWindows:(BOOL)visibleWindows;
David@0
    96
David@0
    97
//Contact List
David@0
    98
/*! @name Contact List */
David@0
    99
/* @{ */
David@0
   100
/*!
David@0
   101
 * @brief Brings contact list to the front
David@0
   102
 */
David@0
   103
- (IBAction)showContactList:(id)sender;
David@0
   104
/*!
David@0
   105
 * @brief Close the contact list window
David@0
   106
 */
David@0
   107
- (IBAction)closeContactList:(id)sender;
David@0
   108
/*!
David@0
   109
 * @returns YES if contact list is visible and selected, otherwise NO
David@0
   110
 */
Evan@166
   111
@property (nonatomic, readonly) BOOL contactListIsVisibleAndMain;
David@0
   112
/*!
David@0
   113
 * @returns YES if contact list is visible, otherwise NO
David@0
   114
 */
Evan@166
   115
@property (nonatomic, readonly) BOOL contactListIsVisible;
David@0
   116
/*! @} */
David@0
   117
David@0
   118
#pragma mark Detachable Contact List
David@0
   119
/*!
David@0
   120
 * @brief Create a new AIListWindowController to display a given contact list group in a detached window
David@0
   121
 *
David@0
   122
 * @result Created contact list controller for detached contact list
David@0
   123
 */
David@52
   124
- (AIListWindowController *)detachContactList:(AIContactList *)aContactList;
David@0
   125
David@0
   126
#pragma mark Messaging
David@0
   127
/*!
David@0
   128
 * @brief Opens tab or window for a chat (following user's preferences)
David@0
   129
 *
David@0
   130
 * @param inChat The chat. If already open, the chat will be brought to the front.
David@0
   131
 */
David@0
   132
- (void)openChat:(AIChat *)inChat;
David@0
   133
David@0
   134
/*!
David@0
   135
 * @brief Opens a chat in a given container at a specific index
David@0
   136
 *
David@0
   137
 * NOTE: If the chat is already open, this won't move it and instead does nothing. Perhaps it should, though :)
David@0
   138
 *
David@0
   139
 * @param inChat The chat.
David@0
   140
 * @param containerID The name of the container window.
David@0
   141
 * @param index The index within that containter window.
David@0
   142
 */
David@3
   143
- (id)openChat:(AIChat *)inChat inContainerWithID:(NSString *)containerID atIndex:(NSUInteger)index;
David@0
   144
David@0
   145
/*!
David@0
   146
 * @brief Move a chat to a new window container
David@0
   147
 *
David@0
   148
 * NOTE: The chat must already be open. That's a bug.
David@0
   149
 */
David@0
   150
- (void)moveChatToNewContainer:(AIChat *)inChat;
David@0
   151
David@0
   152
/*!
David@0
   153
 * @brief Close the interface for a chat
David@0
   154
 *
David@0
   155
 * @param inChat The chat
David@0
   156
 */
David@0
   157
- (void)closeChat:(AIChat *)inChat;
David@0
   158
David@0
   159
/*!
David@0
   160
 * @brief Consolidate all open chats into a single container
David@0
   161
 */
David@0
   162
- (void)consolidateChats;
David@0
   163
David@0
   164
/*!
Evan@166
   165
 * @brief Active Chat property
Evan@166
   166
 *
Evan@166
   167
 * Setter brings the tab/window for a chat to the front and sets it as active
Evan@166
   168
 * If no chat is active (a non-chat window is focued, or Adium is not focused), getter returns nil.
David@0
   169
 */
Evan@166
   170
@property (nonatomic, retain) AIChat *activeChat;
David@0
   171
David@0
   172
/*!
David@0
   173
 * @brief Get the chat which was most recently active
David@0
   174
 *
David@0
   175
 * If -[self activeChat] is non-nil, this will be the same as activeChat. However, if no chat is active, so long
David@0
   176
 * as any chat is open, this will return the chat most recently active.  If no chats are open, this will return nil.
David@0
   177
 */
Evan@166
   178
@property (nonatomic, readonly) AIChat *mostRecentActiveChat;
David@0
   179
David@0
   180
/*!
David@0
   181
 * @brief Get all open chats
David@0
   182
 *
David@0
   183
 * @result The open chats. Returns an empty array if no chats are open.
David@0
   184
 */
Evan@166
   185
@property (nonatomic, readonly) NSArray *openChats;
David@0
   186
David@0
   187
/*!
David@0
   188
 * @brief Get all open chats in a given container.
David@0
   189
 *
David@0
   190
 * @result The array of open chats. Returns nil if no container with containerID exists.
David@0
   191
 */
David@0
   192
- (NSArray *)openChatsInContainerWithID:(NSString *)containerID;
David@0
   193
David@0
   194
/*!
David@0
   195
 * @brief Get an array of the containerIDs of all open containers
David@0
   196
 */
Evan@166
   197
@property (nonatomic, readonly) NSArray *openContainerIDs;
David@0
   198
David@0
   199
/*!
David@0
   200
 * @brief Open a new container with a given ID and name
David@0
   201
 *
David@0
   202
 * @param containerID The container's ID. Pass nil to let Adium generate one
David@0
   203
 * @param containerName THe name of the container. Pass nil to not specify one.
David@0
   204
 *
David@0
   205
 * @result The newly created AIMessageWindowController
David@0
   206
 */
David@0
   207
- (AIMessageWindowController *)openContainerWithID:(NSString *)containerID name:(NSString *)containerName;
David@0
   208
David@0
   209
/*!
David@0
   210
 * @brief Cycles to the next open chat, making it active
David@0
   211
 *
David@0
   212
 * This crosses container boundaries.
David@0
   213
 */
David@0
   214
- (void)nextChat:(id)sender;
David@0
   215
David@0
   216
/*!
David@0
   217
 * @brief Cycles to the previous open chat, making it active
David@0
   218
 *
David@0
   219
 * This crosses container boundaries.
David@0
   220
 */
David@0
   221
- (void)previousChat:(id)sender;
David@0
   222
David@0
   223
#pragma mark Interface plugin callbacks
David@0
   224
/*!
David@0
   225
 * @brief A chat window did open: rebuild our window menu to show the new chat
David@0
   226
 *
David@0
   227
 * This should be called by the interface plugin (e.g. AIDualWindowInterfacePlugin) after a chat opens
David@0
   228
 *
David@0
   229
 * @param inChat Newly created chat 
David@0
   230
 */
David@0
   231
- (void)chatDidOpen:(AIChat *)inChat;
David@0
   232
David@0
   233
/*!
David@0
   234
 * @brief A chat has become active: update our chat closing keys and flag this chat as selected in the window menu
David@0
   235
 *
David@0
   236
 * This should be called by the interface plugin (e.g. AIDualWindowInterfacePlugin) 
David@0
   237
 *
David@0
   238
 * @param inChat Chat which has become active
David@0
   239
 */
David@0
   240
- (void)chatDidBecomeActive:(AIChat *)inChat;
David@0
   241
David@0
   242
/*!
David@0
   243
 * @brief A chat has become visible: send out a notification for components and plugins to take action
David@0
   244
 *
David@0
   245
 * This should be called by the interface plugin (e.g. AIDualWindowInterfacePlugin) 
David@0
   246
 *
David@0
   247
 * @param inChat Chat that has become active
David@0
   248
 * @param inWindow Containing chat window
David@0
   249
 */
David@0
   250
- (void)chatDidBecomeVisible:(AIChat *)inChat inWindow:(NSWindow *)inWindow;
David@0
   251
David@0
   252
/*!
David@0
   253
 * @brief A chat window did close: rebuild our window menu to remove the chat
David@0
   254
 *
David@0
   255
 * This should be called by the interface plugin (e.g. AIDualWindowInterfacePlugin) 
David@0
   256
 * 
David@0
   257
 * @param inChat Chat that closed
David@0
   258
 */
David@0
   259
- (void)chatDidClose:(AIChat *)inChat;
David@0
   260
David@0
   261
/*!
David@0
   262
 * @brief The order of chats has changed: rebuild our window menu to reflect the new order
David@0
   263
 *
David@0
   264
 * This should be called by the interface plugin (e.g. AIDualWindowInterfacePlugin) 
David@0
   265
 */
David@0
   266
- (void)chatOrderDidChange;
David@0
   267
David@0
   268
#pragma mark Chat window access
David@0
   269
/*!
David@0
   270
 * @brief Find the window currently displaying a chat
David@0
   271
 *
David@0
   272
 * @returns Window for chat otherwise if the chat is not in any window, or is not visible in any window, returns nil
David@0
   273
 */
David@0
   274
- (NSWindow *)windowForChat:(AIChat *)inChat;
David@0
   275
David@0
   276
David@0
   277
/*!
David@0
   278
 * @brief Find the chat active in a window
David@0
   279
 *
David@0
   280
 * If the window does not have an active chat, nil is returned
David@0
   281
 */
David@0
   282
- (AIChat *)activeChatInWindow:(NSWindow *)window;
David@0
   283
David@0
   284
#pragma mark Interface selection
David@0
   285
/*!
David@0
   286
 * @brief Get the list object currently focused in the interface
David@0
   287
 *
David@0
   288
 * We find the first responder that knows about list objects and get its selected object.
David@0
   289
 * This may be, for example, the contact list or a chat window.
David@0
   290
 */
David@426
   291
@property (readonly, nonatomic) AIListObject *selectedListObject;
David@0
   292
David@0
   293
/*!
David@0
   294
 * @brief Get the list object currently selected in the contact list
David@0
   295
 *
David@0
   296
 * If multiple objects are selected, this returns the first one. If possible, use arrayOfSelectedListObjectsInContactList and
David@0
   297
 * handle multiple selections.
David@0
   298
 */
David@426
   299
@property (readonly, nonatomic) AIListObject *selectedListObjectInContactList;
David@0
   300
David@0
   301
/*!
David@0
   302
 * @brief Get the list objects currently selected in the contact list
David@0
   303
 *
David@0
   304
 * @result An NSArray of selected objects
David@0
   305
 */
David@426
   306
@property (readonly, nonatomic) NSArray *arrayOfSelectedListObjectsInContactList;
David@0
   307
zacw@2131
   308
/*!
zacw@2131
   309
 * @brief Get the list objects currently selected in the contact list with their groups
zacw@2131
   310
 *
zacw@2131
   311
 * Each entry in the NSArray is an NSDictionary of the following layout:
zacw@2131
   312
 *
zacw@2131
   313
 * @"ListObject" => the AIListObject
zacw@2131
   314
 * @"ContainingObject" => the containing object
zacw@2131
   315
 *
zacw@2131
   316
 * @result An NSArray of selected objects
zacw@2131
   317
 */
zacw@2131
   318
@property (readonly, nonatomic) NSArray *arrayOfSelectedListObjectsWithGroupsInContactList;
zacw@2131
   319
David@0
   320
#pragma mark Message View
David@0
   321
/*!
David@0
   322
 * @brief Register an object which can handle displaying messages
David@0
   323
 *
David@0
   324
 * See @protocol AIMessageDisplayPlugin for details. An example of such an object is the WebKit Message View plugin.
David@0
   325
 *
David@0
   326
 * @param inPlugin The object, which must conform to @protocol(AIMessageDisplayPlugin)
David@0
   327
 */
David@0
   328
- (void)registerMessageDisplayPlugin:(id <AIMessageDisplayPlugin>)inPlugin;
David@0
   329
David@0
   330
/*!
David@0
   331
 * @brief Unregister an object previously registered with registerMessageDisplayPlugin.
David@0
   332
 */
David@0
   333
- (void)unregisterMessageDisplayPlugin:(id <AIMessageDisplayPlugin>)inPlugin;
David@0
   334
David@0
   335
/*!
David@0
   336
 * @brief Get the AIMessageDisplayController-conforming object for a chat
David@0
   337
 *
David@0
   338
 * Every chat has exactly one. You can get it!
David@0
   339
 */
David@0
   340
- (id <AIMessageDisplayController>)messageDisplayControllerForChat:(AIChat *)inChat;
David@0
   341
David@0
   342
#pragma mark Error Display
David@0
   343
- (void)handleErrorMessage:(NSString *)inTitle withDescription:(NSString *)inDesc;
David@0
   344
- (void)handleMessage:(NSString *)inTitle withDescription:(NSString *)inDesc withWindowTitle:(NSString *)inWindowTitle;
David@0
   345
David@0
   346
#pragma mark Question Display
David@0
   347
- (void)displayQuestion:(NSString *)inTitle withAttributedDescription:(NSAttributedString *)inDesc withWindowTitle:(NSString *)inWindowTitle
wixardy@2118
   348
		  defaultButton:(NSString *)inDefaultButton alternateButton:(NSString *)inAlternateButton otherButton:(NSString *)inOtherButton suppression:(NSString *)inSuppression
David@0
   349
				 target:(id)inTarget selector:(SEL)inSelector userInfo:(id)inUserInfo;
David@0
   350
- (void)displayQuestion:(NSString *)inTitle withDescription:(NSString *)inDesc withWindowTitle:(NSString *)inWindowTitle
wixardy@2118
   351
		  defaultButton:(NSString *)inDefaultButton alternateButton:(NSString *)inAlternateButton otherButton:(NSString *)inOtherButton suppression:(NSString *)inSuppression
David@0
   352
				 target:(id)inTarget selector:(SEL)inSelector userInfo:(id)inUserInfo;
David@0
   353
David@0
   354
#pragma mark Synchronized Flashing
David@0
   355
- (void)registerFlashObserver:(id <AIFlashObserver>)inObserver;
David@0
   356
- (void)unregisterFlashObserver:(id <AIFlashObserver>)inObserver;
David@0
   357
- (int)flashState;
David@0
   358
David@0
   359
#pragma mark Tooltips
David@0
   360
/*!
David@0
   361
 * @brief Register a tooltip-supplying object
David@0
   362
 *
David@0
   363
 * @param inEntry The object which will be queried for information when building a tooltip. Must conform to the AIContactListTooltipEntry protocol.
David@0
   364
 * @param isSecondary Most tooltips are secondary; this means they are displayed in the bottom half of the tooltip which can expand as needed.
David@0
   365
 */
David@0
   366
- (void)registerContactListTooltipEntry:(id <AIContactListTooltipEntry>)inEntry secondaryEntry:(BOOL)isSecondary;
David@0
   367
David@0
   368
/*!
David@0
   369
 * @brief Unregister a previously reigstered tooltip-supplying object
David@0
   370
 *
David@0
   371
 * @param inEntry The object to unregister
David@0
   372
 * @param isSecondary This should match the value passed to registerContactListTooltipEntry:secondaryEntry:
David@0
   373
 */
David@0
   374
- (void)unregisterContactListTooltipEntry:(id <AIContactListTooltipEntry>)inEntry secondaryEntry:(BOOL)isSecondary;
David@0
   375
David@0
   376
/*!
David@0
   377
 * @brief Get an array of all primary contact list tooltip entries
David@0
   378
 *
David@0
   379
 * @result An NSArray of objects conforming to AIContactListTooltipEntry
David@0
   380
 */
David@0
   381
- (NSArray *)contactListTooltipPrimaryEntries;
David@0
   382
David@0
   383
/*!
David@0
   384
 * @brief Get an array of all secondary contact list tooltip entries
David@0
   385
 *
David@0
   386
 * @result An NSArray of objects conforming to AIContactListTooltipEntry
David@0
   387
 */
David@0
   388
- (NSArray *)contactListTooltipSecondaryEntries;
David@0
   389
David@0
   390
/*!
David@0
   391
 * @brief Show an object's tooltip at a given point
David@0
   392
 *
David@0
   393
 * If object is not nil, the tooltip box will be shown for that object at the given point. It is created if needed;
David@0
   394
 * if there is an existing object tooltip, that window is moved to the given point and reconfigured for object.
David@0
   395
 * This is a rich-text, information-rich tooltip, not a simple text tooltip as seen elsewhere in Mac OS X.
David@0
   396
 *
David@0
   397
 * @param object The object for which the tooltip should be shown. Pass nil to hide any existing tooltip.
David@0
   398
 * @param point The point in screen coordinates for the tooltip's origin. If object is nil, this value is ignored.
David@0
   399
 * @param inWindow The window from which the tooltip is originating. If object is nil, this value is ignored.
David@0
   400
 */
David@0
   401
- (void)showTooltipForListObject:(AIListObject *)object atScreenPoint:(NSPoint)point onWindow:(NSWindow *)inWindow;
David@0
   402
David@0
   403
#pragma mark Window level menu
David@0
   404
/*!
David@0
   405
 * @brief Build a menu of possible window levels
David@0
   406
 *
David@0
   407
 * Window levels may be, for example, 'Above other windows' or 'Normally'.
David@0
   408
 *
David@0
   409
 * @param target The target on which @selector(selectedWindowLevel:) will be called when a menu item is selected
David@0
   410
 */
David@0
   411
- (NSMenu *)menuForWindowLevelsNotifyingTarget:(id)target;
David@0
   412
David@0
   413
@end
David@0
   414
David@0
   415
//Controls a contact list view
David@0
   416
@protocol AIContactListViewController <NSObject>	
David@0
   417
- (NSView *)contactListView;
David@0
   418
@end
David@0
   419
David@0
   420
//Manages contact list view controllers
David@0
   421
@protocol AIContactListController <NSObject>	
David@0
   422
- (id <AIContactListViewController>)contactListViewController;
David@0
   423
@end
David@0
   424
David@0
   425
/*!
David@0
   426
 * @protocol AIMessageDisplayController
David@0
   427
 * @brief    The message display controller is responsible for, unsurprisingly, the actual display of messages.
David@0
   428
 *
David@0
   429
 * The display controller manages a view ("messageView") which will be inserted along with other UI elements such
David@0
   430
 * as a text entry area into a window.  The Interface Plugin knows nothing about how the AIMessageDisplayController 
David@0
   431
 * keeps its messageView up to date, nor should it, but knows that the view will show messages.
David@0
   432
 *
David@0
   433
 * The AIMessageDisplayController is informed when the message view which is using it is closing.
David@0
   434
 *
David@0
   435
 * This is, for example, the AIWebKitMessageViewController.
David@0
   436
 */
David@0
   437
@protocol AIMessageDisplayController <NSObject>
David@0
   438
- (void)setChatContentSource:(NSString *)source;
David@0
   439
- (NSString *)chatContentSource;
David@0
   440
- (NSString *)contentSourceName; // Unique name for this particular style of "content source".
David@0
   441
David@0
   442
- (NSView *)messageView;
David@0
   443
- (NSView *)messageScrollView;
David@0
   444
- (void)messageViewIsClosing;
David@0
   445
- (void)clearView;
zacw@1581
   446
zacw@1543
   447
- (void)jumpToPreviousMark;
zacw@1581
   448
- (BOOL)previousMarkExists;
zacw@1581
   449
zacw@1543
   450
- (void)jumpToNextMark;
zacw@1581
   451
- (BOOL)nextMarkExists;
zacw@1581
   452
zacw@1543
   453
- (void)jumpToFocusMark;
zacw@1581
   454
- (BOOL)focusMarkExists;
zacw@1581
   455
zacw@1543
   456
- (void)addMark;
zacw@1537
   457
- (void)markForFocusChange;
David@0
   458
@end
David@0
   459
David@0
   460
/*
David@0
   461
 * @protocol AIMessageDisplayPlugin
David@0
   462
 * @brief    A AIMessageDisplayPlugin provides AIMessageDisplayController objects on demand.
David@0
   463
 *
David@0
   464
 * The WebKit display plugin is one example.
David@0
   465
 */
David@0
   466
@protocol AIMessageDisplayPlugin <NSObject, AIPlugin>	
David@0
   467
- (id <AIMessageDisplayController>)messageDisplayControllerForChat:(AIChat *)inChat;
David@0
   468
@end
David@0
   469
David@0
   470
@protocol AIContactListTooltipEntry <NSObject>
David@0
   471
- (NSString *)labelForObject:(AIListObject *)inObject;
David@0
   472
- (NSAttributedString *)entryForObject:(AIListObject *)inObject;
David@0
   473
- (BOOL)shouldDisplayInContactInspector;
David@0
   474
@end
David@0
   475
David@0
   476
@protocol AIFlashObserver <NSObject>
David@0
   477
- (void)flash:(int)value;
David@0
   478
@end
David@0
   479
David@0
   480
//Handles any attributed text entry
David@0
   481
@protocol AITextEntryView 
David@0
   482
- (void)setAttributedString:(NSAttributedString *)inAttributedString;
David@0
   483
- (void)setTypingAttributes:(NSDictionary *)attrs;
David@0
   484
- (BOOL)availableForSending;
David@0
   485
- (AIChat *)chat;
David@0
   486
@end
David@0
   487
David@0
   488
@protocol AIInterfaceComponent <NSObject>
David@0
   489
- (void)openInterface;
David@0
   490
- (void)closeInterface;
David@3
   491
- (id)openChat:(AIChat *)chat inContainerWithID:(NSString *)containerID withName:(NSString *)containerName atIndex:(NSUInteger)index;
David@0
   492
- (void)setActiveChat:(AIChat *)inChat;
David@3
   493
- (void)moveChat:(AIChat *)chat toContainerWithID:(NSString *)containerID index:(NSUInteger)index;
David@0
   494
- (void)moveChatToNewContainer:(AIChat *)inChat;
David@0
   495
- (void)closeChat:(AIChat *)chat;
David@0
   496
- (AIMessageWindowController *)openContainerWithID:(NSString *)containerID name:(NSString *)containerName;
David@0
   497
/*!
David@0
   498
 * @brief Return an array of NSDictionary objects for all open containers with associated information
David@0
   499
 * 
David@0
   500
 * The returned array has zero or more NSDictionary objects with the following information for each container
David@0
   501
 *	Key			Value
David@0
   502
 *	@"ID"		NSString of the containerID
David@0
   503
 *	@"Frame"	NSString of the window's [NSWindow frame]
David@0
   504
 *	@"Content"	NSArray of the AIChat objects within that container
David@0
   505
 *	@"ActiveChat"	AIChat that is currently active
David@0
   506
 *	@"Name"		NSString of the container's name
David@0
   507
 */
David@497
   508
@property (readonly, nonatomic) NSArray *openContainersAndChats;
David@497
   509
@property (readonly, nonatomic) NSArray *openContainerIDs;
David@497
   510
@property (readonly, nonatomic) NSArray *openChats;
David@0
   511
- (NSArray *)openChatsInContainerWithID:(NSString *)containerID;
David@0
   512
- (NSString *)containerIDForChat:(AIChat *)chat;
David@0
   513
- (NSWindow *)windowForChat:(AIChat *)chat;
David@0
   514
- (AIChat *)activeChatInWindow:(NSWindow *)window;
David@0
   515
@end
David@0
   516
David@0
   517
/*!
David@0
   518
 * @protocol AIInterfaceContainer
David@0
   519
 * @brief This protocol is for a general interface element such as the contact list or the container of a chat
David@0
   520
 */
David@0
   521
@protocol AIInterfaceContainer <NSObject>
David@0
   522
- (void)makeActive:(id)sender;	//Make the container active/front
David@0
   523
- (void)close:(id)sender;	//Close the container
David@0
   524
@end
David@0
   525
David@0
   526
/*!
David@0
   527
 * @protocol AIChatViewController
David@0
   528
 * @brief A AIChatViewController manages everything pertaining to a chat's view area
David@0
   529
 *
David@0
   530
 * It will manage this view, text input, and any associated controls.
David@0
   531
 */
David@0
   532
@protocol AIChatViewController <NSObject>
David@0
   533
- (NSView *)view;
David@0
   534
- (NSScrollView *)messagesScrollView;
David@0
   535
- (AIChat *)chat;
Evan@232
   536
Evan@232
   537
/*!
Evan@232
   538
 * @brief Show/hide the user list for a group chat.
Evan@232
   539
 * Does nothing if not in a group chat.
Evan@232
   540
 */
Evan@232
   541
- (void)toggleUserList;
Evan@232
   542
Evan@232
   543
/*!
Evan@232
   544
 * @brief Is the user list visible for a group chat?
Evan@232
   545
 */
Evan@232
   546
- (BOOL)userListVisible;
zacw@1587
   547
zacw@1587
   548
/*!
zacw@1587
   549
 * @brief Swap the side the user list is on for a group chat.
zacw@1587
   550
 * Does nothing if not in a group chat.
zacw@1587
   551
 */
zacw@1587
   552
- (void)toggleUserListSide;
David@0
   553
@end
David@0
   554
David@0
   555
/*!
David@0
   556
 * @protocol AIChatContainer
David@0
   557
 * @brief This protocol is for an object which displays a single chat (e.g. a tab in a chat window)
David@0
   558
 */
David@0
   559
@protocol AIChatContainer <AIInterfaceContainer>
David@0
   560
/*
David@0
   561
 * @brief Get the window controller which holds this AIChatContainer
David@0
   562
 */
David@497
   563
@property (readonly, nonatomic, retain) AIMessageWindowController *windowController;
David@0
   564
David@0
   565
/*
David@0
   566
 * @brief Get the view controller for this AIChatContainer
David@0
   567
 */
David@497
   568
@property (readonly, nonatomic) id <AIChatViewController> chatViewController;
zacw@1588
   569
zacw@1588
   570
/*!
zacw@1588
   571
 * @brief Get the message view controller for this AIChatContainer
zacw@1588
   572
 */
zacw@1588
   573
@property (readonly, nonatomic) AIMessageViewController *messageViewController;
David@0
   574
@end
David@0
   575
David@0
   576
@protocol AIContactListComponent <NSObject>
David@0
   577
/*!
David@0
   578
 * @brief Show the contact list window and bring Adium to the front
David@0
   579
 */
David@0
   580
- (void)showContactListAndBringToFront:(BOOL)bringToFront;
David@0
   581
- (BOOL)contactListIsVisibleAndMain;
David@0
   582
- (BOOL)contactListIsVisible;
David@0
   583
- (void)closeContactList;
David@0
   584
@end
David@0
   585
David@0
   586
@protocol AIMultiContactListComponent <AIContactListComponent>
David@52
   587
- (id)detachContactList:(AIContactList *)contactList;
David@0
   588
- (void)nextDetachedContactList;
David@0
   589
- (void)previousDetachedContactList;
David@0
   590
@end
David@0
   591
David@0
   592
//Custom printing informal protocol
David@0
   593
@interface NSObject (AdiumPrinting)
David@0
   594
- (void)adiumPrint:(id)sender;
David@0
   595
- (BOOL)validatePrintMenuItem:(NSMenuItem *)menuItem;
David@0
   596
@end
David@0
   597
David@0
   598
@interface NSWindowController (AdiumBorderlessWindowClosing)
David@0
   599
- (BOOL)windowPermitsClose;
David@0
   600
@end