MDI Command Bar
This is a CCommandBarCtrl
extension to fully support the MDI architecture.
The implementation consists of three classes: CCommandBarCtrl2
manages the additional MDI buttons, CMDIChildWindowImpl2
forwards the size changes to CCommandBarCtrl2
and CMDIChildWinImplTraits2
implements a helper class to keep the maximize state when creating a new MDI child window. The class definitions and implementations are in the file AtlCmdBar2.h
, which is included in the demo project.
How to use the control in your WTL App
First, include the file AtlCmdBar2.h
in your applications .cpp
file. Then replace the definition of the main frames command bar CCommandBarCtrl m_CmdBar;
with CCommandBarCtrl2 m_CmdBar;
in mainfrm.h
. Finally replace all instances of CMDIChildWindowImpl
with CMDIChildWindowImpl2
in ChildFrm.h
. That's all.
History
- 03 Oct 2001
- Initial public release.
- 03 Dec 2001
- Added chevron support (including menu band size update).
- Fixed MDI system menu injection.
- Fixed size problem of MDI system menu.
- Fixed flickering of menu bar during window sizing.
About the implementation
The additional MDI buttons are implemented as custom draw buttons of the menu toolbar and are drawn via DrawFrameControl()
. These are added/removed in respond to a size change of the MDI child window. Additionally, WM_MDISETMENU
has to be handled to insert the MDI child windows menu into the new frame window menu.
Below are detailed explanations of the most interesting functions.