]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/taskbar.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxTaskBarIcon
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
11 @class wxTaskBarIconEvent
13 The event class used by wxTaskBarIcon.
14 For a list of the event macros meant to be used with wxTaskBarIconEvent,
15 please look at wxTaskBarIcon description.
20 class wxTaskBarIconEvent
: public wxEvent
26 wxTaskBarIconEvent(wxEventType evtType
, wxTaskBarIcon
*tbIcon
);
32 This class represents a taskbar icon.
33 A taskbar icon is an icon that appears in the 'system tray' and responds to
34 mouse clicks, optionally with a tooltip above it to help provide information.
37 @section taskbaricon_xnote X Window System Note
39 Under X Window System, the window manager must support either the
40 "System Tray Protocol" (see http://freedesktop.org/wiki/Specifications/systemtray-spec)
41 by freedesktop.org (WMs used by modern desktop environments such as GNOME >= 2,
42 KDE >= 3 and XFCE >= 4 all do) or the older methods used in GNOME 1.2 and KDE 1 and 2.
44 If it doesn't, the icon will appear as a toplevel window on user's desktop.
45 Because not all window managers have system tray, there's no guarantee that
46 wxTaskBarIcon will work correctly under X Window System and so the applications
47 should use it only as an optional component of their user interface.
48 The user should be required to explicitly enable the taskbar icon on Unix,
49 it shouldn't be on by default.
51 @beginEventTable{wxTaskBarIconEvent}
52 Note that not all ports are required to send these events and so it's better
53 to override wxTaskBarIcon::CreatePopupMenu() if all that the application does
54 is that it shows a popup menu in reaction to mouse click.
55 @event{EVT_TASKBAR_MOVE(func)}
56 Process a wxEVT_TASKBAR_MOVE event.
57 @event{EVT_TASKBAR_LEFT_DOWN(func)}
58 Process a wxEVT_TASKBAR_LEFT_DOWN event.
59 @event{EVT_TASKBAR_LEFT_UP(func)}
60 Process a wxEVT_TASKBAR_LEFT_UP event.
61 @event{EVT_TASKBAR_RIGHT_DOWN(func)}
62 Process a wxEVT_TASKBAR_RIGHT_DOWN event.
63 @event{EVT_TASKBAR_RIGHT_UP(func)}
64 Process a wxEVT_TASKBAR_RIGHT_UP event.
65 @event{EVT_TASKBAR_LEFT_DCLICK(func)}
66 Process a wxEVT_TASKBAR_LEFT_DCLICK event.
67 @event{EVT_TASKBAR_RIGHT_DCLICK(func)}
68 Process a wxEVT_TASKBAR_RIGHT_DCLICK event.
69 @event{EVT_TASKBAR_CLICK(func)}
70 This is a synonym for either EVT_TASKBAR_RIGHT_DOWN or UP depending on
71 the platform, use this event macro to catch the event which should result
72 in the menu being displayed on the current platform.
78 class wxTaskBarIcon
: public wxEvtHandler
87 Destroys the wxTaskBarIcon object, removing the icon if not already removed.
89 virtual ~wxTaskBarIcon();
92 This method is similar to wxWindow::Destroy and can be used to schedule
93 the task bar icon object for the delayed destruction: it will be deleted
94 during the next event loop iteration, which allows the task bar
95 icon to process any pending events for it before being destroyed.
100 Returns @true if SetIcon() was called with no subsequent RemoveIcon().
102 bool IsIconInstalled() const;
105 Returns @true if the object initialized successfully.
110 Pops up a menu at the current mouse position.
111 The events can be handled by a class derived from wxTaskBarIcon.
114 It is recommended to override CreatePopupMenu() callback instead of
115 calling this method from event handler, because some ports (e.g. wxCocoa)
116 may not implement PopupMenu() and mouse click events at all.
118 virtual bool PopupMenu(wxMenu
* menu
);
121 Removes the icon previously set with SetIcon().
123 virtual bool RemoveIcon();
126 Sets the icon, and optional tooltip text.
128 virtual bool SetIcon(const wxIcon
& icon
,
129 const wxString
& tooltip
= wxEmptyString
);
132 Returns true if system tray is available in the desktop environment the
135 On Windows and Mac OS X, the tray is always available and this function
138 On Unix, X11 environment may or may not provide the tray, depending on
139 user's desktop environment. Most modern desktops support the tray via
140 the System Tray Protocol by freedesktop.org
141 (http://freedesktop.org/wiki/Specifications/systemtray-spec).
143 @note Tray availability may change during application's lifetime
144 under X11 and so applications shouldn't cache the result.
146 @note wxTaskBarIcon supports older GNOME 1.2 and KDE 1/2 methods of
147 adding icons to tray, but they are unreliable and this method
152 static bool IsAvailable();
157 This method is called by the library when the user requests popup menu
158 (on Windows and Unix platforms, this is when the user right-clicks the icon).
160 Override this function in order to provide popup menu associated with the icon.
161 If CreatePopupMenu() returns @NULL (this happens by default), no menu is shown,
162 otherwise the menu is displayed and then deleted by the library as soon as the
165 The events can be handled by a class derived from wxTaskBarIcon.
167 virtual wxMenu
* CreatePopupMenu();