]> git.saurik.com Git - wxWidgets.git/blame - include/wx/taskbar.h
support SDK < 10.6, fixes #14902
[wxWidgets.git] / include / wx / taskbar.h
CommitLineData
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
4f167b46 17#if wxUSE_TASKBARICON
3191ff3b 18
6af507f7
VS
19#include "wx/event.h"
20
b5dbe15d 21class WXDLLIMPEXP_FWD_ADV wxTaskBarIconEvent;
dae73d74 22
70175534
RD
23// ----------------------------------------------------------------------------
24
25// type of taskbar item to create. Only applicable in wxOSX_COCOA
26enum wxTaskBarIconType
27{
28 wxTBI_DOCK,
29 wxTBI_CUSTOM_STATUSITEM,
1104248b 30#if defined(wxOSX_USE_COCOA) && wxOSX_USE_COCOA
70175534
RD
31 wxTBI_DEFAULT_TYPE = wxTBI_CUSTOM_STATUSITEM
32#else
33 wxTBI_DEFAULT_TYPE = wxTBI_DOCK
34#endif
35};
36
37
6af507f7
VS
38// ----------------------------------------------------------------------------
39// wxTaskBarIconBase: define wxTaskBarIcon interface
40// ----------------------------------------------------------------------------
41
131f235d 42class WXDLLIMPEXP_ADV wxTaskBarIconBase : public wxEvtHandler
6af507f7 43{
fc7a2a60
VZ
44public:
45 wxTaskBarIconBase() { }
cb719f2e 46
cf78bdcb
VS
47#if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__)
48 static bool IsAvailable();
49#else
6dd0883d 50 static bool IsAvailable() { return true; }
cf78bdcb
VS
51#endif
52
dae73d74
VS
53 // Operations:
54 virtual bool SetIcon(const wxIcon& icon,
55 const wxString& tooltip = wxEmptyString) = 0;
56 virtual bool RemoveIcon() = 0;
57 virtual bool PopupMenu(wxMenu *menu) = 0;
58
39f0cb54
VZ
59 // delayed destruction (similarly to wxWindow::Destroy())
60 void Destroy();
61
dae73d74
VS
62protected:
63 // creates menu to be displayed when user clicks on the icon
64 virtual wxMenu *CreatePopupMenu() { return NULL; }
cb719f2e 65
fc7a2a60 66private:
dae73d74 67 // default events handling, calls CreatePopupMenu:
6466d41e 68 void OnRightButtonDown(wxTaskBarIconEvent& event);
cb719f2e 69
dae73d74 70 DECLARE_EVENT_TABLE()
c0c133e1 71 wxDECLARE_NO_COPY_CLASS(wxTaskBarIconBase);
6af507f7
VS
72};
73
74
75// ----------------------------------------------------------------------------
76// now include the actual class declaration
77// ----------------------------------------------------------------------------
78
bd362275 79#if defined(__WXMSW__)
6af507f7 80 #include "wx/msw/taskbar.h"
7669dce5 81#elif defined(__WXGTK20__)
a1c6f069 82 #include "wx/gtk/taskbar.h"
fb29dcac
VS
83#elif defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__)
84 #include "wx/unix/taskbarx11.h"
c058cafa 85#elif defined (__WXMAC__)
ef0e9220 86 #include "wx/osx/taskbarosx.h"
f1d9e1ec
DE
87#elif defined (__WXCOCOA__)
88 #include "wx/cocoa/taskbar.h"
34138703
JS
89#endif
90
6af507f7
VS
91// ----------------------------------------------------------------------------
92// wxTaskBarIcon events
93// ----------------------------------------------------------------------------
94
131f235d 95class WXDLLIMPEXP_ADV wxTaskBarIconEvent : public wxEvent
6af507f7
VS
96{
97public:
98 wxTaskBarIconEvent(wxEventType evtType, wxTaskBarIcon *tbIcon)
cb719f2e 99 : wxEvent(wxID_ANY, evtType)
6af507f7
VS
100 {
101 SetEventObject(tbIcon);
102 }
103
104 virtual wxEvent *Clone() const { return new wxTaskBarIconEvent(*this); }
fc7a2a60
VZ
105
106private:
c0c133e1 107 wxDECLARE_NO_ASSIGN_CLASS(wxTaskBarIconEvent);
6af507f7
VS
108};
109
6466d41e
VS
110typedef void (wxEvtHandler::*wxTaskBarIconEventFunction)(wxTaskBarIconEvent&);
111
9b11752c
VZ
112wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_MOVE, wxTaskBarIconEvent );
113wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_LEFT_DOWN, wxTaskBarIconEvent );
114wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_LEFT_UP, wxTaskBarIconEvent );
115wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_RIGHT_DOWN, wxTaskBarIconEvent );
116wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_RIGHT_UP, wxTaskBarIconEvent );
117wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_LEFT_DCLICK, wxTaskBarIconEvent );
118wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_RIGHT_DCLICK, wxTaskBarIconEvent );
119wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_BALLOON_TIMEOUT, wxTaskBarIconEvent );
120wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_BALLOON_CLICK, wxTaskBarIconEvent );
6af507f7 121
7fa03f04 122#define wxTaskBarIconEventHandler(func) \
3c778901 123 wxEVENT_HANDLER_CAST(wxTaskBarIconEventFunction, func)
7fa03f04
VZ
124
125#define wx__DECLARE_TASKBAREVT(evt, fn) \
126 wx__DECLARE_EVT0(wxEVT_TASKBAR_ ## evt, wxTaskBarIconEventHandler(fn))
127
128#define EVT_TASKBAR_MOVE(fn) wx__DECLARE_TASKBAREVT(MOVE, fn)
129#define EVT_TASKBAR_LEFT_DOWN(fn) wx__DECLARE_TASKBAREVT(LEFT_DOWN, fn)
130#define EVT_TASKBAR_LEFT_UP(fn) wx__DECLARE_TASKBAREVT(LEFT_UP, fn)
131#define EVT_TASKBAR_RIGHT_DOWN(fn) wx__DECLARE_TASKBAREVT(RIGHT_DOWN, fn)
132#define EVT_TASKBAR_RIGHT_UP(fn) wx__DECLARE_TASKBAREVT(RIGHT_UP, fn)
133#define EVT_TASKBAR_LEFT_DCLICK(fn) wx__DECLARE_TASKBAREVT(LEFT_DCLICK, fn)
134#define EVT_TASKBAR_RIGHT_DCLICK(fn) wx__DECLARE_TASKBAREVT(RIGHT_DCLICK, fn)
6af507f7 135
9fcf8144
VZ
136// taskbar menu is shown on right button press under all platforms except MSW
137// where it's shown on right button release, using this event type and macro
138// allows to write code which works correctly on all platforms
139#ifdef __WXMSW__
140 #define wxEVT_TASKBAR_CLICK wxEVT_TASKBAR_RIGHT_UP
141#else
142 #define wxEVT_TASKBAR_CLICK wxEVT_TASKBAR_RIGHT_DOWN
b400d50a 143#endif
9fcf8144 144#define EVT_TASKBAR_CLICK(fn) wx__DECLARE_TASKBAREVT(CLICK, fn)
3191ff3b 145
d3f12098
VZ
146// these events are currently generated only under wxMSW and only after (MSW-
147// specific) ShowBalloon() had been called, don't use them in portable code
148#define EVT_TASKBAR_BALLOON_TIMEOUT(fn) \
149 wx__DECLARE_TASKBAREVT(BALLOON_TIMEOUT, fn)
150#define EVT_TASKBAR_BALLOON_CLICK(fn) \
151 wx__DECLARE_TASKBAREVT(BALLOON_CLICK, fn)
152
4f167b46 153#endif // wxUSE_TASKBARICON
9fcf8144
VZ
154
155#endif // _WX_TASKBAR_H_BASE_