summaryrefslogtreecommitdiffstats
path: root/src/kvirc/kernel/kvi_iconmanager.h
blob: 9d1267ce7fda27be41b0ab802b21a6ad3643f1a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
#ifndef _KVI_ICONMANAGER_H_
#define _KVI_ICONMANAGER_H_

//=============================================================================
//
//   File : kvi_iconmanager.h
//   Creation date : Sat Jun 24 2000 14:49:24 by Szymon Stefanek
//
//   This file is part of the KVirc irc client distribution
//   Copyright (C) 1999-2004 Szymon Stefanek (pragma at kvirc dot net)
//
//   This program is FREE software. You can redistribute it and/or
//   modify it under the terms of the GNU General Public License
//   as published by the Free Software Foundation; either version 2
//   of the License, or (at your opinion) any later version.
//
//   This program is distributed in the HOPE that it will be USEFUL,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//   See the GNU General Public License for more details.
//
//   You should have received a copy of the GNU General Public License
//   along with this program. If not, write to the Free Software Foundation,
//   Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
//=============================================================================

#include "kvi_settings.h"
#include "kvi_string.h"
#include "kvi_avatar.h"
#include "kvi_time.h"

#include <tqpixmap.h>
#include <tqobject.h>
#include <tqwidget.h>
#include "kvi_pointerhashtable.h"



