source: win32/TrayNot.cpp @ d1d6776

Last change on this file since d1d6776 was d1d6776, checked in by Jelmer Vernooij <jelmer@…>, at 2005-11-07T16:20:37Z

Import win32 branch

  • Property mode set to 100644
File size: 2.3 KB
Line 
1// TrayNot.cpp : implementation file
2//
3
4#define BITLBEE_CORE
5#include "bitlbeewin.h"
6#include "TrayNot.h"
7
8#ifdef _DEBUG
9#define new DEBUG_NEW
10#undef THIS_FILE
11static char THIS_FILE[] = __FILE__;
12#endif
13
14/////////////////////////////////////////////////////////////////////////////
15// CTrayNot dialog
16
17
18CTrayNot::CTrayNot(CPropertySheet *s)
19        : CDialog(CTrayNot::IDD, NULL)
20{
21        Create(CTrayNot::IDD);
22        EnableWindow(FALSE);
23
24        dlg = s;
25
26        /* Traybar icon */
27        NOTIFYICONDATA dat;
28        dat.cbSize = sizeof(NOTIFYICONDATA);
29        dat.hWnd = m_hWnd;
30        dat.uID = 1;
31        dat.uFlags = NIF_ICON + NIF_TIP + NIF_MESSAGE;
32        dat.hIcon = AfxGetApp()->LoadIcon(IDI_BEE);
33        dat.uCallbackMessage = BITLBEE_TRAY_ICON;
34        strcpy(dat.szTip, "Bitlbee manager");
35        Shell_NotifyIcon(NIM_ADD, &dat);
36
37        //{{AFX_DATA_INIT(CTrayNot)
38                // NOTE: the ClassWizard will add member initialization here
39        //}}AFX_DATA_INIT
40}
41
42
43void CTrayNot::DoDataExchange(CDataExchange* pDX)
44{
45        CDialog::DoDataExchange(pDX);
46        //{{AFX_DATA_MAP(CTrayNot)
47                // NOTE: the ClassWizard will add DDX and DDV calls here
48        //}}AFX_DATA_MAP
49}
50
51/////////////////////////////////////////////////////////////////////////////
52// CTrayNot message handlers
53
54CTrayNot::~CTrayNot()
55{
56        NOTIFYICONDATA dat;
57        dat.cbSize = sizeof(NOTIFYICONDATA);
58        dat.hWnd = m_hWnd;
59        dat.uID = 1;
60        Shell_NotifyIcon(NIM_DELETE, &dat);
61}
62
63
64BEGIN_MESSAGE_MAP(CTrayNot, CDialog)
65        //{{AFX_MSG_MAP(CTrayNot)
66                // NOTE - the ClassWizard will add and remove mapping macros here.
67                ON_MESSAGE (BITLBEE_TRAY_ICON, OnSysTrayIconClick)
68        //}}AFX_MSG_MAP
69END_MESSAGE_MAP()
70
71
72/////////////////////////////////////////////////////////////////////////////
73// CTrayNot message handlers
74
75afx_msg LONG CTrayNot::OnSysTrayIconClick (WPARAM wParam, LPARAM lParam)
76{
77 switch (lParam)
78    {
79              case WM_LBUTTONDOWN:
80                                        dlg->ShowWindow(SW_SHOW);
81                                        break;
82              case WM_RBUTTONDOWN:
83                   ShowQuickMenu ();
84                   break ;
85    }
86        return 0;
87}
88
89void CTrayNot::ShowQuickMenu()
90{
91   POINT CurPos;
92
93   CMenu qmenu;
94   qmenu.LoadMenu(IDR_POPUP);
95   
96   GetCursorPos (&CurPos);
97
98   CMenu *submenu = qmenu.GetSubMenu(0);
99
100   SetForegroundWindow();
101   // Display the menu. This menu is a popup loaded elsewhere.
102
103        submenu->TrackPopupMenu (TPM_RIGHTBUTTON | TPM_RIGHTALIGN,
104                   CurPos.x,
105                   CurPos.y,this);
106}
Note: See TracBrowser for help on using the repository browser.