QsSystemTrayIcon.h 604 B

12345678910111213141516171819202122232425
  1. #pragma once
  2. #include <QtWidgets/qwidget.h>
  3. #include <string>
  4. #include <Kaguya/kaguya.hpp>
  5. #include "QsElement.h"
  6. #include "QsWidget.h"
  7. #include "QsIcon.h"
  8. #include <QtWidgets/qsystemtrayicon.h>
  9. class QsSystemTrayIcon
  10. {
  11. public:
  12. QsSystemTrayIcon(QsWidget* widget);
  13. ~QsSystemTrayIcon();
  14. static void regist(kaguya::State& T);
  15. private:
  16. void setIcon(const QsIcon& icon);
  17. void setToolTip(const std::string& msg);
  18. void onActivated(kaguya::LuaFunction callback) { m_onActivated = callback; }
  19. void hide();
  20. void show();
  21. private:
  22. kaguya::LuaFunction m_onActivated;
  23. QSystemTrayIcon* m_tray = nullptr;
  24. };