#define KVI_SMALLICON_NONE 0
#define KVI_SMALLICON_CLOSE 1
#define KVI_SMALLICON_MAXIMIZE 2
#define KVI_SMALLICON_MINIMIZE 3
#define KVI_SMALLICON_RESTORE 4
#define KVI_SMALLICON_DEFAULTICON 5
#define KVI_SMALLICON_DOCK 6
#define KVI_SMALLICON_UNDOCK 7
#define KVI_SMALLICON_QUITAPP 8
#define KVI_SMALLICON_CONSOLE 9
#define KVI_SMALLICON_FLOPPY 10
#define KVI_SMALLICON_PARSERERROR 11
#define KVI_SMALLICON_PARSERWARNING 12
#define KVI_SMALLICON_SERVER 13
#define KVI_SMALLICON_WORLD 14
#define KVI_SMALLICON_PROXY 15
#define KVI_SMALLICON_KVIRC 16
#define KVI_SMALLICON_CUT 17
#define KVI_SMALLICON_COPY 18
#define KVI_SMALLICON_PASTE 19
#define KVI_SMALLICON_OPTIONS 20
#define KVI_SMALLICON_SOCKETMESSAGE 21
#define KVI_SMALLICON_SOCKETWARNING 22
#define KVI_SMALLICON_SOCKETERROR 23
#define KVI_SMALLICON_SYSTEMERROR 24
#define KVI_SMALLICON_RAW 25
#define KVI_SMALLICON_SYSTEMWARNING 26
#define KVI_SMALLICON_SYSTEMMESSAGE 27
#define KVI_SMALLICON_UNHANDLED 28
#define KVI_SMALLICON_SERVERINFO 29
#define KVI_SMALLICON_MOTD 30
#define KVI_SMALLICON_CHANNEL 31
#define KVI_SMALLICON_HIDEDOUBLEVIEW 32
#define KVI_SMALLICON_SHOWDOUBLEVIEW 33
#define KVI_SMALLICON_OP 34
#define KVI_SMALLICON_VOICE 35
#define KVI_SMALLICON_SERVERPING 36
#define KVI_SMALLICON_SHOWLISTVIEW 37
#define KVI_SMALLICON_HIDELISTVIEW 38
#define KVI_SMALLICON_JOIN 39
#define KVI_SMALLICON_PART 40
#define KVI_SMALLICON_UNRECOGNIZED 41
#define KVI_SMALLICON_TOPIC 42
#define KVI_SMALLICON_ACCEPT 43
#define KVI_SMALLICON_DISCARD 44
#define KVI_SMALLICON_OWNPRIVMSG 45
#define KVI_SMALLICON_CHANPRIVMSG 46
#define KVI_SMALLICON_QUERY 47
#define KVI_SMALLICON_QUERYPRIVMSG 48
#define KVI_SMALLICON_HELP 49
#define KVI_SMALLICON_MDIHELP 50
#define KVI_SMALLICON_CTCPREPLY 51
#define KVI_SMALLICON_CTCPREQUESTREPLIED 52
#define KVI_SMALLICON_CTCPREQUESTIGNORED 53
#define KVI_SMALLICON_CTCPREQUESTFLOOD 54
#define KVI_SMALLICON_CTCPREQUESTUNKNOWN 55
#define KVI_SMALLICON_ACTION 56
#define KVI_SMALLICON_AVATAR 57
#define KVI_SMALLICON_QUIT 58
#define KVI_SMALLICON_SPLIT 59
#define KVI_SMALLICON_QUITSPLIT 60
#define KVI_SMALLICON_NICK 61
#define KVI_SMALLICON_DEOP 62
#define KVI_SMALLICON_DEVOICE 63
#define KVI_SMALLICON_MODE 64
#define KVI_SMALLICON_KEY 65
#define KVI_SMALLICON_LIMIT 66
#define KVI_SMALLICON_BAN 67
#define KVI_SMALLICON_UNBAN 68
#define KVI_SMALLICON_BANEXCEPT 69
#define KVI_SMALLICON_BANUNEXCEPT 70
#define KVI_SMALLICON_INVITEEXCEPT 71
#define KVI_SMALLICON_INVITEUNEXCEPT 72
#define KVI_SMALLICON_CHANMODE 73
#define KVI_SMALLICON_CHANMODEHIDE 74
#define KVI_SMALLICON_WHO 75
#define KVI_SMALLICON_EDITOR 76
#define KVI_SMALLICON_DCCREQUEST 77
#define KVI_SMALLICON_DCCMSG 78
#define KVI_SMALLICON_DCCERROR 79
#define KVI_SMALLICON_ICONMANAGER 80
#define KVI_SMALLICON_SCRIPTCENTER 81
#define KVI_SMALLICON_BOMB 82
#define KVI_SMALLICON_EVENT 83
#define KVI_SMALLICON_EVENTNOHANDLERS 84
#define KVI_SMALLICON_HANDLER 85
#define KVI_SMALLICON_HANDLERDISABLED 86
#define KVI_SMALLICON_NICKNAMEPROBLEM 87
#define KVI_SMALLICON_WHOISUSER 88
#define KVI_SMALLICON_WHOISCHANNELS 89
#define KVI_SMALLICON_WHOISIDLE 90
#define KVI_SMALLICON_WHOISSERVER 91
#define KVI_SMALLICON_WHOISOTHER 92
#define KVI_SMALLICON_TIME 93
#define KVI_SMALLICON_NOTIFYONLINE 94
#define KVI_SMALLICON_NOTIFYOFFLINE 95
#define KVI_SMALLICON_LOCKED 96
#define KVI_SMALLICON_UNLOCKED 97
#define KVI_SMALLICON_LOCKEDOFF 98
#define KVI_SMALLICON_UNLOCKEDOFF 99
#define KVI_SMALLICON_OWNPRIVMSGCRYPTED 100
#define KVI_SMALLICON_CHANPRIVMSGCRYPTED 101
#define KVI_SMALLICON_QUERYPRIVMSGCRYPTED 102
#define KVI_SMALLICON_DCCCHATMSG 103
#define KVI_SMALLICON_DCCCHATMSGCRYPTED 104
#define KVI_SMALLICON_IRC 105
#define KVI_SMALLICON_FOLDER 106
#define KVI_SMALLICON_HOME 107
#define KVI_SMALLICON_BOOKMARKS 108
#define KVI_SMALLICON_SPY 109
#define KVI_SMALLICON_KICK 110
#define KVI_SMALLICON_LINUX 111
#define KVI_SMALLICON_LINKS 112
#define KVI_SMALLICON_REGUSERS 113
#define KVI_SMALLICON_DOCKWIDGET 114
#define KVI_SMALLICON_CASCADEWINDOWS 115
#define KVI_SMALLICON_MAXVERTICAL 116
#define KVI_SMALLICON_MAXHORIZONTAL 117
#define KVI_SMALLICON_TILEWINDOWS 118
#define KVI_SMALLICON_LOG 119
#define KVI_SMALLICON_SPAM 120
#define KVI_SMALLICON_FILE 121
#define KVI_SMALLICON_ICQ 122
#define KVI_SMALLICON_ICTQYELLOW 123
#define KVI_SMALLICON_ICTQRED 124
#define KVI_SMALLICON_ICTQBLUE 125
#define KVI_SMALLICON_ICTQLIGHTGREEN 126
#define KVI_SMALLICON_ICTQLIGHTYELLOW 127
#define KVI_SMALLICON_MESSAGE 128
#define KVI_SMALLICON_MESSAGESENT 129
#define KVI_SMALLICON_BLUESQUARE 130
#define KVI_SMALLICON_VIOLETSQUARE 131
#define KVI_SMALLICON_YELLOWSQUARE 132
#define KVI_SMALLICON_GREENSQUARE 133
#define KVI_SMALLICON_BLACKSQUARE 134
#define KVI_SMALLICON_REDSQUARE 135
#define KVI_SMALLICON_CYANSQUARE 136
#define KVI_SMALLICON_DKGREENSQUARE 137
#define KVI_SMALLICON_TERMINAL 138
#define KVI_SMALLICON_WALLOPS 139
#define KVI_SMALLICON_INVISIBLE 140
#define KVI_SMALLICON_SERVERNOTICE 141
#define KVI_SMALLICON_GNUTELLA 142
#define KVI_SMALLICON_SEARCH 143
#define KVI_SMALLICON_FILES 144
#define KVI_SMALLICON_TRANSFER 145
#define KVI_SMALLICON_PACKAGE 146
#define KVI_SMALLICON_RETRY 147
#define KVI_SMALLICON_IDEA 148
#define KVI_SMALLICON_COLORS 149
#define KVI_SMALLICON_GUI 150
#define KVI_SMALLICON_IRCVIEW 151
#define KVI_SMALLICON_ALIAS 152
#define KVI_SMALLICON_CHANNELNOTICE 153
#define KVI_SMALLICON_CHANNELNOTICECRYPTED 154
#define KVI_SMALLICON_QUERYNOTICE 155
#define KVI_SMALLICON_QUERYNOTICECRYPTED 156
// FIXME: rename the icon 157: it was colliding with 141
#define KVI_SMALLICON_SERVNOTICE 157
#define KVI_SMALLICON_POPUP 158
#define KVI_SMALLICON_PROLOGUE 159
#define KVI_SMALLICON_EPILOGUE 160
#define KVI_SMALLICON_SHAREDFILES 161
#define KVI_SMALLICON_CTCPREPLYUNKNOWN 162
#define KVI_SMALLICON_CANVAS 163
#define KVI_SMALLICON_NICKSERV 164
#define KVI_SMALLICON_CHANSERV 165
#define KVI_SMALLICON_DCCVOICE 166
#define KVI_SMALLICON_PLAY 167
#define KVI_SMALLICON_RECORD 168
#define KVI_SMALLICON_AUTOTILEWINDOWS 169
#define KVI_SMALLICON_AWAY 170
#define KVI_SMALLICON_IDENT 171
#define KVI_SMALLICON_HOMEPAGE 172
#define KVI_SMALLICON_LIST 173
#define KVI_SMALLICON_HALFOP 174
#define KVI_SMALLICON_HALFDEOP 175
#define KVI_SMALLICON_INVITE 176
#define KVI_SMALLICON_MULTIMEDIA 177
#define KVI_SMALLICON_LOOK 178
#define KVI_SMALLICON_INPUT 179
#define KVI_SMALLICON_MESSAGES 180
#define KVI_SMALLICON_QUERYTRACE 181
#define KVI_SMALLICON_NOCHANNEL 182
#define KVI_SMALLICON_BROADCASTPRIVMSG 183
#define KVI_SMALLICON_BROADCASTNOTICE 184
#define KVI_SMALLICON_URL 185
#define KVI_SMALLICON_RAWEVENT 186
#define KVI_SMALLICON_RAWEVENTNOHANDLERS 187
#define KVI_SMALLICON_MEKICK 188
#define KVI_SMALLICON_MEOP 189
#define KVI_SMALLICON_MEVOICE 190
#define KVI_SMALLICON_MEDEOP 191
#define KVI_SMALLICON_MEDEVOICE 192
#define KVI_SMALLICON_MEHALFOP 193
#define KVI_SMALLICON_MEDEHALFOP 194
#define KVI_SMALLICON_MEBAN 195
#define KVI_SMALLICON_MEUNBAN 196
#define KVI_SMALLICON_MEBANEXCEPT 197
#define KVI_SMALLICON_MEBANUNEXCEPT 198
#define KVI_SMALLICON_MEINVITEEXCEPT 199
#define KVI_SMALLICON_MEINVITEUNEXCEPT 200
#define KVI_SMALLICON_CLASSICTASKBAR 201
#define KVI_SMALLICON_TREETASKBAR 202
#define KVI_SMALLICON_IGNORE 203
#define KVI_SMALLICON_USERLIST 204
#define KVI_SMALLICON_STATS 205
#define KVI_SMALLICON_POPUPMENU 206
#define KVI_SMALLICON_XY 207
#define KVI_SMALLICON_IRC0 208
#define KVI_SMALLICON_IRC1 209
#define KVI_SMALLICON_IRC2 210
#define KVI_SMALLICON_IRC3 211
#define KVI_SMALLICON_IRC4 212
#define KVI_SMALLICON_IRC5 213
#define KVI_SMALLICON_HEART 214
#define KVI_SMALLICON_HEARTBROKEN 215
#define KVI_SMALLICON_ROSE 216
#define KVI_SMALLICON_BIGGRIN 217
#define KVI_SMALLICON_BIGGRINGLASSES 218
#define KVI_SMALLICON_BIGGRINEYES 219
#define KVI_SMALLICON_TEXTEXCLAMATIVE 220
#define KVI_SMALLICON_TEXTPOINTS 221
#define KVI_SMALLICON_KISS 222
#define KVI_SMALLICON_SURPRISED1 223
#define KVI_SMALLICON_UGLY 224
#define KVI_SMALLICON_ANGRY 225
#define KVI_SMALLICON_SURPRISED2 226
#define KVI_SMALLICON_SMILE 227
#define KVI_SMALLICON_TONGUE 228
#define KVI_SMALLICON_SSL 229
#define KVI_SMALLICON_CRY 230
#define KVI_SMALLICON_EYE 231
#define KVI_SMALLICON_DEADCHANNEL 232
#define KVI_SMALLICON_DEADQUERY 233
#define KVI_SMALLICON_SOUND 234
#define KVI_SMALLICON_TOOLBAR 235
#define KVI_SMALLICON_TEXTENCODING 236
#define KVI_SMALLICON_NEWITEM 237
#define KVI_SMALLICON_NEWITEMBYWIZARD 238
#define KVI_SMALLICON_DELETEITEM 239
#define KVI_SMALLICON_EDITITEM 240
#define KVI_SMALLICON_FILETRANSFER 241
#define KVI_SMALLICON_CHANADMIN 242
#define KVI_SMALLICON_CHANUNADMIN 243
#define KVI_SMALLICON_MECHANADMIN 244
#define KVI_SMALLICON_MECHANUNADMIN 245
#define KVI_SMALLICON_USEROP 246
#define KVI_SMALLICON_DEUSEROP 247
#define KVI_SMALLICON_MEUSEROP 248
#define KVI_SMALLICON_MEDEUSEROP 249
#define KVI_SMALLICON_APPLET 250
#define KVI_SMALLICON_CAPTION 251
#define KVI_SMALLICON_TRANSPARENT 252
#define KVI_SMALLICON_ALERT 253
#define KVI_SMALLICON_USERWINDOW 254
#define KVI_SMALLICON_STATUSBAR 255
#define KVI_SMALLICON_NOTAWAY 256
#define KVI_SMALLICON_PLUS 257
#define KVI_SMALLICON_MINUS 258
#define KVI_SMALLICON_BINARYTEXT 259
#define KVI_SMALLICON_CHANOWNER 260
#define KVI_SMALLICON_CHANUNOWNER 261
#define KVI_SMALLICON_MECHANOWNER 262
#define KVI_SMALLICON_MECHANUNOWNER 263
#define KVI_SMALLICON_AFRAID 264
#define KVI_SMALLICON_TONGUE2 265
#define KVI_SMALLICON_SAYICON 266
#define KVI_SMALLICON_SAYCOLORS 267
#define KVI_SMALLICON_FINGER 268
#define KVI_SMALLICON_SCRIPTACTION 269
#define KVI_SMALLICON_TEARSMILE 270
#define KVI_SMALLICON_SHY 271
#define KVI_SMALLICON_SERVERERROR 272
#define KVI_SMALLICON_CAFE 273
#define KVI_SMALLICON_ADDONS 274
#define KVI_SMALLICON_CHANOWNERAWAY 275
#define KVI_SMALLICON_OPAWAY 276
#define KVI_SMALLICON_VOICEAWAY 277
#define KVI_SMALLICON_CHANADMINAWAY 278
#define KVI_SMALLICON_USEROPAWAY 279
#define KVI_SMALLICON_HALFOPAWAY 280
#define KVI_SMALLICON_ALIASHIGHLIGHTED 281
#define KVI_SMALLICON_DEMORALIZED 282
#define KVI_SMALLICON_SLURP 283
#define KVI_SMALLICON_NAMESPACE 284
#define KVI_SMALLICON_SAYSMILE 285
#define KVI_SMALLICON_SAYKVS 286
#define KVI_SMALLICON_THEMEOPTIONS 287
#define KVI_SMALLICON_BUG 288
#define KVI_SMALLICON_REFRESH 289
#define KVI_SMALLICON_THEME 290
#define KVI_SMALLICON_SCREENSHOT 291

