windows-build-updates-20030314
[openafs.git] / src / WINNT / win9xpanel / TrayIcon.h
1 /* Copyright 2000, International Business Machines Corporation and others.
2         All Rights Reserved.
3  
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
7 */
8 #if !defined(AFX_TRAYICON_H__60C86242_1890_11D5_A375_00105A6BCA62__INCLUDED_)
9 #define AFX_TRAYICON_H__60C86242_1890_11D5_A375_00105A6BCA62__INCLUDED_
10
11 #if _MSC_VER > 1000
12 #pragma once
13 #endif // _MSC_VER > 1000
14
15
16 // TrayIcon.h : header file
17 //
18 class MENUBLOCK
19 {                                                                       //used to pass info to the Tray icon
20 public:
21         MENUBLOCK(){mID=-1;}
22         MENUBLOCK(UINT id,const char *msg){
23                 mID=id;
24                 title=msg;
25         }
26         ~MENUBLOCK(){};
27         MENUBLOCK& operator=(MENUBLOCK &other){
28                 mID=other.mID;
29                 title=other.title;
30                 return *this;
31         }
32         friend BOOL operator==(const MENUBLOCK &first, const MENUBLOCK &second );
33         int mID;
34         CString title;
35 };
36
37 typedef MENUBLOCK * LPMENUBLOCK;
38
39 /////////////////////////////////////////////////////////////////////////////
40 // CTrayIcon window
41
42 class CTrayIcon : public CWnd
43 {
44 // Construction
45 public:
46         CTrayIcon(UINT uCallbackMessage, UINT uIcon, UINT uID);
47
48 // Attributes
49 public:
50         static const UINT m_uMsgTaskbarCreated;         /*RegisterWindowMessage(_T("TaskbarCreated"))*/
51     static CWnd  m_wndInvisible;
52         static CWnd * m_pwTrayIcon;
53
54 // Operations
55 public:
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;
66
67     void  SetFocus();
68     BOOL  HideIcon();
69     BOOL  ShowIcon();
70     BOOL  AddIcon(CWnd *pParent);
71     BOOL  RemoveIcon();
72         BOOL IsIconOnTray(){return (m_hParent!=NULL);}
73
74         void MinimiseToTray(CWnd* pWnd);
75         void MaximiseFromTray(CWnd* pWnd);
76         BOOL RemoveTaskbarIcon(CWnd* pWnd);
77
78     // Default handler for tray notification message
79     virtual LRESULT OnTrayNotification(WPARAM uID, LPARAM lEvent);
80
81 // Overrides
82         // ClassWizard generated virtual function overrides
83         //{{AFX_VIRTUAL(CTrayIcon)
84         protected:
85         virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
86         //}}AFX_VIRTUAL
87
88 // Implementation
89 public:
90         virtual ~CTrayIcon();
91
92     DECLARE_DYNAMIC(CTrayIcon)
93
94         // Generated message map functions
95 protected:
96         void OnTaskbarCreated(WPARAM, LPARAM);
97         HWND m_hParent;                         /* Parent window to send messages too e.g. WinAFsLoadDlg*/
98         CList<MENUBLOCK,MENUBLOCK&> m_MountList;
99         int m_iConnectState;
100         NOTIFYICONDATA  m_Notify;
101         static const int m_uMaxTooltipLength;
102         UINT m_DefaultMenuItemID;
103         BOOL m_DefaultMenuItemByPos;
104
105         //{{AFX_MSG(CTrayIcon)
106                 // NOTE - the ClassWizard will add and remove member functions here.
107         //}}AFX_MSG
108         DECLARE_MESSAGE_MAP()
109 };
110
111 /////////////////////////////////////////////////////////////////////////////
112
113 //{{AFX_INSERT_LOCATION}}
114 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
115
116 #endif // !defined(AFX_TRAYICON_H__60C86242_1890_11D5_A375_00105A6BCA62__INCLUDED_)