![]() |
Platforms, Frameworks & Libraries »
WTL »
General
Intermediate
Outlook Bar Control and Frame (WTL)By Rashid ThadhaAn outlook control and framework that can be used in your WTL Application |
VC6Win2K, ATL, WTL, STL, Dev
|
|
Advanced Search |
|
|
|
||||||||||||||||

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 Outlook caption bar is based on the Window Caption Bar written by Maxime Labelle, the original article can be found at http://www.codeproject.com/useritems/captionbarctrl.asp
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.
CGfxOutBarCtrl. Three ATL files contain the port.COutBarCtrl Class for WTL)
CGroupEdit class for WTL and used by the COutBarCtrl Class)
COutlookSplitterWindow class for WTL and used by the COutBarCtrl Class)The caption bar can be found in
CCaptionBar) The flatbutton class can be found in
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.
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.
atlmisc.h is required as it has the definition for the WTL CString Class
COutBarCtrl wndBar; CImageList imaLarge, imaSmall; COutlookSplitterWindow m_splitter
m_hWndClient = m_splitter.Create(m_hWnd, rect, NULL,
WS_CHILD | WS_VISIBLE);
OnCreate function in the Main Frame class e.g. DWORD dwf = COutBarCtrl::fDragItems|COutBarCtrl::fEditGroups|
COutBarCtrl::fEditItems|COutBarCtrl::fRemoveGroups|
COutBarCtrl::fRemoveItems|COutBarCtrl::fAddGroups|
COutBarCtrl::fAnimation;
if (!wndBar.Create(WS_CHILD|WS_VISIBLE, CRect(0,0,0,0),
m_splitter.m_hWnd, 1234, dwf))
{
DWORD word = GetLastError();
return 0;
}
wndBar.SetOwner(m_hWnd);
imaLarge.Create(IDB_IMAGELIST, 32, 0, RGB(128,128,128));
imaSmall.Create(IDB_SMALL_IMAGELIST, 16, 0, RGB(0,128,128));
wndBar.SetImageList(&imaLarge, COutBarCtrl::fLargeIcon);
wndBar.SetImageList(&imaSmall, COutBarCtrl::fSmallIcon);
wndBar.SetAnimationTickCount(20);
wndBar.SetAnimSelHighlight(200);
wndBar.AddFolder("Folder 1", 0);
wndBar.AddFolder("Folder 2", 1);
wndBar.AddFolder("Folder 3", 2);
wndBar.InsertItem(0, 0, "Item 1", 0, 0);
wndBar.InsertItem(0, 1, "Item 2", 1, 0);
wndBar.InsertItem(0, 2, "Item 3", 2, 0);
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
MESSAGE_HANDLER(WM_OUTBAR_NOTIFY, OnOutbarNotify)
On the onNotify handler, trap the Events.
LRESULT OnOutbarNotify(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { switch (wParam) { case NM_OB_ITEMCLICK: // cast the lParam to an integer to get the clicked item { int index = (int) lParam; CString cs, cs1; cs1 = wndBar.GetItemText(index); cs.Format("Clicked on %d - <%s>", (int)lParam, cs1); MessageBox(cs, "Outlook Bar", MB_OK); } return 0; case NM_OB_ONLABELENDEDIT: // cast the lParam to an OUTBAR_INFO * struct; // it will contain info about the edited item { OUTBAR_INFO * pOI = (OUTBAR_INFO *) lParam; } return 1; case NM_OB_ONGROUPENDEDIT: // cast the lParam to an OUTBAR_INFO * struct; // it will contain info about the edited folder { OUTBAR_INFO * pOI = (OUTBAR_INFO *) lParam; } return 1; case NM_OB_DRAGITEM: // cast the lParam to an OUTBAR_INFO * struct; // it will contain info about the dragged items { OUTBAR_INFO * pOI = (OUTBAR_INFO *) lParam; } return 1; } return 0; }
The Demo App shows how to use the control in full.
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 27 Jun 2001 Editor: Nishant Sivakumar |
Copyright 2001 by Rashid Thadha Everything else Copyright © CodeProject, 1999-2009 Web10 | Advertise on the Code Project |