]>
Commit | Line | Data |
---|---|---|
99d80019 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/taskbar.h | |
3 | // Purpose: wxTaskBarIcon base header and class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: | |
7 | // Copyright: (c) Julian Smart | |
8 | // RCS-ID: $Id$ | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
34138703 JS |
12 | #ifndef _WX_TASKBAR_H_BASE_ |
13 | #define _WX_TASKBAR_H_BASE_ | |
14 | ||
3191ff3b VS |
15 | #include "wx/defs.h" |
16 | ||
17 | #ifdef wxHAS_TASK_BAR_ICON | |
18 | ||
6af507f7 VS |
19 | #include "wx/event.h" |
20 | ||
dae73d74 VS |
21 | class WXDLLIMPEXP_ADV wxTaskBarIconEvent; |
22 | ||
6af507f7 VS |
23 | // ---------------------------------------------------------------------------- |
24 | // wxTaskBarIconBase: define wxTaskBarIcon interface | |
25 | // ---------------------------------------------------------------------------- | |
26 | ||
131f235d | 27 | class WXDLLIMPEXP_ADV wxTaskBarIconBase : public wxEvtHandler |
6af507f7 | 28 | { |
fc7a2a60 VZ |
29 | public: |
30 | wxTaskBarIconBase() { } | |
cb719f2e | 31 | |
dae73d74 VS |
32 | // Operations: |
33 | virtual bool SetIcon(const wxIcon& icon, | |
34 | const wxString& tooltip = wxEmptyString) = 0; | |
35 | virtual bool RemoveIcon() = 0; | |
36 | virtual bool PopupMenu(wxMenu *menu) = 0; | |
37 | ||
38 | protected: | |
39 | // creates menu to be displayed when user clicks on the icon | |
40 | virtual wxMenu *CreatePopupMenu() { return NULL; } | |
cb719f2e | 41 | |
fc7a2a60 | 42 | private: |
dae73d74 | 43 | // default events handling, calls CreatePopupMenu: |
6466d41e | 44 | void OnRightButtonDown(wxTaskBarIconEvent& event); |
cb719f2e | 45 | |
dae73d74 | 46 | DECLARE_EVENT_TABLE() |
fc7a2a60 | 47 | DECLARE_NO_COPY_CLASS(wxTaskBarIconBase) |
6af507f7 VS |
48 | }; |
49 | ||
50 | ||
51 | // ---------------------------------------------------------------------------- | |
52 | // now include the actual class declaration | |
53 | // ---------------------------------------------------------------------------- | |
54 | ||
4055ed82 | 55 | #if defined(__WXPALMOS__) |
ffecfa5a JS |
56 | #include "wx/palmos/taskbar.h" |
57 | #elif defined(__WXMSW__) | |
6af507f7 | 58 | #include "wx/msw/taskbar.h" |
fb29dcac VS |
59 | #elif defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) |
60 | #include "wx/unix/taskbarx11.h" | |
9543e985 | 61 | #elif defined (__WXMAC__) && defined(__WXMAC_OSX__) |
32c479fd | 62 | #include "wx/mac/taskbarosx.h" |
f1d9e1ec DE |
63 | #elif defined (__WXCOCOA__) |
64 | #include "wx/cocoa/taskbar.h" | |
34138703 JS |
65 | #endif |
66 | ||
6af507f7 VS |
67 | // ---------------------------------------------------------------------------- |
68 | // wxTaskBarIcon events | |
69 | // ---------------------------------------------------------------------------- | |
70 | ||
131f235d | 71 | class WXDLLIMPEXP_ADV wxTaskBarIconEvent : public wxEvent |
6af507f7 VS |
72 | { |
73 | public: | |
74 | wxTaskBarIconEvent(wxEventType evtType, wxTaskBarIcon *tbIcon) | |
cb719f2e | 75 | : wxEvent(wxID_ANY, evtType) |
6af507f7 VS |
76 | { |
77 | SetEventObject(tbIcon); | |
78 | } | |
79 | ||
80 | virtual wxEvent *Clone() const { return new wxTaskBarIconEvent(*this); } | |
fc7a2a60 VZ |
81 | |
82 | private: | |
a6cbc4db | 83 | DECLARE_NO_ASSIGN_CLASS(wxTaskBarIconEvent) |
6af507f7 VS |
84 | }; |
85 | ||
6466d41e VS |
86 | typedef void (wxEvtHandler::*wxTaskBarIconEventFunction)(wxTaskBarIconEvent&); |
87 | ||
6af507f7 | 88 | BEGIN_DECLARE_EVENT_TYPES() |
131f235d VS |
89 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_MOVE,1550) |
90 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_LEFT_DOWN,1551) | |
91 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_LEFT_UP,1552) | |
92 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_RIGHT_DOWN,1553) | |
93 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_RIGHT_UP,1554) | |
94 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_LEFT_DCLICK,1555) | |
95 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_RIGHT_DCLICK,1556) | |
6af507f7 VS |
96 | END_DECLARE_EVENT_TYPES() |
97 | ||
7fa03f04 | 98 | #define wxTaskBarIconEventHandler(func) \ |
8bc3ec1f | 99 | (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxTaskBarIconEventFunction, &func) |
7fa03f04 VZ |
100 | |
101 | #define wx__DECLARE_TASKBAREVT(evt, fn) \ | |
102 | wx__DECLARE_EVT0(wxEVT_TASKBAR_ ## evt, wxTaskBarIconEventHandler(fn)) | |
103 | ||
104 | #define EVT_TASKBAR_MOVE(fn) wx__DECLARE_TASKBAREVT(MOVE, fn) | |
105 | #define EVT_TASKBAR_LEFT_DOWN(fn) wx__DECLARE_TASKBAREVT(LEFT_DOWN, fn) | |
106 | #define EVT_TASKBAR_LEFT_UP(fn) wx__DECLARE_TASKBAREVT(LEFT_UP, fn) | |
107 | #define EVT_TASKBAR_RIGHT_DOWN(fn) wx__DECLARE_TASKBAREVT(RIGHT_DOWN, fn) | |
108 | #define EVT_TASKBAR_RIGHT_UP(fn) wx__DECLARE_TASKBAREVT(RIGHT_UP, fn) | |
109 | #define EVT_TASKBAR_LEFT_DCLICK(fn) wx__DECLARE_TASKBAREVT(LEFT_DCLICK, fn) | |
110 | #define EVT_TASKBAR_RIGHT_DCLICK(fn) wx__DECLARE_TASKBAREVT(RIGHT_DCLICK, fn) | |
6af507f7 | 111 | |
b400d50a | 112 | #endif |
3191ff3b VS |
113 | // wxHAS_TASK_BAR_ICON |
114 | ||
34138703 JS |
115 | #endif |
116 | // _WX_TASKBAR_H_BASE_ |