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