vadz edited this page Sep 11, 2014 · 5 revisions
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.

Progress Bar

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.

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.

Overlay Icon

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.

Thumbnail Toolbar

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 AppendThumbBarButton of wxTaskBarButton.

// ThumbnailToolbarBtn_0 is the id of the |button|.
wxThumbBarButton* button =
    new wxThumbBarButton(ThumbnailToolbarBtn_0, CreateRandomIcon());

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)
    // ...

Jump Lists

With class 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. Jump Lists

There are also other features including in the SOC2014_TASKBAR project, you can find them in the samples/taskbarbutton, and the api documents.