-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathTaskbarTextIcon.h
More file actions
129 lines (110 loc) · 2.66 KB
/
TaskbarTextIcon.h
File metadata and controls
129 lines (110 loc) · 2.66 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#pragma once
#include "systemtraysdk.h"
#include "DynamicIcon.h"
#include <crtdbg.h>
class CTaskbarTextIcon
{
private:
CDynamicIcon *m_pDicon;
int iFarbeIconC;
int iFontIconC;
LPCTSTR aTooltipC;
void _createdicon(const int iFarbeIconC, LPCTSTR aTooltipC, const int iFontIconC)
{
if(m_pSystray) m_pSystray->SetTooltipText(aTooltipC);
CDynamicIcon* pDiconTemp = new CDynamicIcon(m_line1, m_line2, iFarbeIconC, iFontIconC);
if(m_pSystray) m_pSystray->SetIcon(pDiconTemp->GetHIcon());
if(m_pDicon)delete m_pDicon;
m_pDicon = pDiconTemp;
};
void _ballondicon(LPCTSTR szText,LPCTSTR szTitle,DWORD dwIcon,UINT uTimeout)
{
if(m_pDicon) m_pSystray->ShowBalloon(szText, szTitle, dwIcon, uTimeout);
};
void _createsystray
(
HINSTANCE hInst,
HWND hWnd,
UINT uCallbackMessage,
UINT uID,
LPCTSTR aTooltipC
)
{
if(m_pSystray) delete m_pSystray;
m_pSystray = new CSystemTray();
m_pSystray->Create
(
hInst,
hWnd,
uCallbackMessage,
aTooltipC, // tooltip
m_pDicon->GetHIcon(),
0
);
};
protected:
static const int LINESLEN = 4;
CSystemTray *m_pSystray;
char m_line1[LINESLEN],m_line2[LINESLEN];
//TODO: implement set/get/use
COLORREF m_TextColor, m_BgColor;
bool m_BgTransparent;
void _setlines(const char* line1,const char* line2)
{
strncpy_s(m_line1,sizeof(m_line1),line1,3);
strncpy_s(m_line2,sizeof(m_line2),line2,3);
m_line1[LINESLEN-1] = 0;
m_line2[LINESLEN-1] = 0;
};
public:
CTaskbarTextIcon
(
HINSTANCE hInst,
HWND hWnd,
UINT uCallbackMessage,
UINT uID,
const char * line1 = 0, //can be 3 chars
const char * line2 = 0, //can be 3 chars
int iFarbeIconC = 0,
int iFontIconC = 11,
LPCTSTR aTooltipC = _T("")
)
:
m_pSystray(NULL),
m_pDicon(NULL),
m_TextColor(RGB(0,0,0)),
m_BgColor(RGB(255,0,0)),
m_BgTransparent(false)
{
_setlines(line1,line2);
_createdicon(iFarbeIconC, aTooltipC, iFontIconC);
_createsystray(hInst, hWnd, uCallbackMessage, uID, aTooltipC);
};
~CTaskbarTextIcon(void)
{
if(m_pSystray)delete m_pSystray;
if(m_pDicon)delete m_pDicon;
};
void ChangeText
(
const char * line1,
const char * line2 = 0,
const int iFarbeIconC = 0,
const int iFontIconC = 9,
LPCTSTR aTooltipC =_T("/0")
)
{
_setlines(line1,line2);
_createdicon(iFarbeIconC,aTooltipC,iFontIconC);
}
void DiShowballon
(
LPCTSTR szText ,
LPCTSTR szTitle ,
DWORD dwIcon ,
UINT uTimeout
)
{
_ballondicon( szText, szTitle, dwIcon, uTimeout);
}
};