]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/taskbar.h
Make AsyncExecLoopExitEnum enum in the wxExecute() test public.
[wxWidgets.git] / interface / wx / taskbar.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: taskbar.h
e54c96f1 3// Purpose: interface of wxTaskBarIcon
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
526954c5 6// Licence: wxWindows licence
23324ae1
FM
7/////////////////////////////////////////////////////////////////////////////
8
70175534
RD
9/**
10 On OSX Cocoa the taskbar icon can be in the doc or in the status area.
11 This enumeration can be used to select which will be instantiated.
12*/
13enum wxTaskBarIconType
14{
15 wxTBI_DOCK,
16 wxTBI_CUSTOM_STATUSITEM,
17 wxTBI_DEFAULT_TYPE
18};
19
20
76ef2d39
FM
21
22/**
23 @class wxTaskBarIconEvent
24
25 The event class used by wxTaskBarIcon.
26 For a list of the event macros meant to be used with wxTaskBarIconEvent,
27 please look at wxTaskBarIcon description.
28
29 @library{wxadv}
30 @category{events}
31*/
32class wxTaskBarIconEvent : public wxEvent
33{
34public:
35 /**
36 Constructor.
37 */
38 wxTaskBarIconEvent(wxEventType evtType, wxTaskBarIcon *tbIcon);
39};
40
70175534 41
23324ae1
FM
42/**
43 @class wxTaskBarIcon
7c913512 44
c6cf894a
FM
45 This class represents a taskbar icon.
46 A taskbar icon is an icon that appears in the 'system tray' and responds to
47 mouse clicks, optionally with a tooltip above it to help provide information.
48
76ef2d39 49
c6cf894a 50 @section taskbaricon_xnote X Window System Note
76ef2d39 51
c6cf894a 52 Under X Window System, the window manager must support either the
4876436a 53 "System Tray Protocol" (see http://freedesktop.org/wiki/Specifications/systemtray-spec)
c6cf894a
FM
54 by freedesktop.org (WMs used by modern desktop environments such as GNOME >= 2,
55 KDE >= 3 and XFCE >= 4 all do) or the older methods used in GNOME 1.2 and KDE 1 and 2.
56
57 If it doesn't, the icon will appear as a toplevel window on user's desktop.
58 Because not all window managers have system tray, there's no guarantee that
59 wxTaskBarIcon will work correctly under X Window System and so the applications
60 should use it only as an optional component of their user interface.
61 The user should be required to explicitly enable the taskbar icon on Unix,
62 it shouldn't be on by default.
63
3051a44a 64 @beginEventEmissionTable{wxTaskBarIconEvent}
c6cf894a
FM
65 Note that not all ports are required to send these events and so it's better
66 to override wxTaskBarIcon::CreatePopupMenu() if all that the application does
67 is that it shows a popup menu in reaction to mouse click.
68 @event{EVT_TASKBAR_MOVE(func)}
3a194bda 69 Process a @c wxEVT_TASKBAR_MOVE event.
c6cf894a 70 @event{EVT_TASKBAR_LEFT_DOWN(func)}
3a194bda 71 Process a @c wxEVT_TASKBAR_LEFT_DOWN event.
c6cf894a 72 @event{EVT_TASKBAR_LEFT_UP(func)}
3a194bda 73 Process a @c wxEVT_TASKBAR_LEFT_UP event.
c6cf894a 74 @event{EVT_TASKBAR_RIGHT_DOWN(func)}
3a194bda 75 Process a @c wxEVT_TASKBAR_RIGHT_DOWN event.
c6cf894a 76 @event{EVT_TASKBAR_RIGHT_UP(func)}
3a194bda 77 Process a @c wxEVT_TASKBAR_RIGHT_UP event.
c6cf894a 78 @event{EVT_TASKBAR_LEFT_DCLICK(func)}
3a194bda 79 Process a @c wxEVT_TASKBAR_LEFT_DCLICK event.
c6cf894a 80 @event{EVT_TASKBAR_RIGHT_DCLICK(func)}
3a194bda 81 Process a @c wxEVT_TASKBAR_RIGHT_DCLICK event.
c6cf894a
FM
82 @event{EVT_TASKBAR_CLICK(func)}
83 This is a synonym for either EVT_TASKBAR_RIGHT_DOWN or UP depending on
84 the platform, use this event macro to catch the event which should result
85 in the menu being displayed on the current platform.
86 @endEventTable
7c913512 87
23324ae1 88 @library{wxadv}
c6cf894a 89 @category{misc}
23324ae1
FM
90*/
91class wxTaskBarIcon : public wxEvtHandler
92{
93public:
94 /**
70175534 95 Default constructor. The iconType is only applicable on wxOSX_Cocoa.
23324ae1 96 */
70175534 97 wxTaskBarIcon(wxTaskBarIconType iconType = wxTBI_DEFAULT_TYPE);
23324ae1
FM
98
99 /**
100 Destroys the wxTaskBarIcon object, removing the icon if not already removed.
101 */
adaaa686 102 virtual ~wxTaskBarIcon();
23324ae1 103
23324ae1 104 /**
c6cf894a
FM
105 This method is similar to wxWindow::Destroy and can be used to schedule
106 the task bar icon object for the delayed destruction: it will be deleted
107 during the next event loop iteration, which allows the task bar
23324ae1
FM
108 icon to process any pending events for it before being destroyed.
109 */
110 void Destroy();
111
112 /**
113 Returns @true if SetIcon() was called with no subsequent RemoveIcon().
114 */
adaaa686 115 bool IsIconInstalled() const;
23324ae1
FM
116
117 /**
118 Returns @true if the object initialized successfully.
119 */
adaaa686 120 bool IsOk() const;
23324ae1
FM
121
122 /**
c6cf894a
FM
123 Pops up a menu at the current mouse position.
124 The events can be handled by a class derived from wxTaskBarIcon.
125
126 @note
127 It is recommended to override CreatePopupMenu() callback instead of
128 calling this method from event handler, because some ports (e.g. wxCocoa)
129 may not implement PopupMenu() and mouse click events at all.
23324ae1 130 */
adaaa686 131 virtual bool PopupMenu(wxMenu* menu);
23324ae1
FM
132
133 /**
134 Removes the icon previously set with SetIcon().
135 */
adaaa686 136 virtual bool RemoveIcon();
23324ae1
FM
137
138 /**
139 Sets the icon, and optional tooltip text.
140 */
43c48e1e
FM
141 virtual bool SetIcon(const wxIcon& icon,
142 const wxString& tooltip = wxEmptyString);
cf78bdcb
VS
143
144 /**
145 Returns true if system tray is available in the desktop environment the
146 app runs under.
147
148 On Windows and Mac OS X, the tray is always available and this function
149 simply returns true.
150
151 On Unix, X11 environment may or may not provide the tray, depending on
152 user's desktop environment. Most modern desktops support the tray via
153 the System Tray Protocol by freedesktop.org
154 (http://freedesktop.org/wiki/Specifications/systemtray-spec).
155
156 @note Tray availability may change during application's lifetime
157 under X11 and so applications shouldn't cache the result.
158
159 @note wxTaskBarIcon supports older GNOME 1.2 and KDE 1/2 methods of
160 adding icons to tray, but they are unreliable and this method
161 doesn't detect them.
162
163 @since 2.9.0
164 */
165 static bool IsAvailable();
5e6e278d
FM
166
167protected:
168
169 /**
170 This method is called by the library when the user requests popup menu
171 (on Windows and Unix platforms, this is when the user right-clicks the icon).
172
173 Override this function in order to provide popup menu associated with the icon.
174 If CreatePopupMenu() returns @NULL (this happens by default), no menu is shown,
175 otherwise the menu is displayed and then deleted by the library as soon as the
176 user dismisses it.
177
178 The events can be handled by a class derived from wxTaskBarIcon.
179 */
180 virtual wxMenu* CreatePopupMenu();
23324ae1 181};
e54c96f1 182
bb6eb694
RD
183
184wxEventType wxEVT_TASKBAR_MOVE;
185wxEventType wxEVT_TASKBAR_LEFT_DOWN;
186wxEventType wxEVT_TASKBAR_LEFT_UP;
187wxEventType wxEVT_TASKBAR_RIGHT_DOWN;
188wxEventType wxEVT_TASKBAR_RIGHT_UP;
189wxEventType wxEVT_TASKBAR_LEFT_DCLICK;
190wxEventType wxEVT_TASKBAR_RIGHT_DCLICK;
191wxEventType wxEVT_TASKBAR_CLICK;
192wxEventType wxEVT_TASKBAR_BALLOON_TIMEOUT;
193wxEventType wxEVT_TASKBAR_BALLOON_CLICK;