diff options
author | Jean-Francois Mauguit <jfmauguit@mac.com> | 2024-09-24 09:03:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 09:03:25 -0400 |
commit | bab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Winamp/SkinBitmapElement.h | |
parent | 4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff) | |
parent | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff) | |
download | winamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz |
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/Winamp/SkinBitmapElement.h')
-rw-r--r-- | Src/Winamp/SkinBitmapElement.h | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/Src/Winamp/SkinBitmapElement.h b/Src/Winamp/SkinBitmapElement.h new file mode 100644 index 00000000..241b093e --- /dev/null +++ b/Src/Winamp/SkinBitmapElement.h @@ -0,0 +1,85 @@ +#pragma once +#include <api/skin/skinitem.h> +#include "ParamList.h" +#include <tataki/region/region.h> +class ElementRegionServer : public RegionServerI +{ +public: + ElementRegionServer(api_region *r) + : reg(r->getOSHandle()) + {} + + virtual api_region *getRegion() + { + return ® + } + +private: + RegionI reg; +}; + + +struct SkinBitmapElement : public SkinItemI +{ +public: + + SkinBitmapElement(const wchar_t *_id, const wchar_t *_filename, const wchar_t *_rootpath, + int _x, int _y, int _w, int _h, + ifc_xmlreaderparams *pars = NULL, int script_id = -1, int secondarycounter = 0, const wchar_t *colorgrp = NULL); + virtual ~SkinBitmapElement(); + + const wchar_t *getId() { return id; } + const wchar_t *getFilename() { return filename; } + int getX() { return x; } + int getY() { return y; } + int getW() { return w; } + int getH() { return h; } + int getSecCount() { return seccount; } + const wchar_t *getColorGroup() { return colorgroup; } + ElementRegionServer *getRegionServer() { return region; } + void setRegionServer(ElementRegionServer *s) { region = s; } + + virtual const wchar_t *getXmlRootPath() { return rootpath; } + virtual const wchar_t *getName() { return L"bitmap"; } + virtual ifc_xmlreaderparams *getParams() { return ¶ms; } + virtual int getSkinPartId() { return scriptid; } + virtual SkinItem *getAncestor(); + +private: + + StringW id; + StringW filename; + StringW rootpath; + int x; + int y; + int w; + int h; + int scriptid; + int seccount; + ParamList params; + StringW colorgroup; + ElementRegionServer *region; +}; + + +class SortSkinBitmapElement +{ +public: + static int compareItem(SkinBitmapElement *p1, SkinBitmapElement *p2) + { + int r = WCSICMP(p1->getId(), p2->getId()); + if (!r) + { + if (p1->getSkinPartId() < p2->getSkinPartId()) return -1; + if (p1->getSkinPartId() > p2->getSkinPartId()) return 1; + if (p1->getSecCount() < p2->getSecCount()) return -1; + if (p1->getSecCount() > p2->getSecCount()) return 1; + return 0; + } + return r; + } + static int compareAttrib(const wchar_t *attrib, SkinBitmapElement *item) + { + return WCSICMP(attrib, item->getId()); + } +}; |