root/Trunk/Adium.framework/Versions/A/Headers/AIListObject.h @ 2

Revision 2, 6.3 KB (checked in by jon, 16 years ago)

Initial commit of skeletal project.

Line 
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/ESObjectWithProperties.h>
18#import <Adium/AIStatus.h>
19
20@class AIListObject, AIService, AIMutableOwnerArray, AIListGroup;
21
22#define KEY_ORDER_INDEX         @"Order Index"
23#define KEY_IS_BLOCKED          @"isBlocked"
24
25typedef enum {
26        AIAvailableStatus = 'avaL',
27        AIAwayStatus = 'awaY',
28        AIIdleStatus = 'idlE',
29        AIAwayAndIdleStatus = 'aYiE',
30        AIOfflineStatus = 'offL',
31        AIUnknownStatus = 'unkN'
32} AIStatusSummary;
33
34@protocol AIContainingObject <NSObject>
35- (NSArray *)containedObjects;
36- (unsigned)containedObjectsCount;
37- (BOOL)containsObject:(AIListObject *)inObject;
38
39- (NSString *)contentsBasedIdentifier;
40
41- (id)objectAtIndex:(unsigned)index;
42- (int)indexOfObject:(AIListObject *)inObject;
43- (AIListObject *)objectWithService:(AIService *)inService UID:(NSString *)inUID;
44
45- (float)smallestOrder;
46- (float)largestOrder;
47
48/*!
49 * @brief Get the visbile object at a given index
50 */
51- (AIListObject *)visibleObjectAtIndex:(NSUInteger)index;
52
53- (void)listObject:(AIListObject *)listObject didSetOrderIndex:(float)inOrderIndex;
54- (float)orderIndexForObject:(AIListObject *)listObject;
55
56//Should list each list contact only once (for groups, this is the same as the objectEnumerator)
57- (NSArray *)listContacts;
58- (NSArray *)visibleListContacts;
59
60- (BOOL)addObject:(AIListObject *)inObject;
61
62- (void)removeObject:(AIListObject *)inObject;
63- (void)removeAllObjects;
64
65- (void)setExpanded:(BOOL)inExpanded;
66- (BOOL)isExpanded;
67- (BOOL)isExpandable;
68- (unsigned)visibleCount;
69
70- (void)visibilityOfContainedObject:(AIListObject *)inObject changedTo:(BOOL)inVisible;
71
72@end
73
74@protocol AIListObject
75- (void)object:(id)inObject didChangeValueForProperty:(NSString *)key notify:(NotifyTiming)notify;
76- (void)notifyOfChangedPropertiesSilently:(BOOL)silent;
77- (void)listObject:(AIListObject *)listObject mutableOwnerArray:(AIMutableOwnerArray *)inArray didSetObject:(AIListObject *)anObject withOwner:(AIListObject *)inOwner priorityLevel:(float)priority;
78@end
79
80@interface AIListObject : ESObjectWithProperties <AIListObject> {
81        AIService                               *service;
82       
83    NSString                            *UID;
84        NSString                                *internalObjectID;
85        BOOL                                    visible;                                //Visibility of this object
86        BOOL                                    alwaysVisible;
87
88        //Grouping, Manual ordering
89    id <AIContainingObject, AIListObject>       containingObject;               //The group/metacontact this object is in
90        float                                                                   orderIndex;                             //Placement of this contact within a group
91       
92        //For AIContainingObject-compliant subclasses
93        float                           largestOrder;
94        float                           smallestOrder;
95}
96
97//
98- (id)initWithUID:(NSString *)inUID service:(AIService *)inService;
99
100//Identifying information
101- (NSString *)UID;
102- (AIService *)service;
103- (NSString *)serviceID;
104- (NSString *)serviceClass;
105- (NSString *)internalObjectID;
106+ (NSString *)internalObjectIDForServiceID:(NSString *)inServiceID UID:(NSString *)inUID;
107
108//Visibility
109- (void)setVisible:(BOOL)inVisible;
110- (BOOL)visible;
111- (void)setAlwaysVisible:(BOOL)isVisible;
112- (BOOL)alwaysVisible;
113
114//Grouping
115- (AIListObject <AIContainingObject> *)containingObject;
116- (float)orderIndex;
117- (BOOL)containsMultipleContacts;
118
119//Display
120- (NSString *)formattedUID;
121- (void)setFormattedUID:(NSString *)inFormattedUID notify:(NotifyTiming)notify;
122- (NSString *)longDisplayName;
123
124//Prefs
125- (void)setPreference:(id)value forKey:(NSString *)inKey group:(NSString *)groupName;
126- (void)setPreferences:(NSDictionary *)prefs inGroup:(NSString *)group;
127- (id)preferenceForKey:(NSString *)inKey group:(NSString *)groupName ignoreInheritedValues:(BOOL)ignore;
128- (id)preferenceForKey:(NSString *)inKey group:(NSString *)groupName;
129- (NSString *)pathToPreferences;
130
131//Alter the placement of this object in a group (PRIVATE: These are for AIListGroup ONLY)
132- (void)setOrderIndex:(float)inIndex;
133
134//Grouping (PRIVATE: These are for AIListGroup and AIMetaContact ONLY)
135- (void)setContainingObject:(AIListObject <AIContainingObject> *)inGroup;
136
137//Key-Value pairing
138- (BOOL)online;
139
140- (NSString *)statusName;
141- (AIStatusType)statusType;
142- (void)setStatusWithName:(NSString *)statusName statusType:(AIStatusType)statusType notify:(NotifyTiming)notify;
143- (NSAttributedString *)statusMessage;
144- (NSString *)statusMessageString;
145- (void)setStatusMessage:(NSAttributedString *)statusMessage notify:(NotifyTiming)notify;
146- (void)setBaseAvailableStatusAndNotify:(NotifyTiming)notify;
147- (AIStatusSummary)statusSummary;
148
149- (BOOL)soundsAreMuted;
150
151- (BOOL)isStranger;
152- (BOOL)isMobile;
153- (BOOL)isBlocked;
154
155- (NSString *)displayName;
156- (void)setDisplayName:(NSString *)alias;
157
158- (NSString *)phoneticName;
159
160- (NSString *)notes;
161- (void)setNotes:(NSString *)notes;
162
163- (NSNumber *)idleTime;
164
165- (NSImage *)userIcon;
166- (NSImage *)menuIcon;
167- (NSImage *)statusIcon;
168- (NSData *)userIconData;
169- (void)setUserIconData:(NSData *)inData;
170
171//For use only by subclasses
172- (NSImage *)internalUserIcon;
173
174//mutableOwnerArray delegate and methods
175- (void)listObject:(AIListObject *)listObject mutableOwnerArray:(AIMutableOwnerArray *)inArray didSetObject:(id)anObject withOwner:(AIListObject *)inOwner priorityLevel:(float)priority;
176
177//Comparison
178- (NSComparisonResult)compare:(AIListObject *)other;
179
180@end
181
182/*!
183 * AIContainingObjectInheritableMethods methods are part of the AIContainingObject protocol
184 * but are implemented by AIListObject (which does not conform to the protocol) for the convenience
185 * of subclasses.
186 */
187@interface AIListObject (AIContainingObjectInheritableMethods)
188- (float)smallestOrder;
189- (float)largestOrder;
190- (void)listObject:(AIListObject *)listObject didSetOrderIndex:(float)inOrderIndex;
191- (float)orderIndexForObject:(AIListObject *)listObject;
192@end
Note: See TracBrowser for help on using the browser.