Dock bar in MFC

Source: Internet
Author: User

Set the dock function
1. CFrameWnd: EnableDocking () This function creates a dock.
2. CControlBar: EnableDocking () This function adds the function of stopping and moving to the control bar.
3. CFrameWnd: DockControlBar () This function calls the control bar to the dock bar.

CToolBar
CStatusBar Status Bar
CDockBar dock
The CToolBar and CStatusBar classes allow control bars and video shared customer zones and many other functions.
The CDockBar and CDockContext classes allow users to move their toolbar.
CMiniDockFrameWnd class allows users to float their toolbar.

The Dock Control bar uses two types of MFC and four functions:
1) The CDockBar class creates up to four parking bars around the main window of the application to control and include other control bars. If the dashboard does not contain any other control bar, it will narrow itself down to something that seems to have disappeared from the application, and then wait for the new control bar to be placed on it.
2) The CDockContext class handles the event of clicking and dragging the control bar on the dock bar. This class is created for the control bar through the CControlBar: EnableDocking () function.
3) The EnableDocking () function of CFrameWnd creates a CDockBar instance for each side of the window.
4) The EnableDocking () function of CControlBar creates a CDockContext instance to allow the control bar to process events such as moving or stopping a user's mouse input.
5) The DockControlBar () function of CFrameWnd determines the dock to which the control bar is docked.
6) The DockControlBar () function of CDockBar is used to control the control bar on the dock bar.

How to share a customer zone with the control bar in the main application window:
1) when the content in the window changes, the recalclayout () function of cframewnd is called.
2) recalclayout () then calls the repositionbars () function of cwnd and tells it to allow all control bars in the window to occupy the required space, and then leaves the remaining space to the customer zone.
3) repositionbars () traverses all sub-windows in the window and sends wm_sizeparent messages to them to complete this operation. It passes each visible control bar in the frame to a gradually reduced rectangular area.
4) The onsizeparent () message processor of ccontrolbar processes wm_sizeparent messages for all control bar types, the method is to ask the control bar how much space they need and then subtract the space they need from the available space.
5) onsizeparent () calculates the space required for the control bar by calling the calcdynamiclayout () function. This function is reloaded by each control bar based on different types to determine the size required.
6) Complete the layout for yourself before returning the request size.

Storage:
The cframewnd class stores a pointer for each cdockbar instance it creates in a pointer linked list named m_listcontrolbars.
The cdockbar class stores a pointer in a pointer linked list named m_arrbars for each control bar (tool bar, status bar, etc.) that is docked in the current dock.

Class cdockbar: publicccontrolbar
{
Cptrarray m_arrbars; // each element is a ccontrolbar
};

Class cframewnd: Public cwnd
{
CPtrList m_listControlBars; // array of all control bars that have this window as their dock site
};

CDialogBar usage:

CDockBar is only used to accommodate ControlBar that is docked inside it.

To dock some components in the dock bar, such as the toolbar and information prompt bar in VS, you cannot directly add them to the CDockBar.
The easier way is to use CDialogBar to add the control to the dialog box template and then dock it.

For more information, see:

Http://blog.csdn.net/fulingwei/archive/2007/05/30/1630444.aspx

Http://topic.csdn.net/t/20040614/16/3090805.html

 

For how to implement a dock bar like MSDN, refer:

Http://www.vckbase.com/document/viewdoc? Id = 257

Http://www.vckbase.net/document/viewdoc? Id = 1059

Http://www.vckbase.net/document/viewdoc? Id = 1074

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.