#define KVI_NUM_SMALL_ICONS 292


#define KVI_BIGICON_DISCONNECTED "kvi_bigicon_disconnected.png"
#define KVI_BIGICON_CONNECTING "kvi_bigicon_connecting.png"
#define KVI_BIGICON_CONNECTED "kvi_bigicon_connected.png"
#define KVI_BIGICON_TOOLS "kvi_bigicon_tools.png"
#define KVI_BIGICON_ACTIONS "kvi_bigicon_actions.png"
#define KVI_BIGICON_FOLDER "kvi_bigicon_folder.png"
#define KVI_BIGICON_UNKNOWN "kvi_bigicon_unknown.png"
#define KVI_BIGICON_SEPARATOR "kvi_bigicon_separator.png"
#define KVI_BIGICON_KVS "kvi_bigicon_kvs.png"
#define KVI_BIGICON_THEME "kvi_bigicon_theme.png"
#define KVI_BIGICON_ADDONS "kvi_bigicon_addons.png"

#define KVI_BIGICON_HELPINDEX "kvi_bigicon_helpindex.png"
#define KVI_BIGICON_HELPBACK "kvi_bigicon_helpback.png"
#define KVI_BIGICON_HELPFORWARD "kvi_bigicon_helpforward.png"
#define KVI_BIGICON_HELPCLOSE "kvi_bigicon_helpclose.png"
#define KVI_BIGICON_HELPSEARCH "kvi_bigicon_helpsearch.png"

