1 /* Copyright 2000, International Business Machines Corporation and others.
4 This software has been released under the terms of the IBM Public
5 License. For details, see the LICENSE file in the top-level source
6 directory or online at http://www.openafs.org/dl/license10.html
8 #if !defined(AFX_TRAYICON_H__60C86242_1890_11D5_A375_00105A6BCA62__INCLUDED_)
9 #define AFX_TRAYICON_H__60C86242_1890_11D5_A375_00105A6BCA62__INCLUDED_
13 #endif // _MSC_VER > 1000
16 // TrayIcon.h : header file
19 { //used to pass info to the Tray icon
22 MENUBLOCK(UINT id,const char *msg){
27 MENUBLOCK& operator=(MENUBLOCK &other){
32 friend BOOL operator==(const MENUBLOCK &first, const MENUBLOCK &second );
37 typedef MENUBLOCK * LPMENUBLOCK;
39 /////////////////////////////////////////////////////////////////////////////
42 class CTrayIcon : public CWnd
46 CTrayIcon(UINT uCallbackMessage, UINT uIcon, UINT uID);
50 static const UINT m_uMsgTaskbarCreated; /*RegisterWindowMessage(_T("TaskbarCreated"))*/
51 static CWnd m_wndInvisible;
52 static CWnd * m_pwTrayIcon;
56 static CWnd * FindTrayWnd();
57 void SetConnectState(int istate);
58 void AddDrive(MENUBLOCK &menu);
59 void RemoveDrive(MENUBLOCK &menu);
60 BOOL SetIcon(HICON hIcon);
61 BOOL SetIcon(LPCTSTR lpszIconName);
62 BOOL SetIcon(UINT nIDResource);
63 BOOL SetStandardIcon(LPCTSTR lpIconName);
64 BOOL SetStandardIcon(UINT nIDResource);
65 HICON GetIcon() const;
70 BOOL AddIcon(CWnd *pParent);
72 BOOL IsIconOnTray(){return (m_hParent!=NULL);}
74 void MinimiseToTray(CWnd* pWnd);
75 void MaximiseFromTray(CWnd* pWnd);
76 BOOL RemoveTaskbarIcon(CWnd* pWnd);
78 // Default handler for tray notification message
79 virtual LRESULT OnTrayNotification(WPARAM uID, LPARAM lEvent);
82 // ClassWizard generated virtual function overrides
83 //{{AFX_VIRTUAL(CTrayIcon)
85 virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
92 DECLARE_DYNAMIC(CTrayIcon)
94 // Generated message map functions
96 void OnTaskbarCreated(WPARAM, LPARAM);
97 HWND m_hParent; /* Parent window to send messages too e.g. WinAFsLoadDlg*/
98 CList<MENUBLOCK,MENUBLOCK&> m_MountList;
100 NOTIFYICONDATA m_Notify;
101 static const int m_uMaxTooltipLength;
102 UINT m_DefaultMenuItemID;
103 BOOL m_DefaultMenuItemByPos;
105 //{{AFX_MSG(CTrayIcon)
106 // NOTE - the ClassWizard will add and remove member functions here.
108 DECLARE_MESSAGE_MAP()
111 /////////////////////////////////////////////////////////////////////////////
113 //{{AFX_INSERT_LOCATION}}
114 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
116 #endif // !defined(AFX_TRAYICON_H__60C86242_1890_11D5_A375_00105A6BCA62__INCLUDED_)