Credit and Acknowledgments

First of all I would like to credit the Original Author Iuri Apollonio on the fantastic control that he has developed using MFC. His code has been used to port the control to WTL with a few WTL tweaks and fixes. The original article can be found at

The Flatbutton on the caption bar is based on Davide Calabro's excellent CButtonST class, that has been ported to WTL. The Flatbutton class has been extended to include functionality to get the outlook flatbutton style.

Overview

I needed a Outlook bar to use in a ATL/WTL project, my attention turned to Iuri Apollonio Outlook bar Control that was MFC based and this article basically ports the original CGfxOutBarCtrl. Three ATL files contain the port.

atloutbarctrl.h (Contains the main COutBarCtrl Class for WTL)

atlgroupedit.h (Contains the CGroupEdit class for WTL and used by the COutBarCtrl Class)

atloutbarsplit.h (Contains the COutlookSplitterWindow class for WTL and used by the COutBarCtrl Class)

The caption bar can be found in

atlcaptionbar.h (Contains the main CCaptionBar)

The flatbutton class can be found in

atlflatbutton.h (Contains the main CButtonST class)

The COutlookSplitterWindow bar is inherited from the WTL CSplitterWindow class, additional functionality had to be added to make the left pane aligned (i.e. left pane does not move width wise when the app is resized). This functionality strangely exist in the base class for a right pane. Further tweks had to be added to make it act like a outlook splitter. The original CGfxSplitterWindow has not been ported as MFC and WTL splitter classes vary.

Requirements

You will require the WTL Libraries, these can be downloaded from the microsoft site, there are various articles on the net that tell you how to do this, so I won't bore you with the details.

Note - This control uses the WTL CString class and the STL std::list template class.

How to use the control in your WTL App

Make sure you have the following ATL files included in your stdafx.h

atlwin.h

atlctrls.h

atlmisc.h

atlmisc.h is required as it has the definition for the WTL CString Class

Add the header file atloutbarctrl.h and atloutbarsplit.h to the Main frame class and declare an instance of the Outlook bar control, Outlook Bar Splitter objects and the Image Lists that are to be used in the outlook bar.

You need to set a few of the splitter methods for it to act like a outlook splitter.

m_splitter.m_bFullDrag = false; // Draws the Ghost bar instead
m_splitter.SetSplitterExtendedStyle(SPLIT_LEFTALIGNED);
// Aligns the outlook bar to the left
m_splitter.SetSplitterPanes(wndBar, m_list);
// Set the outlook bar on the left pane
m_splitter.SetSplitterPos(120); // width of the initial outlook bar

To receive Events on when the tab has been selected add the Macro to the message Map.

Updates

v1.00 - Initial Port

v1.01 - Added Outlook Caption Bar to demo app also shows how to use nested vertical and horizontal splitter bar to get outlook feel. Fixed potential painting problem in outlook control when resizing the application.

v1.02 - Extended the Outlook framework, by adding the flat button on the caption bar. Also uses panes to lock and unlock the floating tree window.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.