]> git.saurik.com Git - wxWidgets.git/blame - include/wx/taskbar.h
Added fontfactory.h that should have been part of 49213.
[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
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
39f0cb54
VZ
38 // delayed destruction (similarly to wxWindow::Destroy())
39 void Destroy();
40
dae73d74
VS
41protected:
42 // creates menu to be displayed when user clicks on the icon
43 virtual wxMenu *CreatePopupMenu() { return NULL; }
cb719f2e 44
fc7a2a60 45private:
dae73d74 46 // default events handling, calls CreatePopupMenu:
6466d41e 47 void OnRightButtonDown(wxTaskBarIconEvent& event);
cb719f2e 48
dae73d74 49 DECLARE_EVENT_TABLE()
fc7a2a60 50 DECLARE_NO_COPY_CLASS(wxTaskBarIconBase)
6af507f7
VS
51};
52
53
54// ----------------------------------------------------------------------------
55// now include the actual class declaration
56// ----------------------------------------------------------------------------
57
4055ed82 58#if defined(__WXPALMOS__)
ffecfa5a
JS
59 #include "wx/palmos/taskbar.h"
60#elif defined(__WXMSW__)
6af507f7 61 #include "wx/msw/taskbar.h"
fb29dcac
VS
62#elif defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__)
63 #include "wx/unix/taskbarx11.h"
9543e985 64#elif defined (__WXMAC__) && defined(__WXMAC_OSX__)
32c479fd 65 #include "wx/mac/taskbarosx.h"
f1d9e1ec
DE
66#elif defined (__WXCOCOA__)
67 #include "wx/cocoa/taskbar.h"
34138703
JS
68#endif
69
6af507f7
VS
70// ----------------------------------------------------------------------------
71// wxTaskBarIcon events
72// ----------------------------------------------------------------------------
73
131f235d 74class WXDLLIMPEXP_ADV wxTaskBarIconEvent : public wxEvent
6af507f7
VS
75{
76public:
77 wxTaskBarIconEvent(wxEventType evtType, wxTaskBarIcon *tbIcon)
cb719f2e 78 : wxEvent(wxID_ANY, evtType)
6af507f7
VS
79 {
80 SetEventObject(tbIcon);
81 }
82
83 virtual wxEvent *Clone() const { return new wxTaskBarIconEvent(*this); }
fc7a2a60
VZ
84
85private:
a6cbc4db 86 DECLARE_NO_ASSIGN_CLASS(wxTaskBarIconEvent)
6af507f7
VS
87};
88
6466d41e
VS
89typedef void (wxEvtHandler::*wxTaskBarIconEventFunction)(wxTaskBarIconEvent&);
90
6af507f7 91BEGIN_DECLARE_EVENT_TYPES()
131f235d
VS
92 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_MOVE,1550)
93 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_LEFT_DOWN,1551)
94 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_LEFT_UP,1552)
95 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_RIGHT_DOWN,1553)
96 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_RIGHT_UP,1554)
97 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_LEFT_DCLICK,1555)
98 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_ADV,wxEVT_TASKBAR_RIGHT_DCLICK,1556)
6af507f7
VS
99END_DECLARE_EVENT_TYPES()
100
7fa03f04 101#define wxTaskBarIconEventHandler(func) \
8bc3ec1f 102 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxTaskBarIconEventFunction, &func)
7fa03f04
VZ
103
104#define wx__DECLARE_TASKBAREVT(evt, fn) \
105 wx__DECLARE_EVT0(wxEVT_TASKBAR_ ## evt, wxTaskBarIconEventHandler(fn))
106
107#define EVT_TASKBAR_MOVE(fn) wx__DECLARE_TASKBAREVT(MOVE, fn)
108#define EVT_TASKBAR_LEFT_DOWN(fn) wx__DECLARE_TASKBAREVT(LEFT_DOWN, fn)
109#define EVT_TASKBAR_LEFT_UP(fn) wx__DECLARE_TASKBAREVT(LEFT_UP, fn)
110#define EVT_TASKBAR_RIGHT_DOWN(fn) wx__DECLARE_TASKBAREVT(RIGHT_DOWN, fn)
111#define EVT_TASKBAR_RIGHT_UP(fn) wx__DECLARE_TASKBAREVT(RIGHT_UP, fn)
112#define EVT_TASKBAR_LEFT_DCLICK(fn) wx__DECLARE_TASKBAREVT(LEFT_DCLICK, fn)
113#define EVT_TASKBAR_RIGHT_DCLICK(fn) wx__DECLARE_TASKBAREVT(RIGHT_DCLICK, fn)
6af507f7 114
9fcf8144
VZ
115// taskbar menu is shown on right button press under all platforms except MSW
116// where it's shown on right button release, using this event type and macro
117// allows to write code which works correctly on all platforms
118#ifdef __WXMSW__
119 #define wxEVT_TASKBAR_CLICK wxEVT_TASKBAR_RIGHT_UP
120#else
121 #define wxEVT_TASKBAR_CLICK wxEVT_TASKBAR_RIGHT_DOWN
b400d50a 122#endif
9fcf8144 123#define EVT_TASKBAR_CLICK(fn) wx__DECLARE_TASKBAREVT(CLICK, fn)
3191ff3b 124
4f167b46 125#endif // wxUSE_TASKBARICON
9fcf8144
VZ
126
127#endif // _WX_TASKBAR_H_BASE_