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