CDockContainer Class |
Description
The CDockContainer class adds "Containers" to the Win32++ framework. A Container is a tab control which has been designed to co-operate with docking. While Dockers allows any child window to be used as the view window, Containers add additional features when used as the view window for Dockers. These additional features include Container within Container docking (where the newly docked Container adds another tab), as well as additions to the dock targeting and dock hinting visual cues. Containers can also have a toolbar. The use of a toolbar is optional, but when used they are set up in the same way as toolbars for Frames.
CDockContainers have views of their own. These views can be any child window, and are set in the same way as views for Frames and MDI children.
CDockContainer Members
CDockContainer | CDockContainer();Constructor for CDockContainer. |
virtual void AddContainer(CDockContainer* pContainer, BOOL bInsert = FALSE);Adds the specified container as a child to this container. Set bInsert to TRUE to insert the container as the first tab, or FALSE to add it as the last tab.
virtual void AddToolBarButton(UINT nID, BOOL bEnabled = TRUE);Adds a resource ID to the container's toolbar.
CDockContainer* GetActiveContainer() const;Returns a pointer to the currently active container.
CWnd* GetActiveView() const;Returns a pointer to the view window for the currently active container.
std::vector<ContainerInfo>* GetAllContainers() const;Returns a reference to the vector of container information.
virtual CDockContainer* GetContainerFromIndex(UINT nPage);Returns a pointer to the container at the specified tab number.
virtual CDockContainer* GetContainerFromView(CWnd* pView) const;Returns a pointer to the container with the specified view.
virtual int GetContainerIndex(CDockContainer* pContainer);Returns the tab index of the specified container.
CDockContainer* GetContainerParent() const;Returns a pointer to the container which is the parent of this container group.
CString& GetDockCaption() const;Returns the CString which contains the text displayed in the caption of a docked container.
virtual SIZE GetMaxTabTextSize();Returns the size (width and height) of the caption text.
HICON GetTabIcon() const;Returns the icon handle for this container's tab.
LPCTSTR GetTabText() const;Returns the text for this container's tab.
virtual CToolBar* GetToolBar() const;Returns a pointer to the container's toolbar.
CWnd* GetView() const;Returns a pointer to the view window for this container.
virtual CViewPage* GetViewPage() const;Returns a pointer to the container's page. The container's page holds the toolbar and view window.
virtual void RecalcLayout();Recalculates the positions of the child windows for the container, and repositions them.
virtual void RemoveContainer(CDockContainer* pWnd);Removes the specified child container from this container group.
virtual void SelectPage(int nPage);Activates the specified page number.
void SetActiveContainer(CDockContainer* pContainer);Sets the active container.
void SetDockCaption(LPCTSTR szCaption);Sets the text associated with a docked container.
void SetHideSingleTab(BOOL bHide);Shows or hides the tab if it has only one page.
void SetTabIcon(HICON hTabIcon);
void SetTabIcon(UINT nID_Icon);Sets the icon for this container's tab.
void SetTabText(LPCTSTR szText);
void SetTabText(UINT nTab, LPCTSTR szText);Sets the text for this container's tab.
virtual void SetToolBarImages(COLORREF crMask, UINT ToolBarID, UINT ToolBarHotID, UINT ToolBarDisabledID);Sets the normal, hot and disabled images for the ToolBar
virtual void SetupToolBar();Override this function to specify the container's toolbar's bitmap and resource IDs.
void SetView(CWnd& Wnd);Sets the view window for this container.
virtual void SwapTabs(UINT nTab1, UINT nTab2);Swaps the position of two tabs.
Overridables
OnLButtonDown | OnLButtonDown(WPARAM wParam, LPARAM lParam);Called when the left mouse button is pressed. |
OnLButtonUp | OnLButtonUp(WPARAM wParam, LPARAM lParam);Called when the left mouse button is released. |
OnMouseLeave | virtual LRESULT OnMouseLeave(WPARAM wParam, LPARAM lParam);Called when the mouse cursor leaves the window. |
OnMouseMove | virtual LRESULT OnMouseMove(WPARAM wParam, LPARAM lParam);Called when the mouse cursor is moved over the window. |
OnSetFocus | virtual LRESULT OnSetFocus(WPARAM wParam, LPARAM lParam);Called when the window gets keyboard focus. We set the keyboard focus to the active view window. |
OnSize | virtual LRESULT OnSize(WPARAM wParam, LPARAM lParam);Called when the window is resized. |
OnTCNSelChange | virtual LRESULT OnTCNSelChange(LPNMHDR pNMHDR);Called when the currently selected tab has changed. |
Base class Members
For base class members, refer to the members of CTab.
Remarks
The CDockContainer could be also used as a view window for other window types, such as Frames and MDI children, although using a CTab for these other views is more common.
Summary Information
Header file | docking.h |
Win32/64 support | Yes |
WinCE support | No |
Library required | Comctl32.lib |