Clone this wiki locally
As any Windows user would know, a taskbar is a bar displayed on an edge of a GUI desktop that is used to launch and monitor running applications. The taskbar provides users with access to applications that are open on the desktop. Windows 7 adds new features to the taskbar buttons, such as notification and status overlays, progress indicators, thumbnail toolbars, and jump lists. Now, you can access these features in your wxWidgets applications with just a few lines of code and do not need to care about the annoying COM interfaces.
Suppose that you want to show your app users the progress of some time-consuming tasks, such as downloading a file via internet, or loading a big file into memory, what would you do? Yeah, you can show a progress dialog to display the information. Now, you can do better with taskbar button progress bar. With one line of code, you can show your users that the progress is about 18% in the taskbar button of main frame.
// MSWGetTaskBarButton is a function of wxFrame that can // be used to access its corresponding taskbar button. MSWGetTaskBarButton()->SetProgressValue(18);
More conveniently, if you are using
wxGenericProgressDialog, everything will happen automatically. (Thanks to @vadz for helping me to integrate it.)
Just like life's not always very easy, the tasks will failed sometimes. Don't worry, you can change the status of the progress bar, helping users know there is something wrong.
// |state| is an enum value of wxTaskBarButtonState. MSWGetTaskBarButton()->SetProgressState(state);
Displaying a overlay icon on the taskbar button to indicate application status or a notification to the user is a piece of cake now, just use following one line of code,
// CreateIcon() will return an wxIcon object, which will // be displaying in the taskbar button. MSWGetTaskBarButton()->SetOverlayIcon(CreateIcon());
Do you know how to add thumbnail toolbar button to your application, like the next button of Windows Media Player in the thumbnail of taskbar button? Let
wxTaskBarButton help you. Just create several
wxThumbBarButton and append them via interface
// ThumbnailToolbarBtn_0 is the id of the |button|. wxThumbBarButton* button = new wxThumbBarButton(ThumbnailToolbarBtn_0, CreateRandomIcon()); MSWGetTaskBarButton()->AppendThumbBarButton(button);
Next step is adding an entry in your event table, everything is done now.
wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) // ... EVT_BUTTON(ThumbnailToolbarBtn_0, MyFrame::OnThumbnailToolbarBtnClicked) // ... wxEND_EVENT_TABLE()
wxTaskBarJumpList, you can access the system managed Recent and Frequent categories or append your own application-specific actions to the Tasks list. You can even define your own categories and add them in addition to or in place of the standard Recent and Frequent categories.