]>
Commit | Line | Data |
---|---|---|
2bda0e17 KB |
1 | ///////////////////////////////////////////////////////////////////////// |
2 | // File: 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) | |
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 | ||
56194595 | 20 | #include <wx/event.h> |
2bda0e17 KB |
21 | #include <wx/list.h> |
22 | #include <wx/icon.h> | |
23 | ||
937cf827 | 24 | class WXDLLEXPORT wxTaskBarIcon: public wxEvtHandler { |
56194595 | 25 | DECLARE_DYNAMIC_CLASS(wxTaskBarIcon) |
2bda0e17 | 26 | public: |
56194595 RD |
27 | wxTaskBarIcon(void); |
28 | virtual ~wxTaskBarIcon(void); | |
2bda0e17 KB |
29 | |
30 | // Accessors | |
31 | inline WXHWND GetHWND() const { return m_hWnd; } | |
32 | inline bool IsOK() const { return (m_hWnd != 0) ; } | |
33 | inline bool IsIconInstalled() const { return m_iconAdded; } | |
34 | ||
35 | // Operations | |
36 | bool SetIcon(const wxIcon& icon, const wxString& tooltip = ""); | |
37 | bool RemoveIcon(void); | |
69ecd30f | 38 | bool PopupMenu(wxMenu *menu); //, int x, int y); |
2bda0e17 KB |
39 | |
40 | // Overridables | |
56194595 RD |
41 | virtual void OnMouseMove(wxEvent&); |
42 | virtual void OnLButtonDown(wxEvent&); | |
43 | virtual void OnLButtonUp(wxEvent&); | |
44 | virtual void OnRButtonDown(wxEvent&); | |
45 | virtual void OnRButtonUp(wxEvent&); | |
46 | virtual void OnLButtonDClick(wxEvent&); | |
47 | virtual void OnRButtonDClick(wxEvent&); | |
2bda0e17 KB |
48 | |
49 | // Implementation | |
50 | static wxTaskBarIcon* FindObjectForHWND(WXHWND hWnd); | |
51 | static void AddObject(wxTaskBarIcon* obj); | |
52 | static void RemoveObject(wxTaskBarIcon* obj); | |
53 | static bool RegisterWindowClass(); | |
54 | static WXHWND CreateTaskBarWindow(); | |
55 | long WindowProc( WXHWND hWnd, unsigned int msg, unsigned int wParam, long lParam ); | |
56 | ||
57 | // Data members | |
58 | protected: | |
59 | WXHWND m_hWnd; | |
60 | bool m_iconAdded; | |
61 | static wxList sm_taskBarIcons; | |
62 | static bool sm_registeredClass; | |
63 | static unsigned int sm_taskbarMsg; | |
56194595 | 64 | |
69ecd30f RD |
65 | // non-virtual default event handlers to forward events to the virtuals |
66 | void _OnMouseMove(wxEvent&); | |
67 | void _OnLButtonDown(wxEvent&); | |
68 | void _OnLButtonUp(wxEvent&); | |
69 | void _OnRButtonDown(wxEvent&); | |
70 | void _OnRButtonUp(wxEvent&); | |
71 | void _OnLButtonDClick(wxEvent&); | |
72 | void _OnRButtonDClick(wxEvent&); | |
73 | ||
74 | ||
6164d85e | 75 | DECLARE_EVENT_TABLE() |
2bda0e17 KB |
76 | }; |
77 | ||
56194595 RD |
78 | |
79 | ||
80 | const wxEventType wxEVT_TASKBAR_MOVE = wxEVT_FIRST + 1550; | |
81 | const wxEventType wxEVT_TASKBAR_LEFT_DOWN = wxEVT_FIRST + 1551; | |
82 | const wxEventType wxEVT_TASKBAR_LEFT_UP = wxEVT_FIRST + 1552; | |
83 | const wxEventType wxEVT_TASKBAR_RIGHT_DOWN = wxEVT_FIRST + 1553; | |
84 | const wxEventType wxEVT_TASKBAR_RIGHT_UP = wxEVT_FIRST + 1554; | |
85 | const wxEventType wxEVT_TASKBAR_LEFT_DCLICK = wxEVT_FIRST + 1555; | |
86 | const wxEventType wxEVT_TASKBAR_RIGHT_DCLICK = wxEVT_FIRST + 1556; | |
87 | ||
88 | ||
89 | #define EVT_TASKBAR_MOVE(fn) { wxEVT_TASKBAR_MOVE, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL }, | |
90 | #define EVT_TASKBAR_LEFT_DOWN(fn) { wxEVT_TASKBAR_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL }, | |
91 | #define EVT_TASKBAR_LEFT_UP(fn) { wxEVT_TASKBAR_LEFT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL }, | |
92 | #define EVT_TASKBAR_RIGHT_DOWN(fn) { wxEVT_TASKBAR_RIGHT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL }, | |
93 | #define EVT_TASKBAR_RIGHT_UP(fn) { wxEVT_TASKBAR_RIGHT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL }, | |
94 | #define EVT_TASKBAR_LEFT_DCLICK(fn) { wxEVT_TASKBAR_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL }, | |
95 | #define EVT_TASKBAR_RIGHT_DCLICK(fn) { wxEVT_TASKBAR_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL }, | |
96 | ||
69ecd30f | 97 | |
2bda0e17 KB |
98 | #endif |
99 | // _TASKBAR_H_ | |
100 | ||
56194595 RD |
101 | |
102 | ||
103 | ||
104 |