]> git.saurik.com Git - wxWidgets.git/blob - include/wx/taskbar.h
Use /bin/echo for creation of Mac OS X PkgInfo files.
[wxWidgets.git] / include / wx / taskbar.h
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
12 #ifndef _WX_TASKBAR_H_BASE_
13 #define _WX_TASKBAR_H_BASE_
14
15 #include "wx/defs.h"
16
17 #if wxUSE_TASKBARICON
18
19 #include "wx/event.h"
20
21 class WXDLLIMPEXP_FWD_ADV wxTaskBarIconEvent;
22
23 // ----------------------------------------------------------------------------
24 // wxTaskBarIconBase: define wxTaskBarIcon interface
25 // ----------------------------------------------------------------------------
26
27 class WXDLLIMPEXP_ADV wxTaskBarIconBase : public wxEvtHandler
28 {
29 public:
30 wxTaskBarIconBase() { }
31
32 #if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__)
33 static bool IsAvailable();
34 #else
35 static bool IsAvailable() { return true; }
36 #endif
37
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
44 // delayed destruction (similarly to wxWindow::Destroy())
45 void Destroy();
46
47 protected:
48 // creates menu to be displayed when user clicks on the icon
49 virtual wxMenu *CreatePopupMenu() { return NULL; }
50
51 private:
52 // default events handling, calls CreatePopupMenu:
53 void OnRightButtonDown(wxTaskBarIconEvent& event);
54
55 DECLARE_EVENT_TABLE()
56 wxDECLARE_NO_COPY_CLASS(wxTaskBarIconBase);
57 };
58
59
60 // ----------------------------------------------------------------------------
61 // now include the actual class declaration
62 // ----------------------------------------------------------------------------
63
64 #if defined(__WXMSW__)
65 #include "wx/msw/taskbar.h"
66 #elif defined(__WXGTK20__)
67 #include "wx/gtk/taskbar.h"
68 #elif defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__)
69 #include "wx/unix/taskbarx11.h"
70 #elif defined (__WXMAC__)
71 #include "wx/osx/taskbarosx.h"
72 #elif defined (__WXCOCOA__)
73 #include "wx/cocoa/taskbar.h"
74 #endif
75
76 // ----------------------------------------------------------------------------
77 // wxTaskBarIcon events
78 // ----------------------------------------------------------------------------
79
80 class WXDLLIMPEXP_ADV wxTaskBarIconEvent : public wxEvent
81 {
82 public:
83 wxTaskBarIconEvent(wxEventType evtType, wxTaskBarIcon *tbIcon)
84 : wxEvent(wxID_ANY, evtType)
85 {
86 SetEventObject(tbIcon);
87 }
88
89 virtual wxEvent *Clone() const { return new wxTaskBarIconEvent(*this); }
90
91 private:
92 wxDECLARE_NO_ASSIGN_CLASS(wxTaskBarIconEvent);
93 };
94
95 typedef void (wxEvtHandler::*wxTaskBarIconEventFunction)(wxTaskBarIconEvent&);
96
97 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_MOVE, wxTaskBarIconEvent );
98 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_LEFT_DOWN, wxTaskBarIconEvent );
99 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_LEFT_UP, wxTaskBarIconEvent );
100 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_RIGHT_DOWN, wxTaskBarIconEvent );
101 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_RIGHT_UP, wxTaskBarIconEvent );
102 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_LEFT_DCLICK, wxTaskBarIconEvent );
103 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_RIGHT_DCLICK, wxTaskBarIconEvent );
104 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_BALLOON_TIMEOUT, wxTaskBarIconEvent );
105 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_TASKBAR_BALLOON_CLICK, wxTaskBarIconEvent );
106
107 #define wxTaskBarIconEventHandler(func) \
108 wxEVENT_HANDLER_CAST(wxTaskBarIconEventFunction, func)
109
110 #define wx__DECLARE_TASKBAREVT(evt, fn) \
111 wx__DECLARE_EVT0(wxEVT_TASKBAR_ ## evt, wxTaskBarIconEventHandler(fn))
112
113 #define EVT_TASKBAR_MOVE(fn) wx__DECLARE_TASKBAREVT(MOVE, fn)
114 #define EVT_TASKBAR_LEFT_DOWN(fn) wx__DECLARE_TASKBAREVT(LEFT_DOWN, fn)
115 #define EVT_TASKBAR_LEFT_UP(fn) wx__DECLARE_TASKBAREVT(LEFT_UP, fn)
116 #define EVT_TASKBAR_RIGHT_DOWN(fn) wx__DECLARE_TASKBAREVT(RIGHT_DOWN, fn)
117 #define EVT_TASKBAR_RIGHT_UP(fn) wx__DECLARE_TASKBAREVT(RIGHT_UP, fn)
118 #define EVT_TASKBAR_LEFT_DCLICK(fn) wx__DECLARE_TASKBAREVT(LEFT_DCLICK, fn)
119 #define EVT_TASKBAR_RIGHT_DCLICK(fn) wx__DECLARE_TASKBAREVT(RIGHT_DCLICK, fn)
120
121 // taskbar menu is shown on right button press under all platforms except MSW
122 // where it's shown on right button release, using this event type and macro
123 // allows to write code which works correctly on all platforms
124 #ifdef __WXMSW__
125 #define wxEVT_TASKBAR_CLICK wxEVT_TASKBAR_RIGHT_UP
126 #else
127 #define wxEVT_TASKBAR_CLICK wxEVT_TASKBAR_RIGHT_DOWN
128 #endif
129 #define EVT_TASKBAR_CLICK(fn) wx__DECLARE_TASKBAREVT(CLICK, fn)
130
131 // these events are currently generated only under wxMSW and only after (MSW-
132 // specific) ShowBalloon() had been called, don't use them in portable code
133 #define EVT_TASKBAR_BALLOON_TIMEOUT(fn) \
134 wx__DECLARE_TASKBAREVT(BALLOON_TIMEOUT, fn)
135 #define EVT_TASKBAR_BALLOON_CLICK(fn) \
136 wx__DECLARE_TASKBAREVT(BALLOON_CLICK, fn)
137
138 #endif // wxUSE_TASKBARICON
139
140 #endif // _WX_TASKBAR_H_BASE_