wx.TaskBarIcon Class Reference

Inheritance diagram for wx.TaskBarIcon:

wx.EvtHandler wx.Object

List of all members.

Public Member Functions

virtual Menu CreatePopupMenu ()
bool PopupMenu (Menu menu)
bool RemoveIcon ()
bool SetIcon (Icon icon, string tooltip)
 TaskBarIcon (IntPtr wxObject)
 TaskBarIcon ()

Protected Member Functions

override void CallDTor ()

Properties

bool IsIconInstalled [get]
bool IsOk [get]


Detailed Description

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.

wxNET notes
Apparently, task icons prohibit application exit on closing the main frame. So, you will have to use wx.Utils.Exit() instead where appropriate.
X Window System Note
Under X Window System, the window manager must support either the System Tray Protocol by freedesktop.org (WMs used by modern desktop environments such as GNOME >= 2, KDE >= 3 and XFCE >= 4 all do) or the older methods used in GNOME 1.2 and KDE 1 and 2. If it doesn't, the icon will appear as a toplevel window on user's desktop.
Because not all window managers have system tray, there's no guarantee that wx.TaskBarIcon will work correctly under X Window System and so the applications should use it only as an optional component of their user interface. The user should be required to explicitly enable the taskbar icon on Unix, it shouldn't be on by default.

Event handling
To process input from a taskbar icon, use the following event handler macros to direct input to member functions that take a wxTaskBarIconEvent argument. Note that not all ports are required to send these events and so it's better to override CreatePopupMenu if all that the application does is that it shows a popup menu in reaction to mouse click.

Contributed by Jacek Trublajewicz 2008 with some changes by Harald Meyer auf'm Hofe.

Constructor & Destructor Documentation

wx.TaskBarIcon.TaskBarIcon (  ) 

wx.TaskBarIcon.TaskBarIcon ( IntPtr  wxObject  ) 


Member Function Documentation

override void wx.TaskBarIcon.CallDTor (  )  [protected, virtual]

This will be called by Dispose() to delete the C++ object. Overload this if you have to use another DTor.

Reimplemented from wx.Object.

virtual Menu wx.TaskBarIcon.CreatePopupMenu (  )  [virtual]

This method is called by the library when the user requests popup menu (on Windows and Unix platforms, this is when the user right-clicks the icon). Override this function in order to provide popup menu associated with the icon.

If CreatePopupMenu returns null (this happens by default), no menu is shown, otherwise the menu is displayed and then deleted by the library as soon as the user dismisses it. The events can be handled by a class derived from wx.TaskBarIcon.

Note, that the returned wrapper will loose ownership of the native wx menu immediately after this method has been finished.

bool wx.TaskBarIcon.PopupMenu ( Menu  menu  ) 

Pops up a menu at the current mouse position. The events can be handled by a class derived from wx.TaskBarIcon.

Note
It is recommended to override CreatePopupMenu() callback instead of calling this method from event handler, because some ports (e.g. wxCocoa) may not implement PopupMenu() and mouse click events at all.

bool wx.TaskBarIcon.RemoveIcon (  ) 

This will remove the icon from the task bar.

bool wx.TaskBarIcon.SetIcon ( Icon  icon,
string  tooltip 
)

Defines icon and optional tool tip to be presented inthe task bar. Call RemoveIcon() to remove the icon from the task bar.


Property Documentation

bool wx.TaskBarIcon.IsIconInstalled [get]

True iff icon is presented in the task bar. Call RemoveIcon() to remove the icon from the task bar.

bool wx.TaskBarIcon.IsOk [get]


Manual of the wx.NET   (c) 2003-2011 the wx.NET project at   Get wx.NET at SourceForge.net. Fast, secure and Free Open Source software downloads