GrpcPrint/PrintS/Toast.h

46 lines
840 B
C
Raw Normal View History

2024-03-19 17:45:12 +08:00
#pragma once
#include "stdafx.h"
//#include <Windows.h>
#include <list>
#define IMGUI_DEFINE_MATH_OPERATORS
2024-03-19 17:45:12 +08:00
#include "external/imgui/imgui.h"
struct ToastBean{
std::string content;
unsigned long duration;
uint64_t liveBegin;
uint64_t liveEnd;
ImVec4 color;
bool isAssic;
ToastBean(string strcontent,unsigned long dduration, ImVec4 icolor = ImVec4(1,1,1,1),bool isa=false)
{
content = strcontent;
duration = dduration;
liveBegin = 0;
liveEnd = 0;
color = icolor;
isAssic = isa;
}
};
class Toast
{
public:
Toast();
~Toast();
void AddToast(ToastBean* tbean);
ToastBean* GetToast();
private:
list<ToastBean*> m_ToastList;
CRITICAL_SECTION m_cs;
const int MAX_LENGTH = 100;
public:
static const ImVec4 COLOR_ORANGE;
static const ImVec4 COLOR_RED;
static const ImVec4 COLOR_GREEN;
};
extern Toast* g_Toast;