added wxTaskBarIcon::IsAvailable
[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. A taskbar icon is an icon that appears in
13 the 'system tray' and responds to mouse clicks, optionally with a tooltip above it to help provide information.
14
15 @library{wxadv}
16 @category{FIXME}
17 */
18 class wxTaskBarIcon : public wxEvtHandler
19 {
20 public:
21 /**
22 Default constructor.
23 */
24 wxTaskBarIcon();
25
26 /**
27 Destroys the wxTaskBarIcon object, removing the icon if not already removed.
28 */
29 virtual ~wxTaskBarIcon();
30
31 /**
32 This method is called by the library when the user requests popup menu
33 (on Windows and Unix platforms, this is when the user right-clicks the icon).
34 Override this function in order to provide popup menu associated with the icon.
35 If CreatePopupMenu returns @NULL (this happens by default),
36 no menu is shown, otherwise the menu is
37 displayed and then deleted by the library as soon as the user dismisses it.
38 The events can be handled by a class derived from wxTaskBarIcon.
39 */
40 virtual wxMenu* CreatePopupMenu();
41
42 /**
43 This method is similar to wxWindow::Destroy and can
44 be used to schedule the task bar icon object for the delayed destruction: it
45 will be deleted during the next event loop iteration, which allows the task bar
46 icon to process any pending events for it before being destroyed.
47 */
48 void Destroy();
49
50 /**
51 Returns @true if SetIcon() was called with no subsequent RemoveIcon().
52 */
53 bool IsIconInstalled() const;
54
55 /**
56 Returns @true if the object initialized successfully.
57 */
58 bool IsOk() const;
59
60 /**
61 Pops up a menu at the current mouse position. The events can be handled by
62 a class derived from wxTaskBarIcon.
63 */
64 virtual bool PopupMenu(wxMenu* menu);
65
66 /**
67 Removes the icon previously set with SetIcon().
68 */
69 virtual bool RemoveIcon();
70
71 /**
72 Sets the icon, and optional tooltip text.
73 */
74 bool SetIcon(const wxIcon& icon, const wxString& tooltip);
75
76 /**
77 Returns true if system tray is available in the desktop environment the
78 app runs under.
79
80 On Windows and Mac OS X, the tray is always available and this function
81 simply returns true.
82
83 On Unix, X11 environment may or may not provide the tray, depending on
84 user's desktop environment. Most modern desktops support the tray via
85 the System Tray Protocol by freedesktop.org
86 (http://freedesktop.org/wiki/Specifications/systemtray-spec).
87
88 @note Tray availability may change during application's lifetime
89 under X11 and so applications shouldn't cache the result.
90
91 @note wxTaskBarIcon supports older GNOME 1.2 and KDE 1/2 methods of
92 adding icons to tray, but they are unreliable and this method
93 doesn't detect them.
94
95 @since 2.9.0
96 */
97 static bool IsAvailable();
98 };
99