automated ifacecheck fixed
[wxWidgets.git] / interface / wx / taskbar.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: taskbar.h
3 // Purpose: interface of wxTaskBarIcon
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxTaskBarIcon
11
12 This class represents a taskbar icon.
13 A taskbar icon is an icon that appears in the 'system tray' and responds to
14 mouse clicks, optionally with a tooltip above it to help provide information.
15
16 @section taskbaricon_xnote X Window System Note
17 Under X Window System, the window manager must support either the
18 "System Tray Protocol" (see http://freedesktop.org/wiki/Specifications/systemtray-spec)
19 by freedesktop.org (WMs used by modern desktop environments such as GNOME >= 2,
20 KDE >= 3 and XFCE >= 4 all do) or the older methods used in GNOME 1.2 and KDE 1 and 2.
21
22 If it doesn't, the icon will appear as a toplevel window on user's desktop.
23 Because not all window managers have system tray, there's no guarantee that
24 wxTaskBarIcon will work correctly under X Window System and so the applications
25 should use it only as an optional component of their user interface.
26 The user should be required to explicitly enable the taskbar icon on Unix,
27 it shouldn't be on by default.
28
29 @beginEventTable{wxTaskBarIconEvent}
30 Note that not all ports are required to send these events and so it's better
31 to override wxTaskBarIcon::CreatePopupMenu() if all that the application does
32 is that it shows a popup menu in reaction to mouse click.
33 @event{EVT_TASKBAR_MOVE(func)}
34 Process a wxEVT_TASKBAR_MOVE event.
35 @event{EVT_TASKBAR_LEFT_DOWN(func)}
36 Process a wxEVT_TASKBAR_LEFT_DOWN event.
37 @event{EVT_TASKBAR_LEFT_UP(func)}
38 Process a wxEVT_TASKBAR_LEFT_UP event.
39 @event{EVT_TASKBAR_RIGHT_DOWN(func)}
40 Process a wxEVT_TASKBAR_RIGHT_DOWN event.
41 @event{EVT_TASKBAR_RIGHT_UP(func)}
42 Process a wxEVT_TASKBAR_RIGHT_UP event.
43 @event{EVT_TASKBAR_LEFT_DCLICK(func)}
44 Process a wxEVT_TASKBAR_LEFT_DCLICK event.
45 @event{EVT_TASKBAR_RIGHT_DCLICK(func)}
46 Process a wxEVT_TASKBAR_RIGHT_DCLICK event.
47 @event{EVT_TASKBAR_CLICK(func)}
48 This is a synonym for either EVT_TASKBAR_RIGHT_DOWN or UP depending on
49 the platform, use this event macro to catch the event which should result
50 in the menu being displayed on the current platform.
51 @endEventTable
52
53 @library{wxadv}
54 @category{misc}
55 */
56 class wxTaskBarIcon : public wxEvtHandler
57 {
58 public:
59 /**
60 Default constructor.
61 */
62 wxTaskBarIcon();
63
64 /**
65 Destroys the wxTaskBarIcon object, removing the icon if not already removed.
66 */
67 virtual ~wxTaskBarIcon();
68
69 /**
70 This method is called by the library when the user requests popup menu
71 (on Windows and Unix platforms, this is when the user right-clicks the icon).
72
73 Override this function in order to provide popup menu associated with the icon.
74 If CreatePopupMenu() returns @NULL (this happens by default), no menu is shown,
75 otherwise the menu is displayed and then deleted by the library as soon as the
76 user dismisses it.
77
78 The events can be handled by a class derived from wxTaskBarIcon.
79 */
80 virtual wxMenu* CreatePopupMenu();
81
82 /**
83 This method is similar to wxWindow::Destroy and can be used to schedule
84 the task bar icon object for the delayed destruction: it will be deleted
85 during the next event loop iteration, which allows the task bar
86 icon to process any pending events for it before being destroyed.
87 */
88 void Destroy();
89
90 /**
91 Returns @true if SetIcon() was called with no subsequent RemoveIcon().
92 */
93 bool IsIconInstalled() const;
94
95 /**
96 Returns @true if the object initialized successfully.
97 */
98 bool IsOk() const;
99
100 /**
101 Pops up a menu at the current mouse position.
102 The events can be handled by a class derived from wxTaskBarIcon.
103
104 @note
105 It is recommended to override CreatePopupMenu() callback instead of
106 calling this method from event handler, because some ports (e.g. wxCocoa)
107 may not implement PopupMenu() and mouse click events at all.
108 */
109 virtual bool PopupMenu(wxMenu* menu);
110
111 /**
112 Removes the icon previously set with SetIcon().
113 */
114 virtual bool RemoveIcon();
115
116 /**
117 Sets the icon, and optional tooltip text.
118 */
119 virtual bool SetIcon(const wxIcon& icon,
120 const wxString& tooltip = wxEmptyString);
121
122 /**
123 Returns true if system tray is available in the desktop environment the
124 app runs under.
125
126 On Windows and Mac OS X, the tray is always available and this function
127 simply returns true.
128
129 On Unix, X11 environment may or may not provide the tray, depending on
130 user's desktop environment. Most modern desktops support the tray via
131 the System Tray Protocol by freedesktop.org
132 (http://freedesktop.org/wiki/Specifications/systemtray-spec).
133
134 @note Tray availability may change during application's lifetime
135 under X11 and so applications shouldn't cache the result.
136
137 @note wxTaskBarIcon supports older GNOME 1.2 and KDE 1/2 methods of
138 adding icons to tray, but they are unreliable and this method
139 doesn't detect them.
140
141 @since 2.9.0
142 */
143 static bool IsAvailable();
144 };
145