summaryrefslogtreecommitdiff
path: root/yapp/popup_history.h
blob: 8bb6c7b26066fe2d8e92793ed1f858332dcf9fc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef __popup_history_h__
#define __popup_history_h__

#define HISTORY_SIZE 200 //number of popup history items

#define PHDF_UNICODE 1 

struct PopupHistoryData{
	DWORD flags; //PHDF_* flags
	union{
		char *message;
		wchar_t *messageW;
	};
	union{
		char *title;
		wchar_t *titleW;
	};
	time_t timestamp;
};

class PopupHistoryList{
	protected:
	private:
		PopupHistoryData *historyData; //historyData[0] - oldest, historyData[size - 1] - newest
		int count;
		int size;
		
		void DeleteData(int index);
		void AddItem(PopupHistoryData item); //adds a PopupHistoryData item
		void RemoveItem(int index);
		
	public:
		PopupHistoryList();
		~PopupHistoryList();
		
		void Add(char *title, char *message, time_t timestamp);
		void Add(wchar_t *title, wchar_t *message, time_t timestamp);
		
		PopupHistoryData *Get(int index);
		
		void Clear();
		int Count();
		int Size();
};

/*Shows a history with the last popups.
Useful if you've missed a popup when it appeared.
wParam - 0
lParam - 0
*/
#define MS_POPUP_SHOWHISTORY "PopUp/ShowHistory"

extern PopupHistoryList lstPopupHistory; //defined in main.cpp
extern HWND hHistoryWindow; //the history window
void RefreshPopupHistory(HWND hWnd);

BOOL CALLBACK DlgProcHistLst(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);

#endif //__popup_history_h__