1
0

SkinCursorElement.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #pragma once
  2. #include <api/wnd/cursor.h>
  3. #include <api/skin/skinitem.h>
  4. #include "ParamList.h"
  5. #include <api/skin/api_skin.h> // for OSCURSOR, probably should put this in a better place
  6. class SkinCursorElement : public SkinItemI
  7. {
  8. friend class SortSkinCursorElement;
  9. public:
  10. SkinCursorElement(const wchar_t *_id, const wchar_t *_bitmapid, int _x, int _y, int script_id = -1, int secondarycounter = 0, const wchar_t *path = NULL, ifc_xmlreaderparams *params = NULL);
  11. virtual ~SkinCursorElement();
  12. const wchar_t *getId() { return id; }
  13. const wchar_t *getBitmapId() { return bitmap; }
  14. int getHotspotX() { return x; }
  15. int getHotspotY() { return y; }
  16. int getScriptId() { return scriptid; }
  17. int getSecId() { return seccount; }
  18. virtual OSCURSOR getCursor();
  19. virtual const wchar_t *getXmlRootPath() { return rootpath; }
  20. virtual const wchar_t *getName() { return L"cursor"; }
  21. virtual ifc_xmlreaderparams *getParams() { return &params; }
  22. virtual int getSkinPartId() { return scriptid; }
  23. virtual SkinItem *getAncestor();
  24. private:
  25. void makeCursor();
  26. StringW id;
  27. StringW bitmap;
  28. StringW rootpath;
  29. ParamList params;
  30. int x;
  31. int y;
  32. int scriptid;
  33. int seccount;
  34. OSCURSOR icon;
  35. };
  36. class SortSkinCursorElement
  37. {
  38. public:
  39. static int compareItem(SkinCursorElement *p1, SkinCursorElement *p2)
  40. {
  41. int r = WCSICMP(p1->id, p2->id);
  42. if (!r)
  43. {
  44. if (p1->scriptid < p2->scriptid) return -1;
  45. if (p1->scriptid > p2->scriptid) return 1;
  46. if (p1->seccount < p2->seccount) return -1;
  47. if (p1->seccount > p2->seccount) return 1;
  48. return 0;
  49. }
  50. return r;
  51. }
  52. static int compareAttrib(const wchar_t *attrib, SkinCursorElement *item)
  53. {
  54. return WCSICMP(attrib, item->id);
  55. }
  56. };