9 * Warning: proplist.h #defines BOOL which will clash with the
10 * typedef BOOL in Xmd.h
11 * proplist.h should use Bool (which is a #define in Xlib.h) instead.
18 # define WMAX(a,b) ((a)>(b) ? (a) : (b))
21 # define WMIN(a,b) ((a)<(b) ? (a) : (b))
37 } WMNotificationCoalescing
;
42 typedef struct W_HashTable WMHashTable
;
43 typedef struct W_UserDefaults WMUserDefaults
;
44 typedef struct W_Notification WMNotification
;
45 typedef struct W_NotificationQueue WMNotificationQueue
;
48 /* DO NOT ACCESS THE CONTENTS OF THIS STRUCT */
57 /* NULL is pointer hash */
58 unsigned (*hash
)(const void *);
59 /* NULL is pointer compare */
60 Bool (*keyIsEqual
)(const void *, const void *);
61 /* NULL does nothing */
62 void* (*retainKey
)(const void *);
63 /* NULL does nothing */
64 void (*releaseKey
)(const void *);
65 } WMHashTableCallbacks
;
71 typedef void WMNotificationObserverAction(void *observerData
,
72 WMNotification
*notification
);
76 /*......................................................................*/
79 void wfatal(const char *msg
, ...);
80 void wwarning(const char *msg
, ...);
81 void wsyserror(const char *msg
, ...);
83 char *wfindfile(char *paths
, char *file
);
85 char *wfindfileinlist(char **path_list
, char *file
);
87 char *wexpandpath(char *path
);
89 /* don't free the returned string */
92 void *wmalloc(size_t size
);
93 void *wrealloc(void *ptr
, size_t newsize
);
95 void wrelease(void *ptr
);
96 void *wretain(void *ptr
);
98 char *wstrdup(char *str
);
100 char *wstrappend(char *dst
, char *src
);
102 char *wusergnusteppath();
104 char *wdefaultspathfordomain(char *domain
);
106 void wusleep(unsigned int microsec
);
108 /*......................................................................*/
111 WMHashTable
*WMCreateHashTable(WMHashTableCallbacks callbacks
);
113 void WMFreeHashTable(WMHashTable
*table
);
115 void WMResetHashTable(WMHashTable
*table
);
117 void *WMHashGet(WMHashTable
*table
, const void *key
);
119 /* put data in table, replacing already existing data and returning
121 void *WMHashInsert(WMHashTable
*table
, void *key
, void *data
);
123 void WMHashRemove(WMHashTable
*table
, const void *key
);
125 /* warning: do not manipulate the table while using these functions */
126 WMHashEnumerator
WMEnumerateHashTable(WMHashTable
*table
);
128 void *WMNextHashEnumeratorItem(WMHashEnumerator
*enumerator
);
130 unsigned WMCountHashTable(WMHashTable
*table
);
135 /* some predefined callback sets */
137 extern const WMHashTableCallbacks WMIntHashCallbacks
;
138 /* sizeof(keys) are <= sizeof(void*) */
140 extern const WMHashTableCallbacks WMStringHashCallbacks
;
141 /* keys are strings. Strings will be copied with wstrdup()
142 * and freed with free() */
144 extern const WMHashTableCallbacks WMStringPointerHashCallbacks
;
145 /* keys are strings, bug they are not copied */
147 /*......................................................................*/
149 WMNotification
*WMCreateNotification(char *name
, void *object
, void *clientData
);
151 void WMReleaseNotification(WMNotification
*notification
);
153 WMNotification
*WMRetainNotification(WMNotification
*notification
);
155 void *WMGetNotificationClientData(WMNotification
*notification
);
157 void *WMGetNotificationObject(WMNotification
*notification
);
159 char *WMGetNotificationName(WMNotification
*notification
);
162 void WMAddNotificationObserver(WMNotificationObserverAction
*observerAction
,
163 void *observer
, char *name
, void *object
);
165 void WMPostNotification(WMNotification
*notification
);
167 void WMRemoveNotificationObserver(void *observer
);
169 void WMRemoveNotificationObserverWithName(void *observer
, char *name
,
172 void WMPostNotificationName(char *name
, void *object
, void *clientData
);
174 WMNotificationQueue
*WMGetDefaultNotificationQueue(void);
176 WMNotificationQueue
*WMCreateNotificationQueue(void);
178 void WMDequeueNotificationMatching(WMNotificationQueue
*queue
, unsigned mask
);
180 void WMEnqueueNotification(WMNotificationQueue
*queue
, WMNotification
*notification
,
181 WMPostingStyle postingStyle
);
183 void WMEnqueueCoalesceNotification(WMNotificationQueue
*queue
,
184 WMNotification
*notification
,
185 WMPostingStyle postingStyle
,
186 unsigned coalesceMask
);
189 /*......................................................................*/
191 WMUserDefaults
*WMGetStandardUserDefaults(void);
193 proplist_t
WMGetUDObjectForKey(WMUserDefaults
*database
, char *defaultName
);
195 void WMSetUDObjectForKey(WMUserDefaults
*database
, proplist_t object
,
198 void WMRemoveUDObjectForKey(WMUserDefaults
*database
, char *defaultName
);
200 /* you can free the returned string */
201 char *WMGetUDStringForKey(WMUserDefaults
*database
, char *defaultName
);
203 int WMGetUDIntegerForKey(WMUserDefaults
*database
, char *defaultName
);
205 int WMGetUDFloatForKey(WMUserDefaults
*database
, char *defaultName
);
207 Bool
WMGetUDBoolForKey(WMUserDefaults
*database
, char *defaultName
);
209 void WMSetUDStringForKey(WMUserDefaults
*database
, char *value
,
212 void WMSetUDIntegerForKey(WMUserDefaults
*database
, int value
,
215 void WMSetUDFloatForKey(WMUserDefaults
*database
, float value
,
218 void WMSetUDBoolForKey(WMUserDefaults
*database
, Bool value
,
221 proplist_t
WMGetUDSearchList(WMUserDefaults
*database
);
223 void WMSetUDSearchList(WMUserDefaults
*database
, proplist_t list
);