Chat-O-Matic/application/ImageCache.h

42 lines
892 B
C
Raw Normal View History

/*
* Copyright 2009, Andrea Anzani. All rights reserved.
* Distributed under the terms of the MIT License.
*/
2010-05-20 16:31:55 -05:00
#ifndef _IMAGE_CACHE_H
#define _IMAGE_CACHE_H
#include <SupportDefs.h>
#include <String.h>
2010-05-08 14:35:28 -05:00
#include <libsupport/KeyMap.h>
2010-05-20 16:31:55 -05:00
class BBitmap;
2010-05-20 16:31:55 -05:00
class ImageCache {
public:
/* Returns the image corresponding to the which constant */
static BBitmap* GetImage(BString fullPath,
BString symbolicName);
2010-05-20 16:31:55 -05:00
static void AddImage(BString name, BBitmap* which);
static void DeleteImage(BString name);
2010-05-20 16:31:55 -05:00
/* Frees the singleton instance of the cache, must be
* called when the application quits.
*/
2010-05-20 16:31:55 -05:00
static void Release();
2010-05-20 16:31:55 -05:00
protected:
ImageCache();
~ImageCache();
2010-05-20 16:31:55 -05:00
private:
static BBitmap* LoadImage(const char* resourceName,
const char*);
2010-05-20 16:31:55 -05:00
static ImageCache* fInstance;
KeyMap<BString, BBitmap*> fBitmaps;
};
2010-05-20 16:31:55 -05:00
#endif // _IMAGE_CACHE_H