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) (side-by-side diff)
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 @@
+// Trayer.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "KLog.h"
+#include "Trayer.h"
+
+#include "SyslogSocket.h"
+#include "KLogDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CTrayer
+
+CTrayer::CTrayer()
+{
+ m_inMenu=0;
+}
+
+CTrayer::~CTrayer()
+{
+}
+
+
+BEGIN_MESSAGE_MAP(CTrayer, CWnd)
+ //{{AFX_MSG_MAP(CTrayer)
+ ON_MESSAGE(WM_TRAYICON, OnTray)
+ ON_COMMAND(ID_TRAY_ABOUTKLOG, OnTrayAboutklog)
+ ON_COMMAND(ID_TRAY_EXIT, OnTrayExit)
+ ON_COMMAND(ID_TRAY_HELP, OnTrayHelp)
+ ON_COMMAND(ID_TRAY_SHOWKLOGWINDOW, OnTrayShowklogwindow)
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CTrayer message handlers
+
+CTrayer::CTrayer(CKLogDlg* daddy)
+: m_inMenu(0), m_Daddy(daddy)
+{
+}
+
+LRESULT CTrayer::OnTray(WPARAM wP,LPARAM lP)
+{
+ ASSERT(wP==IDC_TRAYICON);
+ switch(lP){
+ case WM_RBUTTONDOWN:
+ {
+ CMenu menu;
+ VERIFY(menu.LoadMenu(IDD_KLOG_DIALOG));
+ CMenu *popUp = menu.GetSubMenu(1);
+ ASSERT(popUp);
+ CPoint pt;
+ VERIFY(::GetCursorPos(&pt));
+ m_inMenu++;
+ SetForegroundWindow();
+ popUp->CheckMenuItem(ID_TRAY_SHOWKLOGWINDOW,MF_BYCOMMAND|(IsWindowVisible()?MF_CHECKED:MF_UNCHECKED));
+ popUp->TrackPopupMenu(TPM_RIGHTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,pt.x,pt.y,this);
+ m_inMenu--;
+ SendMessage(WM_NULL);
+ }
+ break;
+ case WM_LBUTTONDOWN:
+ m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_SHOWKLOGWINDOW);
+ break;
+ }
+ return 0;
+}
+
+void CTrayer::OnTrayAboutklog()
+{
+ m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_ABOUTKLOG);
+}
+
+void CTrayer::OnTrayExit()
+{
+ m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_EXIT);
+}
+
+void CTrayer::OnTrayHelp()
+{
+ m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_HELP);
+}
+
+void CTrayer::OnTrayShowklogwindow()
+{
+ m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_SHOWKLOGWINDOW);
+}