]>
Commit | Line | Data |
---|---|---|
1 | \section{\class{wxTaskBarIcon}}\label{wxtaskbaricon} | |
2 | ||
3 | This class represents a taskbar icon, appearing in the `system tray' and | |
4 | responding to mouse clicks. An icon has an optional tooltip. Supported under | |
5 | most ports (wxMSW, wxGTK, wxMotif, wxX11, wxMac). | |
6 | ||
7 | \wxheading{X Window System Note} | |
8 | ||
9 | Under X Window System, the window manager must support either | |
10 | the \urlref{System Tray Protocol by freedesktop.org}{http://freedesktop.org/Standards/systemtray-spec} | |
11 | (WMs used by modern desktop environments such as GNOME >= 2, KDE | |
12 | >= 3 and XFCE >= 4 all do) or the older methods used in GNOME 1.2 and | |
13 | KDE 1 and 2. If it doesn't, the icon will appear as a toplevel window on | |
14 | user's desktop. | |
15 | ||
16 | Because not all window managers have system tray, there's no guarantee that | |
17 | wxTaskBarIcon will work correctly under X Window System and so the applications | |
18 | should use it only as an optional component of their user interface. The user | |
19 | should be required to explicitly enable the taskbar icon on Unix, it shouldn't | |
20 | be on by default. | |
21 | ||
22 | ||
23 | \wxheading{Derived from} | |
24 | ||
25 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
26 | \helpref{wxObject}{wxobject} | |
27 | ||
28 | \wxheading{Include files} | |
29 | ||
30 | <wx/taskbar.h> | |
31 | ||
32 | \wxheading{Event handling} | |
33 | ||
34 | To process input from a taskbar icon, use the following event handler macros to direct input to member | |
35 | functions that take a wxTaskBarIconEvent argument. Note that not all ports are | |
36 | required to send these events and so it's better to override | |
37 | \helpref{CreatePopupMenu}{wxtaskbariconcreatepopupmenu} if all that | |
38 | the application does is that it shows a popup menu in reaction to mouse click. | |
39 | ||
40 | \twocolwidtha{7cm} | |
41 | \begin{twocollist}\itemsep=0pt | |
42 | \twocolitem{{\bf EVT\_TASKBAR\_MOVE(func)}}{Process a | |
43 | wxEVT\_TASKBAR\_MOVE event.} | |
44 | \twocolitem{{\bf EVT\_TASKBAR\_LEFT\_DOWN(func)}}{Process a | |
45 | wxEVT\_TASKBAR\_LEFT\_DOWN event.} | |
46 | \twocolitem{{\bf EVT\_TASKBAR\_LEFT\_UP(func)}}{Process a | |
47 | wxEVT\_TASKBAR\_LEFT\_UP event.} | |
48 | \twocolitem{{\bf EVT\_TASKBAR\_RIGHT\_DOWN(func)}}{Process a | |
49 | wxEVT\_TASKBAR\_RIGHT\_DOWN event.} | |
50 | \twocolitem{{\bf EVT\_TASKBAR\_RIGHT\_UP(func)}}{Process a | |
51 | wxEVT\_TASKBAR\_RIGHT\_UP event.} | |
52 | \twocolitem{{\bf EVT\_TASKBAR\_LEFT\_DCLICK(func)}}{Process a | |
53 | wxEVT\_TASKBAR\_LEFT\_DCLICK event.} | |
54 | \twocolitem{{\bf EVT\_TASKBAR\_RIGHT\_DCLICK(func)}}{Process a | |
55 | wxEVT\_TASKBAR\_RIGHT\_DCLICK event.} | |
56 | \end{twocollist}% | |
57 | ||
58 | \latexignore{\rtfignore{\wxheading{Members}}} | |
59 | ||
60 | \membersection{wxTaskBarIcon::wxTaskBarIcon}\label{wxtaskbariconctor} | |
61 | ||
62 | \func{}{wxTaskBarIcon}{\void} | |
63 | ||
64 | Default constructor. | |
65 | ||
66 | \membersection{wxTaskBarIcon::\destruct{wxTaskBarIcon}}\label{wxtaskbaricondtor} | |
67 | ||
68 | \func{}{\destruct{wxTaskBarIcon}}{\void} | |
69 | ||
70 | Destroys the wxTaskBarIcon object, removing the icon if not already removed. | |
71 | ||
72 | \membersection{wxTaskBarIcon::CreatePopupMenu}\label{wxtaskbariconcreatepopupmenu} | |
73 | ||
74 | \func{virtual wxMenu*}{CreatePopupMenu}{\void} | |
75 | ||
76 | This method is called by the library when the user requests popup menu | |
77 | (on Windows and Unix platforms, this is when the user right-clicks the icon). | |
78 | Override this function in order to provide popup menu associated with the icon. | |
79 | ||
80 | If CreatePopupIcon returns NULL (this happens by default), | |
81 | no menu is shown, otherwise the menu is | |
82 | displayed and then deleted by the library as soon as the user dismisses it. | |
83 | The events can be handled by a class derived from wxTaskBarIcon. | |
84 | ||
85 | \membersection{wxTaskBarIcon::IsIconInstalled}\label{wxtaskbariconisiconinstalled} | |
86 | ||
87 | \func{bool}{IsIconInstalled}{\void} | |
88 | ||
89 | Returns true if \helpref{SetIcon}{wxtaskbariconseticon} was called with no subsequent \helpref{RemoveIcon}{wxtaskbariconremoveicon}. | |
90 | ||
91 | \membersection{wxTaskBarIcon::IsOk}\label{wxtaskbariconisok} | |
92 | ||
93 | \func{bool}{IsOk}{\void} | |
94 | ||
95 | Returns true if the object initialized successfully. | |
96 | ||
97 | \membersection{wxTaskBarIcon::PopupMenu}\label{wxtaskbariconpopupmenu} | |
98 | ||
99 | \func{bool}{PopupMenu}{\param{wxMenu*}{ menu}} | |
100 | ||
101 | Pops up a menu at the current mouse position. The events can be handled by | |
102 | a class derived from wxTaskBarIcon. | |
103 | ||
104 | \wxheading{Note} | |
105 | ||
106 | It is recommended to override | |
107 | \helpref{CreatePopupIcon}{wxtaskbariconcreatepopupmenu} | |
108 | callback instead of calling this method from event handler, because some | |
109 | ports (e.g. wxCocoa) may not implement PopupMenu and mouse click events at all. | |
110 | ||
111 | \membersection{wxTaskBarIcon::RemoveIcon}\label{wxtaskbariconremoveicon} | |
112 | ||
113 | \func{bool}{RemoveIcon}{\void} | |
114 | ||
115 | Removes the icon previously set with \helpref{SetIcon}{wxtaskbariconseticon}. | |
116 | ||
117 | \membersection{wxTaskBarIcon::SetIcon}\label{wxtaskbariconseticon} | |
118 | ||
119 | \func{bool}{SetIcon}{\param{const wxIcon\&}{ icon}, \param{const wxString\& }{tooltip}} | |
120 | ||
121 | Sets the icon, and optional tooltip text. | |
122 | ||
123 |