-
Notifications
You must be signed in to change notification settings - Fork 0
/
StatusAreaIcon.h
131 lines (120 loc) · 4.7 KB
/
StatusAreaIcon.h
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
130
131
//---------------------------------------------------------------------------
#ifndef StatusAreaIconH
#define StatusAreaIconH
//---------------------------------------------------------------------------
#include <stdlib.h>
#include <SysUtils.hpp>
#include <Controls.hpp>
#include <Classes.hpp>
#include <Forms.hpp>
#include <ShellAPI.hpp>
//---------------------------------------------------------------------------
#define WM_SYSTEM_TRAY_NOTIFY (WM_USER + 255)
//---------------------------------------------------------------------------
#define NIN_SELECT (WM_USER + 0)
#define NINF_KEY 0x1
#define NIN_KEYSELECT (NIN_SELECT | NINF_KEY)
#define NIN_BALLOONSHOW (WM_USER + 2)
#define NIN_BALLOONHIDE (WM_USER + 3)
#define NIN_BALLOONTIMEOUT (WM_USER + 4)
#define NIN_BALLOONUSERCLICK (WM_USER + 5)
#define NIM_SETFOCUS 0x00000003
#define NIM_SETVERSION 0x00000004
#define NIF_MESSAGE 0x00000001
#define NIF_ICON 0x00000002
#define NIF_TIP 0x00000004
#define NIF_STATE 0x00000008
#define NIF_INFO 0x00000010
#define NIF_GUID 0x00000020
#define NIS_HIDDEN 0x00000001
#define NIS_SHAREDICON 0x00000002
#define NIIF_NONE 0x00000000
#define NIIF_INFO 0x00000001
#define NIIF_WARNING 0x00000002
#define NIIF_ERROR 0x00000003
#define NIIF_ICON_MASK 0x0000000F
#define NIIF_NOSOUND 0x00000010
#define NOTIFYICON_VERSION 3
//---------------------------------------------------------------------------
typedef struct _MYNOTIFYICONDATA {
DWORD cbSize;
HWND hWnd;
UINT uID;
UINT uFlags;
UINT uCallbackMessage;
HICON hIcon;
TCHAR szTip[64];
DWORD dwState;
DWORD dwStateMask;
TCHAR szInfo[256];
union {
UINT uTimeout;
UINT uVersion;
};
TCHAR szInfoTitle[64];
DWORD dwInfoFlags;
GUID guidItem;
} MYNOTIFYICONDATA, *PMYNOTIFYICONDATA;
//---------------------------------------------------------------------------
typedef struct _DllVersionInfo {
DWORD cbSize;
DWORD dwMajorVersion;
DWORD dwMinorVersion;
DWORD dwBuildNumber;
DWORD dwPlatformID;
} DLLVERSIONINFO, *PDLLVERSIONINFO;
//---------------------------------------------------------------------------
typedef int __stdcall (*TWinCall)(PDLLVERSIONINFO ptr);
//---------------------------------------------------------------------------
enum TTooltipType {Standard, Balloon};
enum TBalloonType {None, Info, Warning, Error};
//---------------------------------------------------------------------------
class PACKAGE TStatusAreaIcon : public TComponent
{
private:
TPopupMenu *FPopupMenu;
TImageList *FIconList;
TTooltipType FTooltipType;
AnsiString *FText;
AnsiString *FTitleText;
TBalloonType FBalloonType;
bool FVisible;
int FIconID;
int FShellVersion;
int FIconIndex;
TIcon *CurrIcon;
PMYNOTIFYICONDATA IconData;
HINSTANCE Shell32Lib;
void __fastcall SetTooltipText(AnsiString ss);
void __fastcall SetIcon();
void __fastcall SetVersion();
void __fastcall ShowMenu();
protected:
virtual void __fastcall SetTooltipType(TTooltipType t);
virtual void __fastcall SetIconIndex(int i);
virtual AnsiString __fastcall GetText();
virtual void __fastcall SetText(AnsiString t);
virtual AnsiString __fastcall GetTitleText();
virtual void __fastcall SetTitleText(AnsiString t);
virtual void __fastcall SetPopupMenu(TPopupMenu *m);
public:
__fastcall TStatusAreaIcon(TComponent* Owner);
__fastcall ~TStatusAreaIcon();
void __fastcall Show();
void __fastcall Update();
void __fastcall Hide();
void __fastcall MessageHandler(tagMSG &Message, bool &Handled);
__published:
__property TImageList *IconList = {read=FIconList, write=FIconList, nodefault};
__property TPopupMenu *PopupMenu = {read=FPopupMenu, write=SetPopupMenu, nodefault};
__property int IconIndex = {read=FIconIndex, write=SetIconIndex, default=0};
__property int ShellVersion = {read=FShellVersion, default=0};
__property int IconID = {read=FIconID, write=FIconID, default=1};
__property TTooltipType TooltipType = {read=FTooltipType, write=SetTooltipType, default=Standard};
__property AnsiString Text = {read=GetText, write=SetText, nodefault};
__property AnsiString TitleText = {read=GetTitleText, write=SetTitleText, nodefault};
__property TBalloonType BalloonType = {read=FBalloonType, write=FBalloonType, default=None};
__property bool Visible = {read=FVisible, default=false};
};
//---------------------------------------------------------------------------
#endif