]>
Commit | Line | Data |
---|---|---|
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 WXDLLEXPORT wxTaskBarIcon: public wxEvtHandler { | |
25 | DECLARE_DYNAMIC_CLASS(wxTaskBarIcon) | |
26 | public: | |
27 | wxTaskBarIcon(void); | |
28 | virtual ~wxTaskBarIcon(void); | |
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 = wxEmptyString); | |
37 | bool RemoveIcon(void); | |
38 | bool PopupMenu(wxMenu *menu); //, int x, int y); | |
39 | ||
40 | // Overridables | |
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&); | |
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; | |
64 | ||
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 | ||
75 | DECLARE_EVENT_TABLE() | |
76 | }; | |
77 | ||
78 | ||
79 | // ---------------------------------------------------------------------------- | |
80 | // wxTaskBarIcon events | |
81 | // ---------------------------------------------------------------------------- | |
82 | ||
83 | class WXDLLEXPORT wxTaskBarIconEvent : public wxEvent | |
84 | { | |
85 | public: | |
86 | wxTaskBarIconEvent(wxEventType evtType, wxTaskBarIcon *tbIcon) | |
87 | : wxEvent(-1, evtType) | |
88 | { | |
89 | SetEventObject(tbIcon); | |
90 | } | |
91 | ||
92 | virtual wxEvent *Clone() const { return new wxTaskBarIconEvent(*this); } | |
93 | }; | |
94 | ||
95 | BEGIN_DECLARE_EVENT_TYPES() | |
96 | DECLARE_EVENT_TYPE( wxEVT_TASKBAR_MOVE, 1550 ) | |
97 | DECLARE_EVENT_TYPE( wxEVT_TASKBAR_LEFT_DOWN, 1551 ) | |
98 | DECLARE_EVENT_TYPE( wxEVT_TASKBAR_LEFT_UP, 1552 ) | |
99 | DECLARE_EVENT_TYPE( wxEVT_TASKBAR_RIGHT_DOWN, 1553 ) | |
100 | DECLARE_EVENT_TYPE( wxEVT_TASKBAR_RIGHT_UP, 1554 ) | |
101 | DECLARE_EVENT_TYPE( wxEVT_TASKBAR_LEFT_DCLICK, 1555 ) | |
102 | DECLARE_EVENT_TYPE( wxEVT_TASKBAR_RIGHT_DCLICK, 1556 ) | |
103 | END_DECLARE_EVENT_TYPES() | |
104 | ||
105 | #define EVT_TASKBAR_MOVE(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_MOVE, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL), | |
106 | #define EVT_TASKBAR_LEFT_DOWN(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL), | |
107 | #define EVT_TASKBAR_LEFT_UP(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_LEFT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL), | |
108 | #define EVT_TASKBAR_RIGHT_DOWN(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_RIGHT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL), | |
109 | #define EVT_TASKBAR_RIGHT_UP(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_RIGHT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL), | |
110 | #define EVT_TASKBAR_LEFT_DCLICK(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL), | |
111 | #define EVT_TASKBAR_RIGHT_DCLICK(fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_TASKBAR_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) &fn, NULL), | |
112 | ||
113 | ||
114 | #endif | |
115 | // _TASKBAR_H_ | |
116 | ||
117 | ||
118 | ||
119 | ||
120 |