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. |
---|
12 | * |
---|
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. |
---|
15 | */ |
---|
16 | |
---|
17 | #import <Adium/AIWindowController.h> |
---|
18 | #import <Adium/AIListObject.h> |
---|
19 | #import <Adium/AIListContact.h> |
---|
20 | #import <AIUtilities/AISmoothTooltipTracker.h> |
---|
21 | |
---|
22 | @class AIAutoScrollView, AIListOutlineView, AIListContactCell, AIListGroupCell, ESObjectWithProperties, AIListObject, AIChat; |
---|
23 | |
---|
24 | #define LIST_LAYOUT_FOLDER @"Contact List" |
---|
25 | #define LIST_LAYOUT_EXTENSION @"ListLayout" |
---|
26 | #define PREF_GROUP_LIST_LAYOUT @"List Layout" |
---|
27 | |
---|
28 | #define KEY_LIST_LAYOUT_ALIGNMENT @"Contact Text Alignment" |
---|
29 | #define KEY_LIST_LAYOUT_GROUP_ALIGNMENT @"Group Text Alignment" |
---|
30 | #define KEY_LIST_LAYOUT_SHOW_ICON @"Show User Icon" |
---|
31 | #define KEY_LIST_LAYOUT_USER_ICON_SIZE @"User Icon Size" |
---|
32 | #define KEY_LIST_LAYOUT_SHOW_EXT_STATUS @"Show Extended Status" |
---|
33 | #define KEY_LIST_LAYOUT_SHOW_STATUS_ICONS @"Show Status Icons" |
---|
34 | #define KEY_LIST_LAYOUT_SHOW_SERVICE_ICONS @"Show Service Icons" |
---|
35 | #define KEY_LIST_LAYOUT_WINDOW_STYLE @"Window Style" |
---|
36 | |
---|
37 | #define KEY_LIST_LAYOUT_EXTENDED_STATUS_STYLE @"Extended Status Style" |
---|
38 | #define KEY_LIST_LAYOUT_EXTENDED_STATUS_POSITION @"Extended Status Position" |
---|
39 | #define KEY_LIST_LAYOUT_USER_ICON_POSITION @"User Icon Position" |
---|
40 | #define KEY_LIST_LAYOUT_STATUS_ICON_POSITION @"Status Icon Position" |
---|
41 | #define KEY_LIST_LAYOUT_SERVICE_ICON_POSITION @"Service Icon Position" |
---|
42 | |
---|
43 | #define KEY_LIST_LAYOUT_CONTACT_SPACING @"Contact Spacing" |
---|
44 | #define KEY_LIST_LAYOUT_GROUP_TOP_SPACING @"Group Top Spacing" |
---|
45 | |
---|
46 | #define KEY_LIST_LAYOUT_VERTICAL_AUTOSIZE @"Vertical Autosizing" |
---|
47 | #define KEY_LIST_LAYOUT_HORIZONTAL_AUTOSIZE @"Horizontal Autosizing" |
---|
48 | #define KEY_LIST_LAYOUT_HORIZONTAL_WIDTH @"Horizontal Width" |
---|
49 | #define KEY_LIST_LAYOUT_WINDOW_OPACITY @"Window Opacity" |
---|
50 | |
---|
51 | #define KEY_LIST_LAYOUT_CONTACT_FONT @"Contact Font" |
---|
52 | #define KEY_LIST_LAYOUT_STATUS_FONT @"Status Font" |
---|
53 | #define KEY_LIST_LAYOUT_GROUP_FONT @"Group Font" |
---|
54 | |
---|
55 | #define KEY_LIST_LAYOUT_CONTACT_LEFT_INDENT @"Contact Left Indent" |
---|
56 | #define KEY_LIST_LAYOUT_CONTACT_RIGHT_INDENT @"Contact Right Indent" |
---|
57 | |
---|
58 | #define KEY_LIST_LAYOUT_OUTLINE_BUBBLE @"Outline Bubble" |
---|
59 | #define KEY_LIST_LAYOUT_CONTACT_BUBBLE_GRADIENT @"Contact Bubble Draw With Gradient" |
---|
60 | #define KEY_LIST_LAYOUT_GROUP_HIDE_BUBBLE @"Group Hide Bubble" |
---|
61 | #define KEY_LIST_LAYOUT_OUTLINE_BUBBLE_WIDTH @"Outline Bubble Line Width" |
---|
62 | |
---|
63 | typedef enum { |
---|
64 | AIContactListWindowStyleStandard = 0, |
---|
65 | AIContactListWindowStyleBorderless, |
---|
66 | AIContactListWindowStyleGroupBubbles, |
---|
67 | AIContactListWindowStyleContactBubbles, |
---|
68 | AIContactListWindowStyleContactBubbles_Fitted |
---|
69 | } AIContactListWindowStyle; |
---|
70 | |
---|
71 | typedef enum { |
---|
72 | LIST_POSITION_NA = -1, |
---|
73 | LIST_POSITION_FAR_LEFT, |
---|
74 | LIST_POSITION_LEFT, |
---|
75 | LIST_POSITION_RIGHT, |
---|
76 | LIST_POSITION_FAR_RIGHT, |
---|
77 | LIST_POSITION_BADGE_LEFT, |
---|
78 | LIST_POSITION_BADGE_RIGHT, |
---|
79 | } LIST_POSITION; |
---|
80 | |
---|
81 | typedef enum { |
---|
82 | EXTENDED_STATUS_POSITION_BESIDE_NAME = 0, |
---|
83 | EXTENDED_STATUS_POSITION_BELOW_NAME, |
---|
84 | EXTENDED_STATUS_POSITION_BOTH |
---|
85 | } EXTENDED_STATUS_POSITION; |
---|
86 | |
---|
87 | typedef enum { |
---|
88 | STATUS_ONLY = 0, |
---|
89 | IDLE_ONLY, |
---|
90 | IDLE_AND_STATUS |
---|
91 | } EXTENDED_STATUS_STYLE; |
---|
92 | |
---|
93 | //AIListThemeWindowController defines |
---|
94 | #define LIST_THEME_FOLDER @"Contact List" |
---|
95 | #define LIST_THEME_EXTENSION @"ListTheme" |
---|
96 | #define PREF_GROUP_LIST_THEME @"List Theme" |
---|
97 | |
---|
98 | // Contact List Colors Enabled |
---|
99 | #define KEY_AWAY_ENABLED @"Away Enabled" |
---|
100 | #define KEY_IDLE_ENABLED @"Idle Enabled" |
---|
101 | #define KEY_TYPING_ENABLED @"Typing Enabled" |
---|
102 | #define KEY_SIGNED_OFF_ENABLED @"Signed Off Enabled" |
---|
103 | #define KEY_SIGNED_ON_ENABLED @"Signed On Enabled" |
---|
104 | #define KEY_UNVIEWED_ENABLED @"Unviewed Content Enabled" |
---|
105 | #define KEY_ONLINE_ENABLED @"Online Enabled" |
---|
106 | #define KEY_IDLE_AWAY_ENABLED @"Idle And Away Enabled" |
---|
107 | #define KEY_OFFLINE_ENABLED @"Offline Enabled" |
---|
108 | #define KEY_MOBILE_ENABLED @"Mobile Enabled" |
---|
109 | |
---|
110 | #define KEY_LABEL_AWAY_COLOR @"Away Label Color" |
---|
111 | #define KEY_LABEL_IDLE_COLOR @"Idle Label Color" |
---|
112 | #define KEY_LABEL_TYPING_COLOR @"Typing Label Color" |
---|
113 | #define KEY_LABEL_SIGNED_OFF_COLOR @"Signed Off Label Color" |
---|
114 | #define KEY_LABEL_SIGNED_ON_COLOR @"Signed On Label Color" |
---|
115 | #define KEY_LABEL_UNVIEWED_COLOR @"Unviewed Content Label Color" |
---|
116 | #define KEY_LABEL_ONLINE_COLOR @"Online Label Color" |
---|
117 | #define KEY_LABEL_IDLE_AWAY_COLOR @"Idle And Away Label Color" |
---|
118 | #define KEY_LABEL_OFFLINE_COLOR @"Offline Label Color" |
---|
119 | #define KEY_LABEL_MOBILE_COLOR @"Mobile Label Color" |
---|
120 | |
---|
121 | #define KEY_AWAY_COLOR @"Away Color" |
---|
122 | #define KEY_IDLE_COLOR @"Idle Color" |
---|
123 | #define KEY_TYPING_COLOR @"Typing Color" |
---|
124 | #define KEY_SIGNED_OFF_COLOR @"Signed Off Color" |
---|
125 | #define KEY_SIGNED_ON_COLOR @"Signed On Color" |
---|
126 | #define KEY_UNVIEWED_COLOR @"Unviewed Content Color" |
---|
127 | #define KEY_ONLINE_COLOR @"Online Color" |
---|
128 | #define KEY_IDLE_AWAY_COLOR @"Idle And Away Color" |
---|
129 | #define KEY_OFFLINE_COLOR @"Offline Color" |
---|
130 | #define KEY_MOBILE_COLOR @"Mobile Color" |
---|
131 | |
---|
132 | #define KEY_LIST_THEME_BACKGROUND_IMAGE_ENABLED @"Use Background Image" |
---|
133 | #define KEY_LIST_THEME_BACKGROUND_IMAGE_PATH @"Background Image Path" |
---|
134 | #define KEY_LIST_THEME_BACKGROUND_FADE @"Background Fade" |
---|
135 | #define KEY_LIST_THEME_BACKGROUND_IMAGE_STYLE @"Background Image Style" |
---|
136 | |
---|
137 | #define KEY_LIST_THEME_BACKGROUND_COLOR @"Background Color" |
---|
138 | #define KEY_LIST_THEME_HIGHLIGHT_COLOR @"Highlight Color" |
---|
139 | #define KEY_LIST_THEME_GRID_COLOR @"Grid Color" |
---|
140 | |
---|
141 | #define KEY_LIST_THEME_GROUP_BACKGROUND @"Group Background" |
---|
142 | #define KEY_LIST_THEME_GROUP_BACKGROUND_GRADIENT @"Group Background Gradient" |
---|
143 | #define KEY_LIST_THEME_GROUP_TEXT_COLOR @"Group Text Color" |
---|
144 | #define KEY_LIST_THEME_GROUP_TEXT_COLOR_INVERTED @"Group Inverted Text Color" |
---|
145 | #define KEY_LIST_THEME_GROUP_SHADOW_COLOR @"Group Shadow Color" |
---|
146 | #define KEY_LIST_THEME_GROUP_GRADIENT @"Group Gradient" |
---|
147 | #define KEY_LIST_THEME_GROUP_SHADOW @"Group Shadow" |
---|
148 | |
---|
149 | #define KEY_LIST_THEME_CONTACT_STATUS_COLOR @"Contact Status Text Color" |
---|
150 | |
---|
151 | #define KEY_LIST_THEME_GRID_ENABLED @"Grid Enabled" |
---|
152 | #define KEY_LIST_THEME_HIGHLIGHT_ENABLED @"Custom Highlight Enabled" |
---|
153 | #define KEY_LIST_THEME_BACKGROUND_AS_STATUS @"Background As Status" |
---|
154 | #define KEY_LIST_THEME_BACKGROUND_AS_EVENTS @"Background As Events" |
---|
155 | |
---|
156 | #define KEY_LIST_THEME_FADE_OFFLINE_IMAGES @"Fade Offline Images" |
---|
157 | |
---|
158 | #define AIPerformExpandItemNotification @"AIPerformExpandItemNotification" |
---|
159 | #define AIPerformCollapseItemNotification @"AIPerformCollapseItemNotification" |
---|
160 | #define AIDisplayableContainedObjectsDidChange @"AIDisplayableContainedObjectsDidChange" |
---|
161 | |
---|
162 | @protocol AIListControllerDelegate |
---|
163 | - (IBAction)performDefaultActionOnSelectedObject:(AIListObject *)selectedObject sender:(NSOutlineView *)sender; |
---|
164 | @end |
---|
165 | |
---|
166 | @interface NSObject(AIListControllerOptionalDelegateMethods) |
---|
167 | - (void)toggleFindPanel:(id)sender; |
---|
168 | - (BOOL)forwardKeyEventToFindPanel:(NSEvent *)theEvent; |
---|
169 | @end |
---|
170 | |
---|
171 | @interface AIAbstractListController : NSObject <AISmoothTooltipTrackerDelegate> { |
---|
172 | AIAutoScrollView *scrollView_contactList; |
---|
173 | AIListOutlineView *contactListView; |
---|
174 | |
---|
175 | AISmoothTooltipTracker *tooltipTracker; |
---|
176 | |
---|
177 | AIListContactCell *contentCell; |
---|
178 | AIListGroupCell *groupCell; |
---|
179 | |
---|
180 | AIListObject <AIContainingObject> *contactList; |
---|
181 | BOOL hideRoot; |
---|
182 | |
---|
183 | float backgroundOpacity; |
---|
184 | |
---|
185 | BOOL inDrag; |
---|
186 | NSArray *dragItems; |
---|
187 | |
---|
188 | BOOL configuredViewsAndTooltips; |
---|
189 | |
---|
190 | id delegate; |
---|
191 | |
---|
192 | BOOL showTooltips; |
---|
193 | BOOL showTooltipsInBackground; |
---|
194 | |
---|
195 | NSString *dragOperation; |
---|
196 | |
---|
197 | BOOL useContactListGroups; |
---|
198 | int indentationPerLevel[9]; |
---|
199 | } |
---|
200 | |
---|
201 | - (id)initWithContactListView:(AIListOutlineView *)inContactListView inScrollView:(AIAutoScrollView *)inScrollView_contactList delegate:(id<AIListControllerDelegate>)inDelegate; |
---|
202 | - (id)delegate; |
---|
203 | - (void)contactListWillBeRemovedFromWindow; |
---|
204 | - (void)contactListWasAddedBackToWindow; |
---|
205 | |
---|
206 | - (void)setContactListRoot:(ESObjectWithProperties<AIContainingObject> *)newContactListRoot; |
---|
207 | - (ESObjectWithProperties<AIContainingObject> *)contactListRoot; |
---|
208 | |
---|
209 | - (void)setHideRoot:(BOOL)inHideRoot; |
---|
210 | - (void)setUseContactListGroups:(BOOL)useContactListGroups; |
---|
211 | - (void)reloadData; |
---|
212 | |
---|
213 | - (void)setBackgroundOpacity:(float)opacity; |
---|
214 | |
---|
215 | - (IBAction)performDefaultActionOnSelectedItem:(NSOutlineView *)sender; |
---|
216 | |
---|
217 | - (void)updateLayoutFromPrefDict:(NSDictionary *)prefDict andThemeFromPrefDict:(NSDictionary *)themeDict; |
---|
218 | - (void)updateCellRelatedThemePreferencesFromDict:(NSDictionary *)prefDict; |
---|
219 | |
---|
220 | - (void)listObjectAttributesChanged:(NSNotification *)notification; |
---|
221 | - (void)contactListDesiredSizeChanged; |
---|
222 | - (void)updateTransparency; |
---|
223 | - (BOOL)useAliasesInContactListAsRequested; |
---|
224 | - (BOOL)shouldUseContactTextColors; |
---|
225 | - (BOOL)useStatusMessageAsExtendedStatus; |
---|
226 | |
---|
227 | - (void)configureViewsAndTooltips; |
---|
228 | |
---|
229 | //Tooltips |
---|
230 | - (void)showTooltipAtPoint:(NSPoint)screenPoint; |
---|
231 | - (AIListObject *)contactListItemAtScreenPoint:(NSPoint)screenPoint; |
---|
232 | - (void)hideTooltip; |
---|
233 | |
---|
234 | - (void)setShowTooltips:(BOOL)inShowTooltips; |
---|
235 | - (void)setShowTooltipsInBackground:(BOOL)inShowTooltipsInBackground; |
---|
236 | - (void)pasteboard:(NSPasteboard *)sender provideDataForType:(NSString *)type; |
---|
237 | |
---|
238 | //Drag & Drop |
---|
239 | - (void)setDragItems:(NSNotification *)notification; |
---|
240 | |
---|
241 | //find panel |
---|
242 | - (void)outlineViewToggleFindPanel:(NSOutlineView *)outlineView; |
---|
243 | - (BOOL)outlineView:(NSOutlineView *)outlineView forwardKeyEventToFindPanel:(NSEvent *)event; |
---|
244 | |
---|
245 | @end |
---|