show the taskbar icon even after Explorer restart (patch 723532) + some code cleanup
[wxWidgets.git] / include / wx / msw / taskbar.h
1 /////////////////////////////////////////////////////////////////////////
2 // File: wx/msw/taskbar.h
3 // Purpose: Defines wxTaskBarIcon class for manipulating icons on the
4 // Windows task bar.
5 // Author: Julian Smart
6 // Modified by:
7 // Created: 24/3/98
8 // RCS-ID: $Id$
9 // Copyright: (c) Julian Smart
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////
12
13 #ifndef _TASKBAR_H_
14 #define _TASKBAR_H_
15
16 #ifdef __GNUG__
17 #pragma interface "taskbar.h"
18 #endif
19
20 #include "wx/list.h"
21 #include "wx/icon.h"
22
23 class wxTaskBarIcon;
24
25 WX_DECLARE_EXPORTED_LIST(wxTaskBarIcon, wxTaskBarIconList);
26
27 class WXDLLEXPORT wxTaskBarIcon: public wxTaskBarIconBase
28 {
29 DECLARE_DYNAMIC_CLASS(wxTaskBarIcon)
30 public:
31 wxTaskBarIcon(void);
32 virtual ~wxTaskBarIcon(void);
33
34 // Accessors
35 inline WXHWND GetHWND() const { return m_hWnd; }
36 inline bool IsOk() const { return (m_hWnd != 0) ; }
37 inline bool IsIconInstalled() const { return m_iconAdded; }
38
39 // Operations
40 bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxEmptyString);
41 bool RemoveIcon(void);
42 bool PopupMenu(wxMenu *menu); //, int x, int y);
43
44 #if WXWIN_COMPATIBILITY_2_4
45 wxDEPRECATED( bool IsOK() const );
46
47 // Overridables
48 virtual void OnMouseMove(wxEvent&);
49 virtual void OnLButtonDown(wxEvent&);
50 virtual void OnLButtonUp(wxEvent&);
51 virtual void OnRButtonDown(wxEvent&);
52 virtual void OnRButtonUp(wxEvent&);
53 virtual void OnLButtonDClick(wxEvent&);
54 virtual void OnRButtonDClick(wxEvent&);
55 #endif
56
57 // Implementation
58 static wxTaskBarIcon* FindObjectForHWND(WXHWND hWnd);
59 static void AddObject(wxTaskBarIcon* obj);
60 static void RemoveObject(wxTaskBarIcon* obj);
61 static bool RegisterWindowClass();
62 static WXHWND CreateTaskBarWindow();
63 long WindowProc( WXHWND hWnd, unsigned int msg, unsigned int wParam, long lParam );
64
65 // Data members
66 protected:
67 WXHWND m_hWnd;
68 bool m_iconAdded;
69 wxIcon m_icon;
70 wxString m_strTooltip;
71
72 static wxTaskBarIconList sm_taskBarIcons;
73
74 #if WXWIN_COMPATIBILITY_2_4
75 // non-virtual default event handlers to forward events to the virtuals
76 void _OnMouseMove(wxEvent&);
77 void _OnLButtonDown(wxEvent&);
78 void _OnLButtonUp(wxEvent&);
79 void _OnRButtonDown(wxEvent&);
80 void _OnRButtonUp(wxEvent&);
81 void _OnLButtonDClick(wxEvent&);
82 void _OnRButtonDClick(wxEvent&);
83
84 DECLARE_EVENT_TABLE()
85 #endif
86 };
87
88 #if WXWIN_COMPATIBILITY_2_4
89 inline bool wxTaskBarIcon::IsOK() const { return IsOk(); }
90 #endif
91
92 #endif
93 // _TASKBAR_H_
94
95
96
97
98