#define KVI_BIGICON_OPEN "kvi_bigicon_open.png"
#define KVI_BIGICON_SAVE "kvi_bigicon_save.png"
#define KVI_BIGICON_REMOVE "kvi_bigicon_remove.png"
#define KVI_BIGICON_WWW "kvi_bigicon_www.png"
#define KVI_BIGICON_PACK "kvi_bigicon_pack.png"
#define KVI_BIGICON_SCREENSHOT "kvi_bigicon_screenshot.png"
#define KVI_BIGICON_REGUSERS "kvi_bigicon_regusers.png"

#define KVI_SMALLICONS_SUBDIRECTORY "coresmall"
#define KVI_SMALLICONS_PREFIX "kcs_"

// FIXME: this should be removed
#define KVI_SMALLICONS_IMAGELIB_PREFIX "kvi_smallicon_"

#define KVI_USERCHANSTATE_IMAGE_NAME "kvi_userchanstate.png"
#define KVI_ACTIVITYMETER_IMAGE_NAME "kvi_activitymeter.png"

#define KVI_REFRESH_IMAGE_NAME "kvi_icon_refresh.png"

class KviIconManager;

class KVIRC_API KviCachedPixmap
{
public:
	// the pixmap MUST be allocated with new TQPixmap()
	// this calss takes the ownership
	KviCachedPixmap(TQPixmap * ptr,const TQString &szPath);
	~KviCachedPixmap();
private:
	TQString      m_szPath;
	kvi_time_t   m_tLastAccess;
	TQPixmap    * m_pPixmap;
	unsigned int m_uSize;
public:
	TQPixmap       * pixmap(){ return m_pPixmap; };
	const TQString & path(){ return m_szPath; };
	unsigned int    size(){ return m_uSize; };
	kvi_time_t      lastAccessTime(){ return m_tLastAccess; };
	void            updateLastAccessTime();
};

