]>
Commit | Line | Data |
---|---|---|
2bda0e17 | 1 | ///////////////////////////////////////////////////////////////////////// |
fa1c12bd VZ |
2 | // File: wx/msw/taskbar.h |
3 | // Purpose: Defines wxTaskBarIcon class for manipulating icons on the | |
2bda0e17 KB |
4 | // Windows task bar. |
5 | // Author: Julian Smart | |
6 | // Modified by: | |
7 | // Created: 24/3/98 | |
8 | // RCS-ID: $Id$ | |
fa1c12bd VZ |
9 | // Copyright: (c) Julian Smart |
10 | // Licence: wxWindows licence | |
2bda0e17 KB |
11 | ///////////////////////////////////////////////////////////////////////// |
12 | ||
13 | #ifndef _TASKBAR_H_ | |
14 | #define _TASKBAR_H_ | |
15 | ||
16 | #ifdef __GNUG__ | |
17 | #pragma interface "taskbar.h" | |
18 | #endif | |
19 | ||
d162a7ee VZ |
20 | #include "wx/event.h" |
21 | #include "wx/list.h" | |
22 | #include "wx/icon.h" | |
23 | ||
24 | class wxTaskBarIcon; | |
25 | ||
cca78463 | 26 | WX_DECLARE_EXPORTED_LIST(wxTaskBarIcon, wxTaskBarIconList); |
2bda0e17 | 27 | |
937cf827 | 28 | class WXDLLEXPORT wxTaskBarIcon: public wxEvtHandler { |
56194595 | 29 | DECLARE_DYNAMIC_CLASS(wxTaskBarIcon) |
2bda0e17 | 30 | public: |
56194595 RD |
31 | wxTaskBarIcon(void); |
32 | virtual ~wxTaskBarIcon(void); | |
2bda0e17 KB |
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 | |
2b5f62a0 | 40 | bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxEmptyString); |
2bda0e17 | 41 | bool RemoveIcon(void); |
69ecd30f | 42 | bool PopupMenu(wxMenu *menu); //, int x, int y); |
2bda0e17 KB |
43 | |
44 | // Overridables | |
56194595 RD |
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&); | |
2bda0e17 KB |
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; | |
d162a7ee | 65 | static wxTaskBarIconList sm_taskBarIcons; |
2bda0e17 KB |
66 | static bool sm_registeredClass; |
67 | static unsigned int sm_taskbarMsg; | |
56194595 | 68 | |
69ecd30f RD |
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 | ||
6164d85e | 79 | DECLARE_EVENT_TABLE() |
2bda0e17 KB |
80 | }; |
81 | ||
56194595 | 82 | |
fa1c12bd VZ |
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 | }; | |
56194595 | 98 | |
459e74ba MB |
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() | |
56194595 | 108 | |
2e4df4bf VZ |
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), | |
56194595 | 116 | |
69ecd30f | 117 | |
2bda0e17 KB |
118 | #endif |
119 | // _TASKBAR_H_ | |
120 | ||
56194595 RD |
121 | |
122 | ||
123 | ||
124 |