CTaskPane

CTaskPane - XP Common tasks sidebar clone
This control imitates the look and feel of the Windows XP common tasks sidebar.
The original control created by Microsoft is included in a DLL called duser.dll but is unfortunately undocumented. Another problem is that you can only use it with Windows XP. So here is a solution that (hopefully) works with all Windows versions.
The control I've created is a sub classed CListBox, because the behaviour of the sidebar looks most like this control.
Most features of the original sidebar have been duplicated, except the possibility to attach windows to groups and animation.

Usage:
- Add a listbox control to your dialog.
- Set style to ownerdrawn variable and turn of sort.
- Assign a member variable (Catogory: Control) to the control. Variable type: CTaskPane (or CListBox and rename it later in the header file).

Now the control is ready to use:

int AddGroup(LPCTSTR lpszGroupName, BOOL bMainGroup);
Add a new group to the control.

lpszGroupName is the groupname (also title of the group)
bMainGroup makes the group title dark blue instead of light blue.


int AddTask(LPCTSTR lpszGroupName, LPCTSTR lpszTaskName, UINT nID, HICON hIcon);
Add a new task to the specified group.

lpszGroupName is the groupname where you want to add the task
lpszTaskName is the taskname (also title of the task)
nID is the command id of the action attached to this task (the parent receives this through a WM_COMMAND message when clicked)
hIcon is the handle of the icon (16x16)

int AddTask(int nIndex, LPCTSTR lpszTaskName, UINT m_nID, HICON hIcon);
Add a new task to the specified group index.

nIndex is the group index where you want to add the task
lpszTaskName is the taskname (also title of the task)
nID is the command id of the action attached to this task (the parent receives this through a WM_COMMAND message when clicked)
hIcon is the handle of the icon (16x16)

BOOL DeleteGroup(LPCTSTR lpszGroupName);
Deletes the specified group and all it's tasks

BOOL DeleteTask(LPCTSTR lpszGroupName, int nItem);
Deletes the n-th task from a group

BOOL Expand(LPCTSTR lpszGroupName, BOOL bExpand);
Expand or collapse the group.

void ResetContent();
Delete all content of the control.


Download example executable

Download source code
This class is part of the Pablo Software Solutions MFC Extension Package - Controls Edition
 

[Home] [Products] [Source Code] [Downloads] [Support]

© 2008 - Pablo Software Solutions
All rights reserved.