12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #pragma once
- //#pragma warning(disable:4251)
- #include <vector>
- #include <mutex>
- #include <map>
- #include "string.h"
- #include "dt.h"
- #include "CLog.h"
- typedef enum
- {
- CLOSE_BUTTON = 0x1, //关闭
- STOP_BUTTON = 0x2, //终止
- REPEAT_BUTTON = 0x4,//重复
- IGNORE_BUTTON = 0x8,//忽略
- }BUTTON_TYPE;
- typedef struct
- {
- int eViewButton; //弹框需显示的按钮(BUTTON_TYPE)的组合
- LogStream::LogLevel iLevel; //报警级别
- long iId; //报警Id
- std::string strDescribe; //报警描述
- std::string strTip; //报警提示
- std::string strHelp; //报警帮助信息
- }MESSAGE_INFO;
- //报警弹框回调函数
- typedef BUTTON_TYPE(*CallMessageBox) (MESSAGE_INFO stMsgInfo);
- class __declspec(dllexport) CMessageBox
- {
- private:
- static std::mutex m_Mutex;
- static CMessageBox* m_pMessageBox;
- std::vector<MESSAGE_INFO> m_vecMessageBox;
- CallMessageBox m_funCallMessageBox = nullptr;
- std::mutex m_PopBoxMutex;
- //用于消息发布
- //void* m_pPubSocket;
- //void* m_pSubscriberSocket;
- long Init();
- void AddPopMassage(MESSAGE_INFO stMsgInfo);
- void ErasePopMassage(int iId);
- public:
- // 获取单实例对象
- static long GetInstance(CMessageBox** pMsgBox);
- void SetCallMessageBoxFunc(CallMessageBox func);
-
- void ClearAllPopMassage();
- BUTTON_TYPE PopMassageBox(int eViewButton, LogStream::LogLevel iLevel, long iId,
- std::string strDescribe, std::string strTip="", std::string strHelp = "");
- };
|