]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/taskbar.h
forward declare wxMenu
[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/event.h"
21 #include "wx/list.h"
22 #include "wx/icon.h"
23
24 class wxTaskBarIcon;
25
26 WX_DECLARE_EXPORTED_LIST(wxTaskBarIcon, wxTaskBarIconList);
27
28 class WXDLLEXPORT wxTaskBarIcon: public wxEvtHandler {
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 // Overridables
45 virtual void OnMouseMove(wxEvent&);
46 virtual void OnLButtonDown(wxEvent&);
47 virtual void OnLButtonUp(wxEvent&);
48 virtual void OnRButtonDown(wxEvent&);
49 virtual void OnRButtonUp(wxEvent&);
50 virtual void OnLButtonDClick(wxEvent&);
51 virtual void OnRButtonDClick(wxEvent&);
52
53 // Implementation
54 static wxTaskBarIcon* FindObjectForHWND(WXHWND hWnd);
55 static void AddObject(wxTaskBarIcon* obj);
56 static void RemoveObject(wxTaskBarIcon* obj);
57 static bool RegisterWindowClass();
58 static WXHWND CreateTaskBarWindow();
59 long WindowProc( WXHWND hWnd, unsigned int msg, unsigned int wParam, long lParam );
60
61 // Data members
62 protected:
63 WXHWND m_hWnd;
64 bool m_iconAdded;
65 static wxTaskBarIconList sm_taskBarIcons;
66 static bool sm_registeredClass;
67 static unsigned int sm_taskbarMsg;
68
69 // non-virtual default event handlers to forward events to the virtuals
70 void _OnMouseMove(wxEvent&);
71 void _OnLButtonDown(wxEvent&);
72 void _OnLButtonUp(wxEvent&);
73 void _OnRButtonDown(wxEvent&);
74 void _OnRButtonUp(wxEvent&);
75 void _OnLButtonDClick(wxEvent&);
76 void _OnRButtonDClick(wxEvent&);
77
78
79 DECLARE_EVENT_TABLE()
80 };
81
82
83 // ----------------------------------------------------------------------------
84 // wxTaskBarIcon events
85 // ----------------------------------------------------------------------------
86
87 class WXDLLEXPORT wxTaskBarIconEvent : public wxEvent
88 {
89 public:
90 wxTaskBarIconEvent(wxEventType evtType, wxTaskBarIcon *tbIcon)
91 : wxEvent(-1, evtType)
92 {
93 SetEventObject(tbIcon);
94 }
95
96 virtual wxEvent *Clone() const { return new wxTaskBarIconEvent(*this); }
97 };
98
99 BEGIN_DECLARE_EVENT_TYPES()
100 DECLARE_EVENT_TYPE( wxEVT_TASKBAR_MOVE, 1550 )
101 DECLARE_EVENT_TYPE( wxEVT_TASKBAR_LEFT_DOWN, 1551 )
102 DECLARE_EVENT_TYPE( wxEVT_TASKBAR_LEFT_UP, 1552 )
103 DECLARE_EVENT_TYPE( wxEVT_TASKBAR_RIGHT_DOWN, 1553 )
104 DECLARE_EVENT_TYPE( wxEVT_TASKBAR_RIGHT_UP, 1554 )
105 DECLARE_EVENT_TYPE( wxEVT_TASKBAR_LEFT_DCLICK, 1555 )
106 DECLARE_EVENT_TYPE( wxEVT_TASKBAR_RIGHT_DCLICK, 1556 )
107 END_DECLARE_EVENT_TYPES()
108
109 #define EVT_TASKBAR_MOVE(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_MOVE, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
110 #define EVT_TASKBAR_LEFT_DOWN(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
111 #define EVT_TASKBAR_LEFT_UP(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_LEFT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
112 #define EVT_TASKBAR_RIGHT_DOWN(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_RIGHT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
113 #define EVT_TASKBAR_RIGHT_UP(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_RIGHT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
114 #define EVT_TASKBAR_LEFT_DCLICK(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
115 #define EVT_TASKBAR_RIGHT_DCLICK(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL),
116
117
118 #endif
119 // _TASKBAR_H_
120
121
122
123
124