class KVIRC_API KviIconWidget : public TQWidget
{
	Q_OBJECT
  
public:
	KviIconWidget();
	KviIconWidget(TQWidget * par);
	~KviIconWidget();
protected:
	void init();
	virtual void closeEvent(TQCloseEvent *e);
	virtual bool eventFilter(TQObject * o,TQEvent *e);
signals:
	void closed();
	void selected(int iIcon);
};



//
// This class manages the images used by KVIrc.
//
// We handle three types of images: builtin small icons, builtin big icons and generic images.
//
// The builtin small icons are in the pics/coresmall directory (this is to optimize the directory size
//      since it's a linear search...), are 16x16 in size and are indexed by numbers in a way that their
//      access is really fast. The icons used here are used mostly in KviIrcView (but not exclusively).
//
// The generic images are just "any" image that the underlying TQt engine
//      is able to load. They are loaded by (relative) path and 
//      cached by name.
//
// The builtin big icons are (actually) just generic images
//      that are eventually scaled to 32x32 if needed. One can request
//      a builtin small icon indexed by number to be scaled
//      to the size of 32x32 as a big icon too.
//

class KVIRC_API KviIconManager : public TQObject
{
	Q_OBJECT
  
public:
	KviIconManager();
	~KviIconManager();
private:
	TQPixmap                     * m_smallIcons[KVI_NUM_SMALL_ICONS];
	KviIconWidget               * m_pIconWidget;

