-rw-r--r-- | Trayer.cpp | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/Trayer.cpp b/Trayer.cpp new file mode 100644 index 0000000..6e8c100 --- a/dev/null +++ b/Trayer.cpp | |||
@@ -0,0 +1,118 @@ | |||
1 | // Trayer.cpp : implementation file | ||
2 | // | ||
3 | |||
4 | #include "stdafx.h" | ||
5 | #include "PumpKIN.h" | ||
6 | #include "Trayer.h" | ||
7 | |||
8 | #include "PumpKINDlg.h" | ||
9 | |||
10 | #ifdef _DEBUG | ||
11 | #define new DEBUG_NEW | ||
12 | #undef THIS_FILE | ||
13 | static char THIS_FILE[] = __FILE__; | ||
14 | #endif | ||
15 | |||
16 | ///////////////////////////////////////////////////////////////////////////// | ||
17 | // CTrayer | ||
18 | |||
19 | CTrayer::CTrayer() | ||
20 | { | ||
21 | m_inMenu=0; | ||
22 | } | ||
23 | |||
24 | CTrayer::~CTrayer() | ||
25 | { | ||
26 | } | ||
27 | |||
28 | |||
29 | BEGIN_MESSAGE_MAP(CTrayer, CWnd) | ||
30 | //{{AFX_MSG_MAP(CTrayer) | ||
31 | ON_MESSAGE(WM_TRAYICON, OnTray) | ||
32 | ON_COMMAND(ID_TRAY_ABOUTPUMPKIN, OnTrayAboutpumpkin) | ||
33 | ON_COMMAND(ID_TRAY_EXIT, OnTrayExit) | ||
34 | ON_COMMAND(ID_TRAY_FETCHFILE, OnTrayFetchfile) | ||
35 | ON_COMMAND(ID_TRAY_HELP, OnTrayHelp) | ||
36 | ON_COMMAND(ID_TRAY_OPENFILESFOLDER, OnTrayOpenfilesfolder) | ||
37 | ON_COMMAND(ID_TRAY_OPTIONS, OnTrayOptions) | ||
38 | ON_COMMAND(ID_TRAY_SENDFILE, OnTraySendfile) | ||
39 | ON_COMMAND(ID_TRAY_SHOWPUMPKINWINDOW, OnTrayShowpumpkinwindow) | ||
40 | //}}AFX_MSG_MAP | ||
41 | END_MESSAGE_MAP() | ||
42 | |||
43 | |||
44 | ///////////////////////////////////////////////////////////////////////////// | ||
45 | // CTrayer message handlers | ||
46 | |||
47 | CTrayer::CTrayer(CPumpKINDlg* daddy) | ||
48 | : m_Daddy(daddy) | ||
49 | { | ||
50 | m_inMenu=0; | ||
51 | } | ||
52 | |||
53 | LRESULT CTrayer::OnTray(WPARAM wP,LPARAM lP) | ||
54 | { | ||
55 | ASSERT(wP==IDC_TRAYICON); | ||
56 | switch(lP){ | ||
57 | case WM_RBUTTONDOWN: | ||
58 | { | ||
59 | CMenu menu; | ||
60 | VERIFY(menu.LoadMenu(IDM_POPUPS)); | ||
61 | CMenu *popUp = menu.GetSubMenu(0); | ||
62 | ASSERT(popUp); | ||
63 | CPoint pt; | ||
64 | VERIFY(::GetCursorPos(&pt)); | ||
65 | m_inMenu++; | ||
66 | SetForegroundWindow(); | ||
67 | popUp->CheckMenuItem(ID_TRAY_SHOWPUMPKINWINDOW,MF_BYCOMMAND|(IsWindowVisible()?MF_CHECKED:MF_UNCHECKED)); | ||
68 | popUp->TrackPopupMenu(TPM_RIGHTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,pt.x,pt.y,this); | ||
69 | m_inMenu--; | ||
70 | SendMessage(WM_NULL); | ||
71 | } | ||
72 | break; | ||
73 | case WM_LBUTTONDOWN: | ||
74 | m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_SHOWPUMPKINWINDOW); | ||
75 | break; | ||
76 | } | ||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | void CTrayer::OnTrayAboutpumpkin() | ||
81 | { | ||
82 | m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_ABOUTPUMPKIN); | ||
83 | } | ||
84 | |||
85 | void CTrayer::OnTrayExit() | ||
86 | { | ||
87 | m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_EXIT); | ||
88 | } | ||
89 | |||
90 | void CTrayer::OnTrayFetchfile() | ||
91 | { | ||
92 | m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_FETCHFILE); | ||
93 | } | ||
94 | |||
95 | void CTrayer::OnTrayHelp() | ||
96 | { | ||
97 | m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_HELP); | ||
98 | } | ||
99 | |||
100 | void CTrayer::OnTrayOpenfilesfolder() | ||
101 | { | ||
102 | m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_OPENFILESFOLDER); | ||
103 | } | ||
104 | |||
105 | void CTrayer::OnTrayOptions() | ||
106 | { | ||
107 | m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_OPTIONS); | ||
108 | } | ||
109 | |||
110 | void CTrayer::OnTraySendfile() | ||
111 | { | ||
112 | m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_SENDFILE); | ||
113 | } | ||
114 | |||
115 | void CTrayer::OnTrayShowpumpkinwindow() | ||
116 | { | ||
117 | m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_SHOWPUMPKINWINDOW); | ||
118 | } | ||