1
0

PaletteManager.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #pragma once
  2. #include "SkinElementAlias.h"
  3. #include "SkinColorElement.h"
  4. #include "SkinCursorElement.h"
  5. #include "SkinBitmapElement.h"
  6. #include <api/syscb/callbacks/gccb.h>
  7. #include <api/skin/api_palette.h>
  8. #include <bfc/ptrlist.h>
  9. #include "GammaFilter.h"
  10. class PaletteManager;
  11. class PaletteGC : public GarbageCollectCallbackI
  12. {
  13. public:
  14. PaletteGC(PaletteManager *_parent)
  15. {
  16. parent = _parent;
  17. }
  18. private:
  19. int gccb_onGarbageCollect();
  20. PaletteManager *parent;
  21. };
  22. class PaletteManager : public api_palette
  23. {
  24. public:
  25. static const char *getServiceName() { return "Skin Palette API"; }
  26. static const GUID getServiceGuid() { return PaletteManagerGUID; }
  27. PaletteManager();
  28. ~PaletteManager();
  29. void StartTransaction();
  30. void EndTransaction();
  31. void Reset();
  32. const int *getSkinPartIteratorPtr();
  33. int newSkinPart();
  34. int getSkinPartIterator();
  35. void UnloadElements(int skinpart);
  36. /* Aliases */
  37. void AddAlias(const wchar_t *id, const wchar_t *target);
  38. const wchar_t *getElementAlias(const wchar_t *alias);
  39. SkinItem *getAliasAncestor(SkinItem *item);
  40. /* Colors */
  41. void AddColor(const wchar_t *id, ARGB32 value, const wchar_t *colorgrp = NULL, const wchar_t *path = NULL, ifc_xmlreaderparams *p = NULL);
  42. int getNumColorElements();
  43. const wchar_t *enumColorElement(int n);
  44. ARGB32 *getColorElementRef(const wchar_t *type, const wchar_t **grp = NULL);
  45. SkinItem *getColorAncestor(SkinItem *item);
  46. ARGB32 getColorElement(const wchar_t *type, const wchar_t **grp = NULL);
  47. /* Cursors */
  48. void AddCursor(const wchar_t *id, const wchar_t *bitmapid, int x, int y, const wchar_t *path = NULL, ifc_xmlreaderparams *params = NULL);
  49. int getCursorElement(const wchar_t *id);
  50. OSCURSOR getCursor(const wchar_t *id);
  51. SkinItem *getCursorAncestor(SkinItem *item);
  52. const wchar_t *getSkinCursorBitmapId(const wchar_t *cursor);
  53. /* Bitmaps */
  54. void AddBitmap(const wchar_t *id, const wchar_t *filename, const wchar_t *path, int x, int y, int w, int h, ifc_xmlreaderparams *params = NULL, const wchar_t *colorgroup = NULL);
  55. int getBitmapElement(const wchar_t *type);
  56. SkinItem *getBitmapAncestor(SkinItem *item);
  57. SkinBitmapElement *enumBitmapElement(int n);
  58. int getNumBitmapElement();
  59. const wchar_t *getSkinBitmapFilename(const wchar_t *id, int *x, int *y, int *w, int *h, const wchar_t **rootpath, ifc_xmlreaderparams **params);
  60. const wchar_t *getGammaGroupFromId(const wchar_t *id);
  61. int getLayerFromId(const wchar_t *id);
  62. /* Region Server (part of Bitmaps) */
  63. RegionServer *requestSkinRegion(const wchar_t *id);
  64. void cacheSkinRegion(const wchar_t *id, api_region *r);
  65. void onGarbageCollect();
  66. void garbageCollectRegionServer(ElementRegionServer *rs);
  67. protected:
  68. RECVS_DISPATCH;
  69. private:
  70. SkinCursorElement *enumCursorElement(int n);
  71. int getNumSkinCursorElements();
  72. int skinpart_iterator;
  73. int genericcounter;
  74. typedef PtrListQuickMultiSorted<SkinElementAlias, SortSkinElementAlias> SkinAliasList;
  75. SkinAliasList skinAliasList;
  76. typedef PtrListQuickMultiSorted<SkinColorElement, SortSkinColorElement> SkinColorList;
  77. SkinColorList skinColorList;
  78. typedef PtrListQuickMultiSorted<SkinCursorElement, SortSkinCursorElement> SkinCursorList;
  79. SkinCursorList skinCursorList;
  80. typedef PtrListQuickMultiSorted<SkinBitmapElement, SortSkinBitmapElement> SkinBitmapList;
  81. SkinBitmapList skinBitmapList;
  82. PtrList<ElementRegionServer> regsrvGC;
  83. PaletteGC paletteGC;
  84. GammaFilterFactory gammaFilterFactory;
  85. };