	KviPointerHashTable<TQString,KviCachedPixmap>      * m_pCachedImages;
	KviPointerHashTable<TQString,int>                  * m_pIconNames;
	unsigned int                  m_uCacheTotalSize;
	unsigned int                  m_uCacheMaxSize;
public:
	// WARNING: Don't store this pointer!
	// id == filename | number that indicates an internal pixmap
	// 0 stands for "any"
	TQPixmap * getImage(const char * id,bool bCanBeNumber = true,TQString* pRetPath = 0);

	// The returned pointer is owned by the icon manager
	// and can be deleted at any time : so don't store it
	KviCachedPixmap * getPixmapWithCache(const TQString &szName);

	// The returned pointer is owned by the icon manager
	// and can be deleted at any time : so don't store it
	KviCachedPixmap * getPixmapWithCacheScaleOnLoad(const TQString &szName,int iMaxWidth,int iMaxHeight);

	// The returned pointer is owned by the icon manager
	// and can be deleted at any time : so don't store it
	TQPixmap * getPixmap(const TQString &szName)
		{ KviCachedPixmap * p = getPixmapWithCache(szName); return p ? p->pixmap() : 0; };

	// this one never fails... if the image can't be found
	// a default 32x32 image is returned
	TQPixmap * getBigIcon(const TQString &szName);

	// this one never fails... if the icon isn't there
	// then a default 16x16 image is returned
	TQPixmap * getSmallIcon(int idx){ return idx < KVI_NUM_SMALL_ICONS ? (m_smallIcons[idx] ? m_smallIcons[idx] : loadSmallIcon(idx) ) : 0; };

	const char * getSmallIconName(int idx);
	int getSmallIconIdFromName(const TQString &szName);

	// if szLocalPath is empty then szName can be the identification
	// string for the avatar
	// if szName is empty then it is found from szLocalPath
	KviAvatar * getAvatar(const TQString &szLocalPath,const TQString &szName);

	void urlToCachedFileName(KviStr &szFName);
	void urlToCachedFileName(TQString &szFName);

	void clearCache();
	void reloadImages();

	void cacheCleanup();
protected:
	void addToCache(const TQString &szName,KviCachedPixmap * p);
	//void loadSmallIcons();
	TQPixmap * loadSmallIcon(int idx);
public slots:
	void showIconWidget();
protected slots:
	void iconWidgetClosed();
};

extern KVIRC_API KviIconManager * g_pIconManager;

#endif //_KVI_ICONMANAGER_H_