RUBasePopup.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // RUBasePopup.h
  3. // red_utils
  4. //
  5. // Created by ZhengSong on 2023/6/9.
  6. //
  7. #ifndef RUBasePopup_h
  8. #define RUBasePopup_h
  9. #include "RUDefine.h"
  10. NS_RU_BEGIN
  11. class BasePopup : public Node
  12. {
  13. friend class PopupMgr;
  14. public:
  15. BasePopup();
  16. virtual ~BasePopup();
  17. /*
  18. 作用:立即打开弹窗
  19. */
  20. void popup();
  21. /*
  22. 作用:按队列弹窗,如果当前没有弹窗,根据窗口优先级排序,优先级越小优先弹窗
  23. 参数:priority: 弹窗等级
  24. */
  25. void popupByQueue(int priority = 1);
  26. #pragma mark - PopupMgr用到的 [函数]
  27. protected:
  28. void _execCloseCb();
  29. virtual void _open() = 0;
  30. virtual void _close() = 0;
  31. int _getPriority() const;
  32. const std::string& _getWindowName() const;
  33. protected:
  34. int _priority = 0; //按队列弹窗的优先级
  35. std::string _windowName; //弹窗名,可根据弹窗名做不同的逻辑
  36. std::function<void(void)> _closeCb = nullptr; //窗口关闭的回调
  37. };
  38. NS_RU_END
  39. #endif /* RUBasePopup_h */