10#ifndef GUIRESOURCEMANAGER__H_
11#define GUIRESOURCEMANAGER__H_
16#include "GUIComponentManager.h"
25#include "GUIImageData.h"
32#define GETRESMANAGER CGUIComponentManager::GetInstance().GetResourceManager()
35const eC_Int DIALOG_FILE_VERSION = 1;
124#ifdef GUILIANI_WRITE_GUI
191#ifdef GUILIANI_STREAM_GUI
250 const eC_String& kPath,
251 const eC_Bool bPermanent=
false);
265 const eC_UInt& uiWidth,
266 const eC_UInt& uiHeight,
267 const eC_UInt& eImageType,
268 const eC_Bool bPermanent =
true);
278 const eC_String& kPath,
279 const eC_Bool bPermanent=
false);
290 const eC_String& kPath,
293 eC_Bool bPermanent=
true);
305 const eC_String& rkPath,
306 eC_Bool bPermanent =
false);
316 const eC_UInt& ruiValue);
434 inline void EnablePreloading(
const eC_Bool bPreLoadPermanentData){ m_bPreLoadPermanentData = bPreLoadPermanentData; }
575 const eC_String& kPath,
577 const eC_Bool bPermanent =
false);
590 const eC_UInt& uiWidth,
591 const eC_UInt& uiHeight,
592 const eC_UInt& eImageType,
594 const eC_Bool bPermanent);
610 const eC_String& kPath,
612 const eC_UInt uiFontSize,
614 const eC_Bool bPermanent =
true);
622 const eC_String& pcPath,
624 const eC_Bool bPermanent =
false);
633 const eC_String& rkPath,
635 eC_Bool bPermanent =
false);
642 const eC_UInt& uiValue,
813 class CGUIBackgroundImageLoader
837 CGUIResourceManager::CGUIBackgroundImageLoader* m_pkBackgroundLoader;
851 const eC_String& rkPath =
"") :
878 CGUIBackgroundImageLoader();
881 CGUIBackgroundImageLoader(
const CGUIBackgroundImageLoader& ref) {}
883 ~CGUIBackgroundImageLoader();
889 eC_Bool AddImageToPrefetchList(
const ImageResource_t eID,
const eC_String& kPath);
895 eC_Bool RemoveImageFromPrefetchList(
const ImageResource_t eID,
const eC_String& kPath);
897 void SetDelay(
const eC_UInt& uiDelay);
912 inline eC_UInt GetNOFImagesInPrefetchList()
const
914 return m_kaPrefetchImageList.GetQuantity();
919 m_kPrefetchImageListSema.Enter();
924 m_kPrefetchImageListSema.Leave();
929 m_kImageLoaderThreadSema.Enter();
934 m_kImageLoaderThreadSema.Leave();
937 eC_Bool GetFirstImage(PrefetchImage_t& kImageToBePrefetched)
939 return m_kaPrefetchImageList.RemoveFront(kImageToBePrefetched);
947 eC_Semaphore m_kPrefetchImageListSema;
950 eC_Semaphore m_kImageLoaderThreadSema;
953 CGUIBackgroundImageLoaderThread* m_pBackgroundImageLoaderThread;
1007 eC_Int iRequestCount;
1017 eC_Int iRequestCount;
1025 eC_String* pkFontName;
1031 eC_Int iRequestCount;
1036 struct GeneralResourceEntry_t
1039 eC_String* pkResourceFilePath;
1041 eC_Int iRequestCount;
1047 CGUIBackgroundImageLoader* m_pkBackgroundLoader;
1049 eC_TArray<ImageEntry_t> m_kaImageTable;
1050 eC_TArray<FontEntry_t> m_kaFontTable;
1051 eC_TArray<SoundEntry_t> m_kaSoundTable;
1052 eC_TArray<GeneralResourceEntry_t> m_kaGeneralResTable;
1053 eC_TArray<eC_UInt> m_kaColorTable;
1057 eC_Bool m_bPreLoadPermanentData;
1060 eC_String m_kImagesFilename;
1063 eC_Bool m_bKeepDynamicImages;
1066 eC_Bool m_bOverwriteDynamicImages;
1069 eC_Bool m_bDynamicImagesMustExist;
1072 eC_String m_kSoundsFilename;
1075 eC_Bool m_bKeepDynamicSounds;
1078 eC_Bool m_bOverwriteDynamicSounds;
1081 eC_Bool m_bDynamicSoundsMustExist;
1084 eC_String m_kFontsFilename;
1087 eC_Bool m_bKeepDynamicFonts;
1090 eC_Bool m_bOverwriteDynamicFonts;
1093 eC_Bool m_bDynamicFontsMustExist;
1096 eC_String m_kGeneralResourcesFilename;
1099 eC_Bool m_bKeepDynamicGeneralResources;
1102 eC_Bool m_bOverwriteDynamicGeneralResources;
1105 eC_Bool m_bDynamicGeneralResourcesMustExist;
1108 eC_Bool m_bPredictResourceFileExtension;
1111 eC_Bool m_bAddResourceFilePrefix;
1114 eC_TArray<eC_UInt> m_auiImageReloadCount;
1115 eC_TArray<eC_Bool> m_abImageDeletedBefore;
1119#ifndef GUILIANI_GUILIANILIB
1124inline void RegisterStaticResources()
1127#define ENTRY(prop_name, prop_value, prop_type) GETPROPHDL.SetGlobalProperty(prop_name, prop_value, static_cast<CGUIValue::GUIValue_t>(prop_type));
1132#define ENTRY(img, img_name, img_permanent) GETRESMANAGER.RegisterImageResource(img_name, img, img_permanent);
1137#define ENTRY(fnt, fnt_name, fnt_size, fnt_style, fnt_permanent) GETRESMANAGER.RegisterFontResource(fnt_name, fnt, fnt_size, static_cast<CFntWrap::GUIFont_t>(fnt_style), fnt_permanent);
1142#define ENTRY(res, res_name, res_permanent) GETRESMANAGER.RegisterGeneralResource(res_name, res, res_permanent);
1143 USER_GENERAL_RESOURCES_TABLE
1147#define ENTRY(snd, snd_name, snd_permanent) GETRESMANAGER.RegisterSoundResource(snd_name, snd, snd_permanent);
1153inline void RegisterGuilianiStandardImages()
1155#define ENTRY(img, img_name, img_permanent) GETRESMANAGER.RegisterImageResource("GuilianiResources/" img_name, img, img_permanent);
1160#define REGISTER_GUI_STANDARDCONTROL_IMAGES RegisterGuilianiStandardImages();
Helper Macros in Guiliani
ColorResource_t
List of color-resource ids.
Definition: GUIColorResource.h:41
Helper Macros in Guiliani
FontResource_t
List of font resource ids.
Definition: GUIFontResource.h:54
Helper Macros in Guiliani
GeneralResource_t
List of general resource ids.
Definition: GUIGeneralResource.h:52
Helper Macros in Guiliani
ImageResource_t
Enumeration of image resource ids.
Definition: GUIImageResource.h:126
#define IMAGE_TABLE
Enum table of all Guiliani internal images.
Definition: GUIImageResource.h:33
Helper Macros in Guiliani
Helper Macros in Guiliani
SoundResource_t
List of sound resource ids.
Definition: GUISoundResource.h:48
GUIFont_t
Definition: FntWrap.h:44
central component-manager
Definition: GUIComponentManager.h:62
GUI base class for any Guiliani application.
Definition: GUI.h:47
This is the Guiliani base class all controls are derived from.
Definition: GUIObject.h:79
Load images in a separate thread.
Definition: GUIResourceManager.h:822
void SetDelay(const eC_UInt &uiDelay)
CGUIBackgroundImageLoaderThread(CGUIResourceManager::CGUIBackgroundImageLoader *pkBackgroundLoader)
virtual void Execute(void *pArg)
Manages resource ID mappings for fonts, images, sounds, etc.
Definition: GUIResourceManager.h:111
CFntWrap::GUIFont_t GetFontStyle(const FontResource_t &eFontID) const
void SetAddResourceFilePrefix(const eC_Bool &bAddResourceFilePrefix)
eC_Bool RegisterColorResourcesFromFile(const eC_String &rkPath)
void WriteDialogToFile(const eC_String &pkStreamingFile, CGUIObject *pkDialog)
void DynamicGeneralResourcesMustExist(eC_Bool bMustExist)
void AddToPrefetchQueue(const ImageResource_t eID)
static void CreateInstance()
eC_Bool RegisterFontResourcesFromFile(const eC_String &rkPath)
void FreeFontResource(const FontResource_t eFontID)
eC_String GetFontPath(const FontResource_t &eFontID) const
SoundResource_t RegisterDynamicSound(const eC_String &kPath, const eC_Bool bPermanent=false)
eC_Bool IsSoundPermanent(const SoundResource_t &eSoundID) const
eC_Bool RegisterGeneralResourcesFromFile(const eC_String &rkPath)
eC_Bool IsDynamicImage(ImageResource_t eImageID)
eC_Bool WriteFontResourcesToFile(const eC_String &kPath)
void OverwriteDynamicSounds(eC_Bool bOverwrite)
void RegisterGeneralResource(const eC_String &rkPath, const GeneralResource_t eResourceID, eC_Bool bPermanent=false)
eC_String GetGeneralResourcesFilename() const
eC_Bool IsDynamicGeneralResource(GeneralResource_t eResourceID)
eC_Bool IsDynamicSound(SoundResource_t eSoundID)
eC_String GetFontsFilename() const
ImageResource_t RegisterDynamicImage(const eC_String &kPath, const eC_Bool bPermanent=false)
void RequestGeneralResource(const GeneralResource_t eResourceID)
eC_Bool IsDynamicFont(FontResource_t eFontID)
eC_Int GetGeneralResourceRequestCount(const GeneralResource_t &eGeneralResourceID) const
GeneralResource_t RegisterDynamicGeneralResource(const eC_String &rkPath, eC_Bool bPermanent=false)
eC_Bool IsDynamicColor(ColorResource_t eColorID)
eC_String GetGeneralResourcePath(const GeneralResource_t &eResourceID) const
eC_String GetSoundsFilename() const
eC_Bool IsImagePermanent(const ImageResource_t &eImageID) const
ColorResource_t RegisterDynamicColor(const eC_UInt &ruiValue)
void SetPrefetchDelay(eC_UInt uiDelay)
ImageResource_t RegisterDynamicImage(void *pkMemory, const eC_UInt &uiWidth, const eC_UInt &uiHeight, const eC_UInt &eImageType, const eC_Bool bPermanent=true)
eC_Bool GetAddResourceFilePrefix(void) const
void KeepDynamicImages(eC_Bool bKeep)
void FreeImageResource(const ImageResource_t eImageID)
void SetPredictResourceFileExtension(const eC_Bool &bPredictResourceFileExtension)
void FreeSoundResource(const SoundResource_t eSoundID)
void PrintRequestCounts()
Only available in debug builds: Prints the count of currently requested images.
eC_Bool GetPredictResourceFileExtension(void) const
FontResource_t RegisterDynamicFont(const eC_String &kPath, eC_UInt uiFontSize, const CFntWrap::GUIFont_t &eFontStyle, eC_Bool bPermanent=true)
void RegisterFontResource(const eC_String &kPath, const FontResource_t eFontID, const eC_UInt uiFontSize, const CFntWrap::GUIFont_t &eFontStyle, const eC_Bool bPermanent=true)
eC_Int GetImageRequestCount(const ImageResource_t &eImageID) const
eC_Bool WriteSoundResourcesToFile(const eC_String &kPath)
void OverwriteDynamicGeneralResources(eC_Bool bOverwrite)
void RegisterSoundResource(const eC_String &pcPath, const SoundResource_t eSoundID, const eC_Bool bPermanent=false)
void RequestSoundResource(const SoundResource_t eSoundID)
static void DeleteInstance()
void PrintReloadCounts()
Only available in debug builds: Prints the count of reloads for each image.
void DynamicSoundsMustExist(eC_Bool bMustExist)
void RefreshImageResource(const ImageResource_t &eImageID, void *pkMemory)
eC_Bool RemoveFromPrefetchQueue(const ImageResource_t eID)
eC_Bool WriteGeneralResourcesToFile(const eC_String &rkPath)
eC_UInt GetFontSize(const FontResource_t &eFontID) const
void KeepDynamicFonts(eC_Bool bKeep)
void KeepDynamicGeneralResources(eC_Bool bKeep)
eC_Bool IsFontPermanent(const FontResource_t &eFontID) const
eC_Bool RegisterSoundResourcesFromFile(const eC_String &rkPath)
void SetGlobalColor(const ColorResource_t &eColorID, eC_UInt uiValue)
void FreeGeneralResource(const GeneralResource_t eResourceID)
eC_Bool WriteColorResourcesToFile(const eC_String &rkPath)
void KeepDynamicSounds(eC_Bool bKeep)
void DynamicImagesMustExist(eC_Bool bMustExist)
void WriteDialogToFile(eC_File *pkFile, CGUIObject *pkDialog)
void RegisterColorResource(const eC_UInt &uiValue, const ColorResource_t eColorID)
void RequestFontResource(const FontResource_t eFontID)
eC_Bool RegisterImageResourcesFromFile(const eC_String &rkPath)
eC_Int GetSoundRequestCount(const SoundResource_t &eSoundID) const
void SetFontStyle(const FontResource_t &eFontID, const CFntWrap::GUIFont_t &eStyle)
void DynamicFontsMustExist(eC_Bool bMustExist)
eC_Bool IsGeneralResourcePermanent(const GeneralResource_t &eResourceID) const
eC_Bool WriteImageResourcesToFile(const eC_String &kPath)
eC_UInt GetColorValue(const ColorResource_t &eColorID) const
void EnablePreloading(const eC_Bool bPreLoadPermanentData)
Definition: GUIResourceManager.h:434
void RequestImageResource(const ImageResource_t eImageID)
void RegisterImageResource(const eC_String &kPath, const ImageResource_t eImageID, const eC_Bool bPermanent=false)
eC_String GetSoundPath(const SoundResource_t &eSoundID) const
eC_String GetImagePath(const ImageResource_t &eImageID) const
eC_String GetImagesFilename() const
eC_Int GetFontRequestCount(const FontResource_t &eFontID) const
void RegisterImageResource(void *pkMemory, const eC_UInt &uiWidth, const eC_UInt &uiHeight, const eC_UInt &eImageType, const ImageResource_t eImageID, const eC_Bool bPermanent)
eC_UInt GetNofImagesInPrefetchList()
void OverwriteDynamicFonts(eC_Bool bOverwrite)
void OverwriteDynamicImages(eC_Bool bOverwrite)
This is the base class for Guiliani threads.
Definition: GUIThread.h:85
Represents a double linked list template with header and tail node.
Definition: eC_TList_doubleLinked.h:67
Internal storage structure for image-related information which is required for background loading.
Definition: GUIResourceManager.h:844
eC_String m_kPath
path
Definition: GUIResourceManager.h:874
ImageResource_t m_eID
id
Definition: GUIResourceManager.h:873
bool operator==(const PrefetchImage_t &rkCompare) const
Definition: GUIResourceManager.h:860
PrefetchImage_t(const ImageResource_t eID=DUMMY_IMAGE, const eC_String &rkPath="")
Definition: GUIResourceManager.h:849