You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
1.9 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. #pragma once
  2. #include "sdk\components\dwin\dwin_screen.hpp"
  3. namespace iflytop {
  4. namespace dwin {
  5. using namespace std;
  6. #pragma pack(1)
  7. typedef struct {
  8. uint16_t m_VP = 0;
  9. uint16_t m_PosX = 0;
  10. uint16_t m_PosY = 0;
  11. uint16_t m_VMin = 0;
  12. uint16_t m_VMax = 0;
  13. uint16_t m_IconMin = 0;
  14. uint16_t m_IconMax = 0;
  15. uint8_t m_Mode = 0;
  16. uint8_t m_IconLib = 0;
  17. uint8_t m_ICONGamma = 0;
  18. uint8_t m_LayerMode = 0;
  19. uint8_t m_FilterSet = 0;
  20. uint8_t m_PICGamma = 0;
  21. } VarIconDescript_t;
  22. #pragma pack()
  23. #define VARICON_VAL_HIDE 0xffff
  24. class VarIcon {
  25. DwinScreen *m_dwin_screen = nullptr;
  26. uint16_t m_descript_add = 0;
  27. VarIconDescript_t m_descript;
  28. uint16_t m_val = 0xffff;
  29. int m_varAdd = -1;
  30. bool m_hide = false;
  31. public:
  32. bool init(DwinScreen *dwin_screen, uint16_t descript_add);
  33. bool init(DwinScreen *dwin_screen);
  34. void initcfg(uint16_t valpointerAdd, uint16_t initval, uint16_t posx, uint16_t posy, uint16_t iconlib, uint16_t iconmin, uint16_t iconmax);
  35. void setpos(uint16_t posx, uint16_t posy);
  36. void setpos_x(uint16_t posx) {
  37. m_descript.m_PosX = posx;
  38. flushcfg();
  39. }
  40. void setpos_y(uint16_t posy) {
  41. m_descript.m_PosY = posy;
  42. flushcfg();
  43. }
  44. /**
  45. * @brief
  46. *
  47. * @param valpointerAdd ַָ
  48. * @param posx ͼεϽx
  49. * @param posy ͼεϽy
  50. * @param iconpath ͼε· 47/1:1 iconlib/iconmin:iconmax
  51. */
  52. // void initcfg(const char *pos, const char *iconpath, uint16_t initval);
  53. void initcfg(int x, int y, const char *iconpath, uint16_t initval);
  54. void initcfg(uint16_t valpointerAdd, uint16_t posx, uint16_t posy, const char *iconpath, uint16_t initval);
  55. public:
  56. bool flushcfg();
  57. bool readcfg();
  58. bool setVal(uint16_t val);
  59. uint16_t getVal();
  60. void hide();
  61. void show(bool showval = true);
  62. VarIconDescript_t &getDescript();
  63. void dumpinfo();
  64. private:
  65. bool _setVal(uint16_t val);
  66. };
  67. } // namespace dwin
  68. } // namespace iflytop