summaryrefslogtreecommitdiffabout
path: root/Trayer.cpp
authorMichael Krelin <hacker@klever.net>2004-07-05 01:53:09 (UTC)
committer Michael Krelin <hacker@klever.net>2004-07-05 01:53:09 (UTC)
commita1487b3fc0313408525cd5b2f3bc4a462df351f7 (patch) (unidiff)
tree010aec6c2abd5ada2f909ac6798c93bf22508bf5 /Trayer.cpp
downloadklog-a1487b3fc0313408525cd5b2f3bc4a462df351f7.zip
klog-a1487b3fc0313408525cd5b2f3bc4a462df351f7.tar.gz
klog-a1487b3fc0313408525cd5b2f3bc4a462df351f7.tar.bz2
initial commit into svn repository
git-svn-id: http://svn.klever.net/kin/klog/trunk@1 fe716a7a-6dde-0310-88d9-d003556173a8
Diffstat (limited to 'Trayer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--Trayer.cpp94
1 files changed, 94 insertions, 0 deletions
diff --git a/Trayer.cpp b/Trayer.cpp
new file mode 100644
index 0000000..cf2a8ac
--- a/dev/null
+++ b/Trayer.cpp
@@ -0,0 +1,94 @@
1// Trayer.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "KLog.h"
6#include "Trayer.h"
7
8#include "SyslogSocket.h"
9#include "KLogDlg.h"
10
11#ifdef _DEBUG
12#define new DEBUG_NEW
13#undef THIS_FILE
14static char THIS_FILE[] = __FILE__;
15#endif
16
17/////////////////////////////////////////////////////////////////////////////
18// CTrayer
19
20CTrayer::CTrayer()
21{
22 m_inMenu=0;
23}
24
25CTrayer::~CTrayer()
26{
27}
28
29
30BEGIN_MESSAGE_MAP(CTrayer, CWnd)
31 //{{AFX_MSG_MAP(CTrayer)
32 ON_MESSAGE(WM_TRAYICON, OnTray)
33 ON_COMMAND(ID_TRAY_ABOUTKLOG, OnTrayAboutklog)
34 ON_COMMAND(ID_TRAY_EXIT, OnTrayExit)
35 ON_COMMAND(ID_TRAY_HELP, OnTrayHelp)
36 ON_COMMAND(ID_TRAY_SHOWKLOGWINDOW, OnTrayShowklogwindow)
37 //}}AFX_MSG_MAP
38END_MESSAGE_MAP()
39
40
41/////////////////////////////////////////////////////////////////////////////
42// CTrayer message handlers
43
44CTrayer::CTrayer(CKLogDlg* daddy)
45: m_inMenu(0), m_Daddy(daddy)
46{
47}
48
49LRESULT CTrayer::OnTray(WPARAM wP,LPARAM lP)
50{
51 ASSERT(wP==IDC_TRAYICON);
52 switch(lP){
53 case WM_RBUTTONDOWN:
54 {
55 CMenu menu;
56 VERIFY(menu.LoadMenu(IDD_KLOG_DIALOG));
57 CMenu *popUp = menu.GetSubMenu(1);
58 ASSERT(popUp);
59 CPoint pt;
60 VERIFY(::GetCursorPos(&pt));
61 m_inMenu++;
62 SetForegroundWindow();
63 popUp->CheckMenuItem(ID_TRAY_SHOWKLOGWINDOW,MF_BYCOMMAND|(IsWindowVisible()?MF_CHECKED:MF_UNCHECKED));
64 popUp->TrackPopupMenu(TPM_RIGHTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,pt.x,pt.y,this);
65 m_inMenu--;
66 SendMessage(WM_NULL);
67 }
68 break;
69 case WM_LBUTTONDOWN:
70 m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_SHOWKLOGWINDOW);
71 break;
72 }
73 return 0;
74}
75
76void CTrayer::OnTrayAboutklog()
77{
78 m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_ABOUTKLOG);
79}
80
81void CTrayer::OnTrayExit()
82{
83 m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_EXIT);
84}
85
86void CTrayer::OnTrayHelp()
87{
88 m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_HELP);
89}
90
91void CTrayer::OnTrayShowklogwindow()
92{
93 m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_SHOWKLOGWINDOW);
94}