Control Bars and the Application Framework
The toolbar is an object of class CToolBar, and the status bar is an object of class CStatusBar. Both of these classes are derived from class CControlBar, which is itself derived from CWnd. The CControlBar class supports control bar windows that are positioned inside frame windows. These control bar windows resize and reposition themselves as the parent frame moves and changes size. The application framework takes care of the construction and destruction of the control bar objects and window creation. The MFC Application Wizard generates control bar code for its derived frame class located in the files


In a typical Single Document Interface (SDI) application, a CToolBar object occupies the top portion of the CMainFrame client area and a CStatusBar object occupies the bottom portion. The view occupies the remaining (middle) part of the frame.Beginning with version 4.0 of the Microsoft Foundation Class (MFC) library, the toolbar has been built around the toolbar common control that was first introduced with Microsoft Windows 95. Thus the toolbar is fully dockable. The programming interface is much the same as it was in earlier versions of the MFC library, however. The button images are easy to work with because a special resource type is supported by the resource editor.Assuming that MFC Application Wizard has generated the control bar code for your application, the user can enable and disable the toolbar or the status bar individually by choosing commands from the application's View menu. When a control bar is disabled, it disappears and the view size is recalculated. Apart from the common behavior just described, toolbar and status bar objects operate independently of each other and have rather different characteristics.Version 6.0 of the MFC library, introduced a new MFC toolbar called the rebar. The rebar is based on the controls that come with the common controls and provides a Microsoft Internet Explorer–style "sliding" toolbar. I'll cover the rebar later in this chapter.