CTabbedMDI Class |
Description
CTabbedMDI class combines many of the features of a MDI Frame and a tab control. Each MDI child is displayed as a separate tab page. Buttons which allow the MDI children to be listed or closed are displayed to the right of the tabs. The tabs can be displayed either at the top or bottom of the window.
CTabbedMDI Members
Operations
CTabbedMDI | CTabbedMDI();Constructor for CTabbedMDI |
virtual CWnd* AddMDIChild(WndPtr pView, LPCTSTR szTabText, int idMDIChild = 0);Adds a MDI tab, given a pointer to the view window, and the tab's text.
virtual void CloseActiveMDI();Closes the active MDI child
virtual void CloseAllMDIChildren();Closes all MDI children
virtual void CloseMDIChild(int nTab);Closes the MDI child, given the tab's index.
virtual CWnd* GetActiveMDIChild() const;Retrieves a pointer to the active MDI child's view window.
virtual int GetActiveMDITab() const;Retrieves the index of the current active MDI tab.
virtual HMENU GetListMenu() constRetrieves a pointer to the MDI child's view window, give the tab's index.
virtual CWnd* GetMDIChild(int nTab) const;Retrieves a pointer to the MDI child's view window, give the tab's index.
virtual int GetMDIChildCount() const;Retrieves the number of MDI children.
virtual int GetMDIChildID(int nTab) const;Retrieves the MDI child's ID, given the tab's index.
virtual LPCTSTR GetMDIChildTitle(int nTab) const;Retrieves the MDI child's text, given the tab's index
virtual CTab* GetTab() const;Returns a pointer to the TabbedMDI's tab control.
virtual BOOL LoadRegistrySettings(CString strRegistryKeyName);Loads the TabbedMDI information from the registry.
virtual void RecalcLayout();Repositions the child windows of the TabbedMDI window.
virtual BOOL SaveRegistrySettings(CString strRegistryKeyName);Saves the TabbedMDI information in the registry
virtual void SetActiveMDIChild(CWnd* pWnd);Sets the active MDI child, given its view window.
virtual void SetActiveMDITab(int nTab);Sets the active MDI child given its tab index.
Overridables
NewMDIChildFromID | virtual CWnd* NewMDIChildFromID(int idMDIChild);Override this function to create a new Docker given its TabbedMDI ID. |
OnCreate | virtual void OnCreate() ;Called when the TabbedMDI window is created. |
OnDestroy | virtual void OnDestroy(WPARAM wParam, LPARAM lParam);Called when the TabbedMDI window is destroyed. |
OnNotify | virtual LRESULT OnNotify(WPARAM wParam, LPARAM lParam);Called when the TabbedMDI recieves a notification. |
OnWindowPosChanged | virtual void OnWindowPosChanged(WPARAM wParam, LPARAM lParam);Called when the TabbedMDI window is resized or repositioned. |
Remarks
The following example demonstrates how to toggle the MDI tab position between the top and bottom of the window.
void CMainFrame::OnMDITabsAtTop() // Toggle the TabbedMDI's tabs between the top to bottom of window { CTabbedMDI* pTabbedMDI = m_DockTabbedMDI.GetTabbedMDI(); BOOL bTop = pTabbedMDI->GetTab().GetTabsAtTop(); pTabbedMDI->GetTab().SetTabsAtTop(!bTop); // Set the menu checkmark UINT uCheck = (bTop)? MF_UNCHECKED : MF_CHECKED; ::CheckMenuItem(GetFrameMenu(), IDM_TABBEDMDI_TOP, uCheck); }
The following example demonstrates how to add MDI children to the TabbedMDI control.
void CMainFrame::LoadDefaultMDIs() { // Add some MDI tabs CTabbedMDI* pTabbedMDI = (CTabbedMDI*)m_DockTabbedMDI.GetView(); pTabbedMDI->AddMDIChild(new CViewSimple, _T("Simple View"), ID_MDI_SIMPLE); pTabbedMDI->AddMDIChild(new CViewRect, _T("Rectangles"), ID_MDI_RECT); pTabbedMDI->AddMDIChild(new CViewText, _T("TextView"), ID_MDI_TEXT); pTabbedMDI->AddMDIChild(new CViewClasses, _T("Classes"), ID_MDI_CLASSES); pTabbedMDI->AddMDIChild(new CViewFiles, _T("Files"), ID_MDI_FILES); pTabbedMDI->SetActiveMDITab(0); }
Base class Members
For base class members, refer to the members of CWnd.
Remarks
Refer to the DockTabbedMDI sample for a demonstration of the use of CTabbedMDI.
Summary Information
Header file | tab.h |
Win32/64 support | Yes |
WinCE support | Yes |
Library required | Comctl32.lib |