Rediģēt

Kopīgot, izmantojot


CMDIFrameWndEx class

Extends the functionality of CMDIFrameWnd, a Windows Multiple Document Interface (MDI) frame window.

Syntax

class CMDIFrameWndEx : public CMDIFrameWnd

Members

Public Methods

Name Description
CMDIFrameWndEx::ActiveItemRecalcLayout Recalculates the layout of the active item.
CMDIFrameWndEx::AddDockSite This method isn't used.
CMDIFrameWndEx::AddPane Registers a pane with the docking manager.
CMDIFrameWndEx::AdjustClientArea Reduces the client area to allow for a border.
CMDIFrameWndEx::AdjustDockingLayout Recalculates the layout of all docked panes.
CMDIFrameWndEx::AreMDITabs Determines whether the MDI Tabs feature or the MDI Tabbed Groups feature is enabled.
CMDIFrameWndEx::CanConvertControlBarToMDIChild Called by the framework to determine whether the frame window can convert docking panes to tabbed documents.
CMDIFrameWndEx::ControlBarToTabbedDocument Converts the specified docking pane to a tabbed document.
CMDIFrameWndEx::CreateDocumentWindow Creates a child document window.
CMDIFrameWndEx::CreateNewWindow Called by the framework to create a new window.
CMDIFrameWndEx::CreateObject Used by the framework to create a dynamic instance of this class type.
CMDIFrameWndEx::DockPane Docks the specified pane to the frame window.
CMDIFrameWndEx::DockPaneLeftOf Docks one pane to the left of another pane.
CMDIFrameWndEx::EnableAutoHidePanes Enables auto-hide mode for panes when they're docked at specified sides of the main frame window.
CMDIFrameWndEx::EnableDocking Enables docking of the panes that belong to the MDI frame window.
CMDIFrameWndEx::EnableFullScreenMainMenu Shows or hides the main menu in full-screen mode.
CMDIFrameWndEx::EnableFullScreenMode Enables full-screen mode for the frame window.
CMDIFrameWndEx::EnableLoadDockState Enables or disables the loading of the docking state.
CMDIFrameWndEx::EnableMDITabbedGroups Enables or disables the MDI Tabbed Groups feature.
CMDIFrameWndEx::EnableMDITabs Enables or disables the MDI Tabs feature. When enabled, the frame window displays a tab for each MDI child window.
CMDIFrameWndEx::EnableMDITabsLastActiveActivation Specifies whether the last active tab should be activated when the user closes the current tab.
CMDIFrameWndEx::EnablePaneMenu Enables or disables automatic creation and management of the pop-up pane menu, which displays a list of application panes.
CMDIFrameWndEx::EnableWindowsDialog Inserts a menu item whose command ID calls a CMFCWindowsManagerDialog dialog box.
CMDIFrameWndEx::GetActivePopup Returns a pointer to the currently displayed popup menu.
CMDIFrameWndEx::GetPane Returns a pointer to the pane that has the specified control ID.
CMDIFrameWndEx::GetDefaultResId Returns the ID of shared resources of the MDI frame window.
CMDIFrameWndEx::GetMDITabGroups Returns a list of MDI tabbed windows.
CMDIFrameWndEx::GetMDITabs Returns a reference to the underlined tabbed window.
CMDIFrameWndEx::GetMDITabsContextMenuAllowedItems Returns a combination of flags that determines what context menu items are valid when the MDI Tabbed Groups feature is enabled.
CMDIFrameWndEx::GetMenuBar Returns a pointer to a menu bar object attached to the frame window.
CMDIFrameWndEx::GetRibbonBar Retrieves the ribbon bar control for the frame.
CMDIFrameWndEx::GetTearOffBars Returns a list of CPane-derived objects that are in a tear-off state.
CMDIFrameWndEx::GetThisClass Called by the framework to obtain a pointer to the CRuntimeClass object that is associated with this class type.
CMDIFrameWndEx::GetToolbarButtonToolTipText Called by the framework when the application displays the tooltip for a toolbar button.
CMDIFrameWndEx::InsertPane Registers the specified pane with the docking manager.
CMDIFrameWndEx::IsFullScreen Determines whether the frame window is in full-screen mode.
CMDIFrameWndEx::IsMDITabbedGroup Determines whether the MDI Tabbed Groups feature is enabled.
CMDIFrameWndEx::IsMemberOfMDITabGroup Determines whether the specified tabbed window is in the list of windows that are in MDI Tabbed Groups.
CMDIFrameWndEx::IsMenuBarAvailable Determines whether the frame window has a menu bar.
CMDIFrameWndEx::IsPointNearDockSite Determines whether a specified point is near the dock site.
CMDIFrameWndEx::IsPrintPreview Determines whether the frame window is in print-preview mode.
CMDIFrameWndEx::LoadFrame Creates a frame window from resource information. (Overrides CMDIFrameWnd::LoadFrame.)
CMDIFrameWndEx::LoadMDIState Loads the specified layout of MDI Tabbed Groups and the list of previously opened documents.
CMDIFrameWndEx::MDITabMoveToNextGroup Moves the active tab from the currently active tabbed window to the next or previous tabbed group.
CMDIFrameWndEx::MDITabNewGroup Creates a new tabbed group that has a single window.
CMDIFrameWndEx::NegotiateBorderSpace Negotiates border space in a frame window during OLE in-place activation.
CMDIFrameWndEx::OnCloseDockingPane Called by the framework when the user clicks the Close button on a dockable pane.
CMDIFrameWndEx::OnCloseMiniFrame Called by the framework when the user clicks the Close button on a floating mini frame window.
CMDIFrameWndEx::OnClosePopupMenu Called by the framework when an active pop-up menu processes a WM_DESTROY message.
CMDIFrameWndEx::OnCmdMsg Called by the framework to route and dispatch command messages and to update command user-interface objects.
CMDIFrameWndEx::OnDrawMenuImage Called by the framework when the image associated with a menu item is drawn.
CMDIFrameWndEx::OnDrawMenuLogo Called by the framework when a CMFCPopupMenuprocesses a WM_PAINT message.
CMDIFrameWndEx::OnEraseMDIClientBackground Called by the framework when the MDI frame window processes a WM_ERASEBKGND message.
CMDIFrameWndEx::OnMenuButtonToolHitTest Called by the framework when a CMFCToolBarButtonobject processes a WM_NCHITTEST message.
CMDIFrameWndEx::OnMoveMiniFrame Called by the framework to move a mini-frame window.
CMDIFrameWndEx::OnSetPreviewMode Sets the application's main frame window print-preview mode. (Overrides CFrameWnd::OnSetPreviewMode.)
CMDIFrameWndEx::OnShowCustomizePane Called by the framework when a Quick Customize pane is activated.
CMDIFrameWndEx::OnShowMDITabContextMenu Called by the framework when a context menu should be displayed on one of the tabs. (Valid for MDI Tabbed Groups only.)
CMDIFrameWndEx::OnShowPanes Called by the framework to show or hide panes.
CMDIFrameWndEx::OnShowPopupMenu Called by the framework when a pop-up menu is activated.
CMDIFrameWndEx::OnSizeMDIClient Called by the framework when the size of the client MDI window is changing.
CMDIFrameWndEx::OnTearOffMenu Called by the framework when a menu that has a tear-off bar is activated.
CMDIFrameWndEx::OnUpdateFrameMenu Called by the framework to update the frame menu. (Overrides CMDIFrameWnd::OnUpdateFrameMenu.)
CMDIFrameWndEx::PaneFromPoint Returns the docking pane that contains the specified point.
CMDIFrameWndEx::PreTranslateMessage Used by class CWinApp to translate window messages before they're dispatched to the TranslateMessage and DispatchMessage Windows functions. (Overrides CMDIFrameWnd::PreTranslateMessage.)
CMDIFrameWndEx::RecalcLayout Called by the framework to recalculate the layout of the frame window. (Overrides CFrameWnd::RecalcLayout.)
CMDIFrameWndEx::RemovePaneFromDockManager Unregisters a pane and removes it from the docking manager.
CMDIFrameWndEx::SaveMDIState Saves the current layout of MDI Tabbed Groups and the list of previously opened documents.
CMDIFrameWndEx::SetPrintPreviewFrame Sets the print preview frame window.
CMDIFrameWndEx::SetupToolbarMenu Modifies a toolbar object by searching for dummy items and replacing them with the specified user-defined items.
CMDIFrameWndEx::ShowFullScreen Switches the main frame from regular mode to full-screen mode.
CMDIFrameWndEx::ShowPane Shows or hides the specified pane.
CMDIFrameWndEx::ShowWindowsDialog Creates a CMFCWindowsManagerDialog box and opens it.
CMDIFrameWndEx::TabbedDocumentToControlBar Converts the specified tabbed document to a docking pane.
CMDIFrameWndEx::UpdateCaption Called by the framework to update the window frame caption.
CMDIFrameWndEx::UpdateMDITabbedBarsIcons Sets the icon for each MDI tabbed pane.
CMDIFrameWndEx::WinHelp Called by the framework to initiate the WinHelp application or context help. (Overrides CWnd::WinHelp.)

Data members

Name Description
CMDIFrameWndEx::m_bCanConvertControlBarToMDIChild Determines whether docking panes can be converted to MDI child windows.
CMDIFrameWndEx::m_bDisableSetRedraw Enables or disables redraw optimization for MDI child windows.

Remarks

To take advantage of extended customization features in your MDI application, derive the MDI frame window class of the application from CMDIFrameWndEx instead of CMDIFrameWnd.

Example

The following example derives a class from CMDIFrameWndEx. This code snippet comes from the DrawClient Sample: MFC Ribbon-Based OLE Object Drawing Application.

class CMainFrame : public CMDIFrameWndEx
{
   DECLARE_DYNAMIC(CMainFrame)
public:
   struct XStyle
   {
      COLORREF clrFill;
      COLORREF clrLine;
   };

public:
   CMainFrame();

   // Attributes
public:
   CMFCRibbonBar *GetRibbonBar() { return &m_wndRibbonBar; }

   // Operations
public:
   void UpdateUI(CDrawView *pCurrView);
   void UpdateContextTab(CDrawView *pCurrView);
   void UpdateContextTabFromObject(CDrawObjList &list);

   COLORREF GetColorFromColorButton(int nButtonID);
   int GetWeightFromLineWeight(int nButtonID);
   BOOL GetStyleFromStyles(XStyle &style);

   void SetRibbonContextCategory(UINT uiCategoryID);
   void ActivateRibbonContextCategory(UINT uiCategoryID);

   // Implementation
public:
   virtual ~CMainFrame();
#ifdef _DEBUG
   virtual void AssertValid() const;
   virtual void Dump(CDumpContext &dc) const;
#endif

protected:
   // control bar embedded members
   CMFCRibbonStatusBar m_wndStatusBar;
   CMFCRibbonBar m_wndRibbonBar;

   CMFCRibbonApplicationButton m_MainButton;

   // panel images
   CMFCToolBarImages m_PanelImages;

   // Document colors for demo:
   CList<COLORREF, COLORREF> m_lstMainColors;
   CList<COLORREF, COLORREF> m_lstAdditionalColors;
   CList<COLORREF, COLORREF> m_lstStandardColors;

   // Generated message map functions
protected:
   //{{AFX_MSG(CMainFrame)
   afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
   afx_msg void OnAppLook(UINT id);
   afx_msg void OnUpdateAppLook(CCmdUI *pCmdUI);
   afx_msg void OnWindowManager();
   afx_msg void OnMdiMoveToNextGroup();
   afx_msg void OnMdiMoveToPrevGroup();
   afx_msg void OnMdiNewHorzTabGroup();
   afx_msg void OnMdiNewVertGroup();
   afx_msg void OnMdiCancel();
   afx_msg LRESULT OnRibbonCustomize(WPARAM wp, LPARAM lp);
   afx_msg LRESULT OnHighlightRibbonListItem(WPARAM wp, LPARAM lp);
   afx_msg void OnToolsOptions();
   afx_msg void OnDummy();
   afx_msg void OnSysColorChange();
   //}}AFX_MSG

   DECLARE_MESSAGE_MAP()

   virtual BOOL OnShowMDITabContextMenu(CPoint point, DWORD dwAllowedItems, BOOL bDrop);
   virtual BOOL OnShowPopupMenu(CMFCPopupMenu *pMenuPopup);

   void ShowOptions(int nPage);
   void CreateDocumentColors();

private:
   BOOL CreateRibbonBar();
   BOOL CreateStatusBar();

   void InitMainButton();
   void InitHomeCategory();
   void InitViewCategory();
   void InitTabButtons();

   void AddContextTab_Format();

   void AdjustObjectSubmenu(CMFCPopupMenu *pMenuPopup);
   void UpdateStatusBarCountPane(int nID, CString strText, int nCount);

   UINT m_nAppLook;
};

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

CFrameWnd

CMDIFrameWnd

CMDIFrameWndEx

Requirements

Header: afxMDIFrameWndEx.h

CMDIFrameWndEx::ActiveItemRecalcLayout

Recalculates the layout of the active item.

void ActiveItemRecalcLayout();

CMDIFrameWndEx::AddPane

Registers a pane with the docking manager.

BOOL AddPane(
    CBasePane* pControlBar,
    BOOL bTail=TRUE);

Parameters

pControlBar
[in] Pointer to the pane to register.

bTail
[in] Specifies whether to add this pane to the end of the list.

Return value

Returns a non-zero value if the pane is registered successfully. Returns 0 if the pane is already registered with the docking manager.

Remarks

Each pane must be registered with the CDockingManager class before it can take a part in the docking layout. Use this method to notify the docking manager that you want to dock a specific pane. Once that pane is registered, the docking manager aligns it based on its alignment setting and position in the list of panes maintained by the docking manager.

CMDIFrameWndEx::AdjustClientArea

Reduces the client area to allow for a border.

virtual void AdjustClientArea();

CMDIFrameWndEx::AdjustDockingLayout

Recalculates the layout of all docked panes.

virtual void AdjustDockingLayout(HDWP hdwp=NULL);

Parameters

hdwp
[in] Identifies the multiple-window-position structure. You can obtain this value by calling BeginDeferWindowPos.

Remarks

Call this member function to recalculate the layout of all panes docked to the frame window.

CMDIFrameWndEx::AreMDITabs

Determines whether the MDI tabs feature or the MDI tabbed groups feature is enabled.

BOOL AreMDITabs(int* pnMDITabsType=NULL) const;

Parameters

pnMDITabsType
[out] A pointer to an integer variable that indicates which features are enabled:

  • 0: All features are disabled.
  • 1: MDI tabs is enabled.
  • 2: MDI tabbed groups is enabled.

Return value

Returns TRUE if MDI tabs or MDI tabbed groups is enabled.

Returns FALSE if none of the above features are enabled.

Remarks

Use this function to determine whether MDI tabs or MDI tabbed groups is enabled for the frame window. Use CMDIFrameWndEx::EnableMDITabs to enable or disable the MDI tabs feature.

Use CMDIFrameWndEx::EnableMDITabbedGroups to enable or disable the MDI tabbed groups feature.

CMDIFrameWndEx::CanConvertControlBarToMDIChild

Called by the framework to determine whether the frame window can convert docking panes to tabbed documents

virtual BOOL CanConvertControlBarToMDIChild();

Return Value

Returns TRUE if the frame window can convert docking panes to tabbed documents; otherwise returns FALSE.

Remarks

Override this method in a derived class and return TRUE to enable the conversion of docking panes to tabbed documents. Alternatively, you can set CMDIFrameWndEx::m_bCanConvertControlBarToMDIChild to TRUE.

CMDIFrameWndEx::ControlBarToTabbedDocument

Converts the specified docking pane to a tabbed document.

virtual CMDIChildWndEx* ControlBarToTabbedDocument(CDockablePane* pBar);

Parameters

pBar
A pointer to the docking pane to convert.

Return Value

Returns a pointer to the new MDI child window that contains the docking pane.

Remarks

This method converts a docking pane to a tabbed document. When you call this method, the framework creates a CMDIChildWndEx class object, removes the docking pane from the docking manager, and adds the docking pane to the new MDI child window. The MDI child window resizes the docking pane to cover the entire client area

CMDIFrameWndEx::CreateDocumentWindow

Creates a child document window.

virtual CMDIChildWndEx* CreateDocumentWindow(
    LPCTSTR lpcszDocName,
    CObject* pObj);

Parameters

lpcszDocName
[in] A text string that contains a document identifier. Typically, it's the full path of a document file.

pObj
[in] A pointer to a user-defined object. For example, a developer can create an application-specific data structure describing the document and telling how the document should be initialized at startup.

Return value

A pointer to CMDIChildWndEx.

Remarks

The framework calls this method when it loads the list of documents previously saved in the registry.

Override this method in order to create documents when they're being loaded from the registry.

Example

The following example shows how CreateDocumentWindow is used in the VisualStudioDemo Sample: MFC Visual Studio Application.

In this example, g_strStartViewName could be the name of a "virtual document" (for example, "Start Page") that isn't loaded from a disk file. Therefore we need special processing to handle that case.

CMainFrame::CMainFrame()
{
   CMFCPopupMenu::SetForceShadow(TRUE);
   m_bCanConvertControlBarToMDIChild = TRUE;
}

CMDIFrameWndEx::CreateNewWindow

Called by the framework to create a new window.

virtual CMDIChildWndEx* CreateNewWindow(
    LPCTSTR lpcszDocName,
    CObject* pObj);

Parameters

lpcszDocName
[in] The document name.

pObj
[in] Reserved for future use.

Return value

A pointer to the new window.

CMDIFrameWndEx::DockPane

Docks the specified pane to the frame window.

void DockPane(
    CBasePane* pBar,
    UINT nDockBarID=0,
    LPCRECT lpRect=NULL);

Parameters

pBar
[in] Pointer to the pane to dock.

nDockBarID
[in] Specifies which sides of the frame window to dock to.

lpRect
[in] Not used.

Remarks

This method docks the specified pane to one of the sides of the frame window that was specified when CBasePane::EnableDocking and CMDIFrameWndEx::EnableDocking were called.

Example

The following example demonstrates the use of the DockPane method. This code snippet comes from the VisualStudioDemo Sample: MFC Visual Studio Application.

DockPane(&m_wndMenuBar);
DockPane(&m_wndToolBar);
DockPane(&m_wndPropertiesBar);

DockPane(&m_wndToolbarBuild);

CMDIFrameWndEx::DockPaneLeftOf

Docks one pane to the left of another pane.

BOOL DockPaneLeftOf(
    CPane* pBar,
    CPane* pLeftOf);

Parameters

pBar
[in] A pointer to the docking pane.

pLeftOf
[in] A pointer to the pane that serves as the dock site.

Return value

Returns TRUE if the operation is successful. Otherwise returns FALSE.

Remarks

Call this method to dock several pane objects in a predefined order. This method docks the pane specified by pBar to the left of the pane specified by pLeftOf.

Example

The following example shows how the DockPaneLeftOf method is used in the VisualStudioDemo Sample: MFC Visual Studio Application.

DockPane(&m_wndToolbarBuild);
DockPaneLeftOf(&m_wndToolbarEdit, &m_wndToolbarBuild);

CMDIFrameWndEx::EnableAutoHidePanes

Enables auto-hide mode for panes when they're docked at the specified sides of the main frame window.

BOOL EnableAutoHidePanes(DWORD dwDockStyle);

Parameters

dwDockStyle
[in] Specifies the sides of the main frame window that will be enabled. Use one or more of the following flags.

  • CBRS_ALIGN_LEFT
  • CBRS_ALIGN_RIGHT
  • CBRS_ALIGN_TOP
  • CBRS_ALIGN_BOTTOM

Return value

Call this function to enable auto-hide mode for panes when they're docked at the specified sides of the main frame window.

Example

The following example shows how the EnableAutoHidePanes method is used in the VisualStudioDemo Sample: MFC Visual Studio Application.

EnableAutoHidePanes(CBRS_ALIGN_ANY);

Remarks

CMDIFrameWndEx::EnableDocking

Enables docking of the panes that belong to the MDI frame window.

BOOL EnableDocking(DWORD dwDockStyle);

Parameters

dwDockStyle
[in] Specifies the docking style that you want to apply.

Return value

Remarks

Call this function to enable docking of panes that belong to the CMDIFrameWndEx object.

Example

The following example shows how the EnableDocking method is used in the VisualStudioDemo Sample: MFC Visual Studio Application.

EnableDocking(CBRS_ALIGN_ANY);

CMDIFrameWndEx::EnableFullScreenMainMenu

Shows or hides the main menu in full-screen mode.

void EnableFullScreenMainMenu(BOOL bEnableMenu);

Parameters

bEnableMenu
[in] TRUE to show the main menu in full-screen mode, or FALSE to hide it.

Remarks

CMDIFrameWndEx::EnableFullScreenMode

Enables full-screen mode for the frame window.

void EnableFullScreenMode(UINT uiFullScreenCmd);

Parameters

uiFullScreenCmd
[in] The ID of a command that enables or disables full-screen mode.

Remarks

In full-screen mode, all docking control bars, toolbars and menus are hidden and the active view is resized to occupy the full-screen. When you enable full-screen mode, you must specify an ID of the command that enables or disables it. You can call EnableFullScreenMode from the main frame's OnCreate function. When a frame window is being switched to full-screen mode, the framework creates a floating toolbar with one button that has the specified command ID. If you want to keep the main menu on the screen, call CMDIFrameWndEx::EnableFullScreenMainMenu.

CMDIFrameWndEx::EnableLoadDockState

Enables or disables the loading of the docking state.

void EnableLoadDockState(BOOL bEnable = TRUE);

Parameters

bEnable
[in] TRUE to enable the loading of the docking state, FALSE to disable the loading of the docking state.

Remarks

CMDIFrameWndEx::EnableMDITabbedGroups

Enables or disables the MDI tabbed groups feature for the frame window.

void EnableMDITabbedGroups(
    BOOL bEnable,
    const CMDITabInfo& params);

Parameters

bEnable
[in] If TRUE, the MDI tabbed groups feature is enabled; if FALSE, the MDI tabbed groups feature is disabled.

params
[in] Specifies parameters that the framework applies to child windows that are created in the MDI client area.

Remarks

Use this method to enable or disable the MDI tabbed groups feature. This feature enables MDI applications to display child windows as tabbed windows that are aligned vertically or horizontally within the MDI client area. Groups of tabbed windows are separated by splitters. The user can resize tabbed groups by using a splitter.

The user can:

  • Drag individual tabs between groups.
  • Drag individual tabs to the edge of the window to create new groups.
  • Move tabs or create new groups by using a shortcut menu.
  • Your application can save the current layout of tabbed windows and the list of currently opened documents.

If you call this method with bEnable set to FALSE, params is ignored.

Even if MDI tabbed groups is already enabled, you can call this method again to modify the settings for child windows. Call the method with bEnable set to TRUE and modify the members of the CMDITabInfo object that are specified by the params parameter.

For more information about how to use MDI tabbed groups, see MDI Tabbed Groups.

Example

The following example shows how EnableMDITabbedGroups is used in the VisualStudioDemo Sample: MFC Visual Studio Application.

CMDITabInfo mdiTabParams;
mdiTabParams.m_bTabCustomTooltips = TRUE;

if (bMDITabsVS2005Look)
{
   mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_VS2005;
   mdiTabParams.m_bDocumentMenu = TRUE;
}
else if (bOneNoteTabs)
{
   mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE;
   mdiTabParams.m_bAutoColor = bMDITabColors;
}

if (bActiveTabCloseButton)
{
   mdiTabParams.m_bTabCloseButton = FALSE;
   mdiTabParams.m_bActiveTabCloseButton = TRUE;
}

EnableMDITabbedGroups(TRUE, mdiTabParams);

CMDIFrameWndEx::EnableMDITabs

Enables or disables the MDI Tabs feature for the MDI frame window. When enabled, the frame window displays a tab for each MDI child window.

void EnableMDITabs(
    BOOL bEnable=TRUE,
    BOOL bIcons=TRUE,
    CMFCTabCtrl::Location tabLocation=CMFCTabCtrl::LOCATION_BOTTOM,
    BOOL bTabCloseButton=FALSE,
    CMFCTabCtrl::Style style=CMFCTabCtrl::STYLE_3D_SCROLLED,
    BOOL bTabCustomTooltips=FALSE,
    BOOL bActiveTabCloseButton=FALSE);

Parameters

bEnable
Specifies whether tabs are enabled.

bIcons
Specifies whether icons should be displayed on the tabs.

tabLocation
Specifies the location of the tab labels.

bTabCloseButton
Specifies whether to display tab close buttons.

style
Specifies the style of tabs. Use STYLE_3D_SCROLLED for regular tabs or STYLE_3D_ONENOTE for Microsoft OneNote tabs.

bTabCustomTooltips
Specifies whether custom tooltips are enabled.

bActiveTabCloseButton
If TRUE, a Close button will be displayed on the active tab instead of on the right corner of the tab area.

Remarks

Call this method to enable or disable the MDI tabs feature for the MDI frame window. When enabled, all child windows are displayed as tabs.

The tab labels can be located at the top or bottom of the frame, depending on the setting of the parameter tabLocation. You may specify either CMFCTabCtrl::LOCATION_BOTTOM (the default setting) or CMFCTabCtrl::LOCATION_TOP.

If bTabCustomTooltips is TRUE, an AFX_WM_ON_GET_TAB_TOOLTIP message will be sent to the main frame window. Your code can handle this message and provide the framework with custom tooltips for MDI tabs.

Example

The following example shows how EnableMDITabs is used in the MDITabsDemo Sample: MFC Tabbed MDI Application.

void CMainFrame::UpdateMDITabs(BOOL bResetMDIChild)
{
   CMDITabInfo params;
   HWND hwndActive = NULL;

   switch (theApp.m_Options.m_nMDITabsType)
   {
   case CMDITabOptions::None:
   {
      BOOL bCascadeMDIChild = FALSE;

      if (IsMDITabbedGroup())
      {
         EnableMDITabbedGroups(FALSE, params);
         bCascadeMDIChild = TRUE;
      }
      else if (AreMDITabs())
      {
         EnableMDITabs(FALSE);
         bCascadeMDIChild = TRUE;
      }

      if (bCascadeMDIChild)
      {
         // CMDIClientAreaWnd m_wndClientArea
         hwndActive = (HWND)m_wndClientArea.SendMessage(WM_MDIGETACTIVE);
         m_wndClientArea.PostMessage(WM_MDICASCADE);
         m_wndClientArea.UpdateTabs(false);
         m_wndClientArea.SetActiveTab(hwndActive);
         ::BringWindowToTop(hwndActive);
      }
   }
   break;

   case CMDITabOptions::MDITabsStandard:
      hwndActive = (HWND)m_wndClientArea.SendMessage(WM_MDIGETACTIVE);
      m_wndClientArea.PostMessage(WM_MDIMAXIMIZE, LPARAM(hwndActive), 0L);
      ::BringWindowToTop(hwndActive);

      EnableMDITabs(TRUE, theApp.m_Options.m_bMDITabsIcons, theApp.m_Options.m_bTabsOnTop ? CMFCTabCtrl::LOCATION_TOP : CMFCTabCtrl::LOCATION_BOTTOM, theApp.m_Options.m_nTabsStyle);

      GetMDITabs().EnableAutoColor(theApp.m_Options.m_bTabsAutoColor);
      GetMDITabs().EnableTabDocumentsMenu(theApp.m_Options.m_bMDITabsDocMenu);
      GetMDITabs().EnableTabSwap(theApp.m_Options.m_bDragMDITabs);
      GetMDITabs().SetTabBorderSize(theApp.m_Options.m_nMDITabsBorderSize);
      GetMDITabs().SetFlatFrame(theApp.m_Options.m_bFlatFrame);
      GetMDITabs().EnableCustomToolTips(theApp.m_Options.m_bCustomTooltips);
      GetMDITabs().EnableCustomToolTips(theApp.m_Options.m_bCustomTooltips);
      GetMDITabs().EnableActiveTabCloseButton(theApp.m_Options.m_bActiveTabCloseButton);
      break;

CMDIFrameWndEx::EnableMDITabsLastActiveActivation

Specifies whether the last active tab should be opened when the user closes the current tab.

void EnableMDITabsLastActiveActivation(BOOL bLastActiveTab=TRUE);

Parameters

bLastActiveTab
[in] If TRUE, enable activation of the last active tab. If FALSE, disable activation of the last active tab.

Remarks

There are two ways to open a tab when the active tab is closed:

  • Activate the next tab.
  • Activate the previously active tab.

The default implementation uses the first way.

Use EnableMDITabsLastActiveActivation to enable the second way of tab activation. It emulates the way Windows opens MDI child windows.

CMDIFrameWndEx::EnablePaneMenu

Enables or disables automatic creation and management of the pop-up pane menu, which displays a list of application panes.

void EnablePaneMenu(
    BOOL bEnable,
    UINT uiCustomizeCmd,
    const CString& strCustomizeLabel,
    UINT uiViewToolbarsMenuEntryID,
    BOOL bContextMenuShowsToolbarsOnly=FALSE,
    BOOL bViewMenuShowsToolbarsOnly=FALSE);

Parameters

bEnable
[in] If TRUE, automatic handling of the pane menu is enabled; if FALSE, automatic handling is disabled.

uiCustomizeCmd
[in] Command ID of the Customize menu item. This menu item is usually added to the end of the list of panes.

strCustomizeLabel
[in] The text to be displayed for the Customize menu item (for localization).

uiViewToolbarsMenuEntryID
[in] Specifies the ID of a toolbar menu item that opens the pane menu. Usually this is the Toolbars submenu of the View menu.

bContextMenuShowsToolbarsOnly
[in] If TRUE, the pane menu displays only a list of toolbars. If FALSE, the menu displays a list of toolbars and docking bars.

bViewMenuShowsToolbarsOnly
[in] If TRUE, the pane menu displays only a list of toolbars. If FALSE, the menu displays a list of toolbars and docking bars.

Remarks

The pop-up pane menu displays the list of the application's panes and lets the user show or hide individual panes.

Example

The following example shows how EnablePaneMenu is used in the VisualStudioDemo Sample: MFC Visual Studio Application.

// Enable pane context menu(list of bars + customize command):
EnablePaneMenu(TRUE, ID_VIEW_CUSTOMIZE, _T("Customize..."), ID_VIEW_TOOLBARS, FALSE, TRUE);

CMDIFrameWndEx::EnableWindowsDialog

Inserts a menu item whose command ID calls a CMFCWindowsManagerDialog dialog box.

void EnableWindowsDialog(
    UINT uiMenuId,
    LPCTSTR lpszMenuText,
    BOOL bShowAllways=FALSE,
    BOOL bShowHelpButton=FALSE);

void EnableWindowsDialog(
    UINT uiMenuId,
    UINT uiMenuTextResId,
    BOOL bShowAllways=FALSE,
    BOOL bShowHelpButton=FALSE);

Parameters

uiMenuId
[in] Specifies the resource ID of a menu.

lpszMenuText
[in] Specifies the item's text.

bShowHelpButton
[in] Specifies whether to display a Help button on the windows management dialog box.

uiMenuTextResId
[in] The string resource identifier that contains the item's text string.

Remarks

Use this method to insert a menu item whose command calls an MDI child window management dialog box ( CMFCWindowsManagerDialog class). The new item is inserted into the menu specified by uiMenuId. Call EnableWindowsDialog when you process the WM_CREATE message.

Example

The following example shows how EnableWindowsDialog is used in the VisualStudioDemo Sample: MFC Visual Studio Application.

// Enable windows manager:
EnableWindowsDialog(ID_WINDOW_MANAGER, _T("Windows..."), TRUE);

CMDIFrameWndEx::GetActivePopup

Returns a pointer to the currently displayed popup menu.

CMFCPopupMenu* GetActivePopup() const;

Return value

A pointer to the active popup menu; NULL if no popup menu is active.

Remarks

Use this function to obtain a pointer to the CMFCPopupMenu class object that is currently displayed.

CMDIFrameWndEx::GetDefaultResId

Returns the ID of shared resources of the MDI frame window.

UINT GetDefaultResId() const;

Return value

A resource ID value. 0 if the frame window has no menu bar.

Remarks

This method returns the resource ID that was specified when the MDI frame window was loaded by CFrameWnd::LoadFrame.

CMDIFrameWndEx::GetMDITabGroups

Returns a list of MDI tabbed windows.

const CObList& GetMDITabGroups() const;

Return value

A reference to a CObList class object that contains a list of tabbed windows. Don't store or modify the list.

Remarks

Use this method to access the list of tabbed windows. It can be helpful if you want to change or query some parameters of individual tabbed windows.

CMDIFrameWndEx::GetMDITabs

Returns a reference to the underlined tabbed window.

CMFCTabCtrl& GetMDITabs();

Return value

A reference to the underlined tabbed window.

CMDIFrameWndEx::GetMDITabsContextMenuAllowedItems

Returns a combination of flags that determines what operations are valid when the MDI Tabbed Groups feature is enabled.

DWORD GetMDITabsContextMenuAllowedItems();

Return value

A bitwise "or" (|) combination of the following flags:

  • AFX_MDI_CREATE_VERT_GROUP - can create a vertical tab group.
  • AFX_MDI_CREATE_HORZ_GROUP - can create a horizontal tab group.
  • AFX_MDI_CAN_MOVE_PREV - can move a tab to the previous tab group.
  • AFX_MDI_CAN_MOVE_NEXT - can move a tab to the next tab group.

Remarks

When the MDI Tabbed Groups feature is enabled, you must know what operations are allowed on the tabs of a particular window. This method analyzes the current layout of tabbed windows and returns a combination of flags that can be used to build, for example, a shortcut menu.

You can create a new vertical tab group when all tabbed windows are aligned vertically, or when there's only one tabbed window.

You can create a new horizontal tab group when all tabbed windows are aligned horizontally, or when there's only one tabbed window.

You can move a tab to the previous group only if there's more than one tab in a tabbed window.

You can move a tab to the next group only if there's more than one tab in a tabbed window.

CMDIFrameWndEx::GetMenuBar

Returns a pointer to a menu bar object attached to the frame window.

const CMFCMenuBar* GetMenuBar() const;

Return value

A pointer to a menu bar object.

CMDIFrameWndEx::GetPane

Returns a pointer to the pane that has the specified control ID.

CBasePane* GetPane(UINT nID);

Parameters

nID
[in] The control ID.

Return value

A pointer to the pane that has the specified control ID, if it exists. Otherwise, NULL.

CMDIFrameWndEx::GetRibbonBar

Retrieves the ribbon bar control for the frame.

CMFCRibbonBar* GetRibbonBar();

Return value

Pointer to the CMFCRibbonBar class for the frame.

Remarks

CMDIFrameWndEx::GetTearOffBars

Returns a list of tear-off menus.

const CObList& GetTearOffBars() const;

Return value

A reference to a CObList class object that contains a collection of pointers to CPane-derived objects that are in a tear-off state.

Remarks

CMDIFrameWndEx maintains a collection of tear-off menus. Use this method to retrieve a reference to this list.

CMDIFrameWndEx::GetToolbarButtonToolTipText

Called by the framework when the application displays the tooltip for a toolbar button.

virtual BOOL GetToolbarButtonToolTipText(
    CMFCToolBarButton* pButton,
    CString& strTTText);

Parameters

pButton
[in] A pointer to a toolbar button.

strTTText
[in] The tooltip text to display for the button.

Return value

TRUE if the tooltip has been displayed. FALSE otherwise.

Remarks

CMDIFrameWndEx::InsertPane

Registers the specified pane with the docking manager.

BOOL InsertPane(
    CBasePane* pControlBar,
    CBasePane* pTarget,
    BOOL bAfter=TRUE);

Parameters

pControlBar
[in] A pointer to the pane to be inserted.

pTarget
[in] A pointer to the pane before or after which to insert the pane.

bAfter
[in] If TRUE, pControlBar is inserted after pTarget. If FALSE, pControlBar is inserted before pTarget.

Return value

TRUE if the method successfully registers the pane, FALSE if the pane was already registered with the docking manager.

Remarks

Use this method to tell the docking manager about a pane specified by pControlBar. The docking manager will align this pane according to the pane's alignment and position in the docking manager's internal list.

CMDIFrameWndEx::IsFullScreen

Determines whether the frame window is in full-screen mode.

BOOL IsFullScreen() const;

Return value

TRUE if the frame window is in full screen mode; otherwise FALSE.

Remarks

You can set the full screen mode by calling the CMDIFrameWndEx::EnableFullScreenMode method.

CMDIFrameWndEx::IsMDITabbedGroup

Specifies whether the MDI Tabbed Groups feature is enabled.

BOOL IsMDITabbedGroup() const;

Return value

TRUE if the MDI Tabbed Groups feature is enabled; otherwise FALSE.

Remarks

To determine whether regular MDI tabs or the MDI Tabbed Groups feature is enabled, use CMDIFrameWndEx::AreMDITabs.

CMDIFrameWndEx::IsMemberOfMDITabGroup

Determines whether the specified tabbed window is in the list of windows that are in MDI Tabbed Groups.

BOOL IsMemberOfMDITabGroup(CWnd* pWnd);

Parameters

pWnd
[in] A pointer to tabbed window.

Return value

TRUE if the specified tabbed window is in the list of tabbed windows that form MDI Tabbed Groups. Otherwise FALSE.

CMDIFrameWndEx::IsMenuBarAvailable

Determines whether the frame window has a menu bar.

BOOL IsMenuBarAvailable() const;

Return value

TRUE if the pointer to the menu bar object isn't NULL; otherwise FALSE.

CMDIFrameWndEx::IsPointNearDockSite

Determines whether a specified point is near the dock site.

BOOL IsPointNearDockSite(
    CPoint point,
    DWORD& dwBarAlignment,
    BOOL& bOuterEdge) const;

Parameters

point
[in] The specified point in screen coordinates.

dwBarAlignment
[in] Specifies which edge the point is near. Possible values are CBRS_ALIGN_LEFT, CBRS_ALIGN_RIGHT, CBRS_ALIGN_TOP, and CBRS_ALIGN_BOTTOM

bOuterEdge
[in] TRUE if the point is near the outer border of the dock site; FALSE otherwise.

Return value

TRUE if the point is near the dock site; otherwise FALSE.

Remarks

The point is near the dock site when it is within the sensitivity set in the docking manager. The default sensitivity is 15 pixels.

CMDIFrameWndEx::IsPrintPreview

Determines whether the frame window is in print-preview mode.

BOOL IsPrintPreview();

Return value

TRUE if the frame window is in print-preview mode; otherwise, FALSE.

Remarks

CMDIFrameWndEx::LoadFrame

Creates a frame window from resource information.

virtual BOOL LoadFrame(
    UINT nIDResource,
    DWORD dwDefaultStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE,
    CWnd* pParentWnd = NULL,
    CCreateContext* pContext = NULL);

Parameters

nIDResource
[in] The ID of a shared resource associated with the frame window.

dwDefaultStyle
[in] The style of the frame window.

pParentWnd
[in] A pointer to the frame's parent.

pContext
[in] A pointer to a CCreateContext Structure. This parameter can be NULL.

Return value

TRUE if the method succeeds, otherwise FALSE.

CMDIFrameWndEx::LoadMDIState

Loads the specified layout of MDI Tabbed Groups and the list of previously opened documents.

virtual BOOL LoadMDIState(LPCTSTR lpszProfileName);

Parameters

lpszProfileName
[in] Specifies the profile name.

Return value

TRUE if the load succeeded; FALSE if the load failed or there's no data to load.

Remarks

To load or save the state of MDI tabs and groups and the list of opened documents, do the following:

  • Call CMDIFrameWndEx::SaveMDIState when the main frame is being closed
  • Call CMDIFrameWndEx::LoadMDIState when the main frame is being created. The recommended place for this call is before the main frame is displayed for the first time. Add CWinAppEx::EnableLoadWindowPlacement (FALSE); before pMainFrame->LoadFrame (IDR_MAINFRAME);. Add CWinAppEx::ReloadWindowPlacement (pMainFrame); after the call to LoadMDIState to display the main frame at the position that was stored in the registry.
  • Override GetDocumentName in the CMDIChildWndEx- derived class if your application displays documents that aren't stored as files. The returned string will be saved in the registry as the document identifier. The base implementation of CMDIChildWndEx::GetDocumentName returns a value obtained from CDocument::GetPathName.
  • Override CMDIFrameWndEx::CreateDocumentWindow to correctly create documents when they're being loaded from the registry. The first parameter is the string that GetDocumentName returned.

Example

The following example shows how LoadMDIState is used in the VisualStudioDemo Sample: MFC Visual Studio Application.

// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);

if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew)
{
   if (!pMainFrame->LoadMDIState(GetRegSectionPath()))
   {
      m_pStartDocTemplate->OpenDocumentFile(NULL);
   }
}
else
{
   // Dispatch commands specified on the command line
   if (!ProcessShellCommand(cmdInfo))
   {
      return FALSE;
   }
}

CMDIFrameWndEx::MDITabMoveToNextGroup

Moves the active tab from the currently active tabbed window to the next or previous tabbed group.

void MDITabMoveToNextGroup(BOOL bNext=TRUE);

Parameters

bNext
[in] If TRUE, move the tab to the next tabbed group. If FALSE, move it to the previous tabbed group.

CMDIFrameWndEx::MDITabNewGroup

Creates a new tabbed group that has a single window.

void MDITabNewGroup(BOOL bVert=TRUE);

Parameters

bVert
[in] Specifies the new group alignment. If TRUE, the new group is aligned vertically. If FALSE, the new group is aligned horizontally.

Remarks

Use this function to create a new tabbed window (new tabbed group) and add the first tab to it.

Example

The following example shows how MDITabNewGroup is used in the VisualStudioDemo Sample: MFC Visual Studio Application.

void CMainFrame::OnMdiNewHorzTabGroup()
{
   MDITabNewGroup(FALSE);
}

CMDIFrameWndEx::m_bCanConvertControlBarToMDIChild

Specifies whether docking panes can be converted to MDI child windows.

BOOL m_bCanConvertControlBarToMDIChild;

Remarks

Indicates whether docking control bars can be converted to MDI child windows. If this flag is TRUE, the framework handles the conversion automatically when the user selects the Tabbed Document command. The flag is protected and you must explicitly enable this option either by setting m_bCanConvertControlBarToMDIChild in a constructor of a CMDIFrameWndEx-derived class, or by overriding CanConvertControlBarToMDIChild.

The default value is FALSE.

Example

The following example shows how m_bCanConvertControlBarToMDIChild is used in the VisualStudioDemo Sample: MFC Visual Studio Application.

CMainFrame::CMainFrame()
{
   CMFCPopupMenu::SetForceShadow(TRUE);
   m_bCanConvertControlBarToMDIChild = TRUE;
}

CMDIFrameWndEx::m_bDisableSetRedraw

Enables or disables redraw optimization for MDI child windows.

AFX_IMPORT_DATA static BOOL m_bDisableSetRedraw;

Remarks

The default value is TRUE.

Set this flag to FALSE if you want to optimize redrawing of MDI children. In this case, the framework will call SetRedraw (FALSE) for the main frame when the application is changing the active tab.

This flag can cause unwanted effects (such as background applications that become visible). Therefore we recommend that you change the default only if you experience noticeable flickering during MDI tab activation.

CMDIFrameWndEx::NegotiateBorderSpace

Negotiates border space in a frame window during OLE in-place activation.

virtual BOOL NegotiateBorderSpace(
    UINT nBorderCmd,
    LPRECT lpRectBorder);

Parameters

nBorderCmd
[in] Contains one of the following values from the enum CFrameWnd::BorderCmd:

  • borderGet = 1
  • borderRequest = 2
  • borderSet = 3

lpRectBorder
[in, out] Pointer to a RECT structure or a CRect class object that specifies the coordinates of the border.

Return value

Nonzero if the method was successful; otherwise 0.

Remarks

This method is an implementation of OLE border space negotiation.

CMDIFrameWndEx::OnCloseDockingPane

Called by the framework when the user clicks the Close button on a dockable pane.

virtual BOOL OnCloseDockingPane(CDockablePane* pWnd);

Parameters

pWnd
[in] Pointer to the pane being closed.

Return value

TRUE if the docking pane can be closed. Otherwise, FALSE.

Remarks

Override this method to handle hiding of docking panes. Return FALSE if you want to prevent a docking pane from being hidden.

The default implementation does nothing and returns TRUE.

CMDIFrameWndEx::OnCloseMiniFrame

Called by the framework when the user clicks the Close button on a floating mini-frame window.

virtual BOOL OnCloseMiniFrame(CPaneFrameWnd*);

Parameters

pWnd
[in] Pointer to the mini-frame window being closed.

Return value

TRUE if the floating mini-frame window can be closed. Otherwise, FALSE.

Remarks

Override this method to handle hiding of floating mini-frame windows. Return FALSE if you want to prevent a floating mini-frame window from being hidden.

The default implementation does nothing and returns TRUE.

CMDIFrameWndEx::OnClosePopupMenu

Called by the framework when an active pop-up menu processes a WM_DESTROY message.

virtual void OnClosePopupMenu(CMFCPopupMenu* pMenuPopup);

Parameters

pMenuPopup
[in] Pointer to a pop-up menu.

Remarks

Override this method if you want to process notifications from CMFCPopupMenu class objects that belong to the MDI frame window when those objects process WM_DESTROY messages.

CMDIFrameWndEx::OnCmdMsg

Called by the framework to route and dispatch command messages and to update command user-interface objects.

virtual BOOL OnCmdMsg(
    UINT nID,
    int nCode,
    void* pExtra,
    AFX_CMDHANDLERINFO* pHandlerInfo);

Parameters

nID
[in] The command ID.

nCode
[in] Identifies the command notification code. For more information about values for nCode, see CCmdTarget::OnCmdMsg.

pExtra
[in] Used according to the value of nCode. For more information about pExtra, see CCmdTarget::OnCmdMsg.

pHandlerInfo
[in, out] Typically, this parameter should be NULL. If not NULL, OnCmdMsg fills in the pTarget and pmf members of the pHandlerInfo structure instead of dispatching the command.

Return value

Nonzero if the message is handled; otherwise 0.

CMDIFrameWndEx::OnDrawMenuImage

Called by the framework when the image associated with a menu item is drawn.

virtual BOOL OnDrawMenuImage(
    CDC* pDC,
    const CMFCToolBarMenuButton* pMenuButton,
    const CRect& rectImage);

Parameters

pDC
[in] Pointer to a device context.

pMenuButton
[in] Pointer to the menu button.

rectImage
[in] Bounding rectangle of the image.

Return value

TRUE if the method draws the image. The default implementation returns FALSE.

Remarks

Override this method if you want to customize image rendering for the menu items that belong to the menu bar owned by the CMDIFrameWndEx-derived object. The default implementation does nothing.

Called by the framework when a CMFCPopupMenuprocesses a WM_PAINT message.

virtual void OnDrawMenuLogo(
    CDC*,
    CMFCPopupMenu*,
    const CRect&);

Remarks

Override this function to display a logo on the pop-up menu that belongs to the menu bar owned by the CMDIFrameWndEx-derived object. The default implementation does nothing.

CMDIFrameWndEx::OnEraseMDIClientBackground

Called by the framework when the MDI frame window processes a WM_ERASEBKGND message.

virtual BOOL OnEraseMDIClientBackground(CDC*);

Return value

TRUE if the application processes the message and erases the background.

Remarks

Override this member function if you want to process the WM_ERASEBKGND message in a CMDIFrameWndEx-derived class.

CMDIFrameWndEx::OnMenuButtonToolHitTest

Called by the framework when a CMFCToolBarButtonobject processes a WM_NCHITTEST message.

virtual BOOL OnMenuButtonToolHitTest(
    CMFCToolBarButton* pButton,
    TOOLINFO* pTI);

Parameters

pButton
[in] The toolbar button.

pTI
[out] Pointer to a TOOLINFO structure.

Return value

TRUE if the application fills the pTI parameter. The default implementation returns FALSE.

Remarks

Override this method if you want to provide information about specific menu items to a tooltip. The default implementation does nothing.

CMDIFrameWndEx::OnMoveMiniFrame

Called by the framework to move a mini-frame window.

virtual BOOL OnMoveMiniFrame(CWnd* pFrame);

Parameters

pFrame
[in] A pointer to a mini-frame window.

Return value

TRUE if the method succeeds, otherwise FALSE.

CMDIFrameWndEx::OnSetPreviewMode

Sets the application's main frame window print-preview mode.

virtual void OnSetPreviewMode(
    BOOL bPreview,
    CPrintPreviewState* pState);

Parameters

bPreview
[in] If TRUE, sets print-preview mode. If FALSE, cancels preview mode.

pState
[in] A pointer to a CPrintPreviewState structure.

Remarks

This method overrides CFrameWnd::OnSetPreviewMode.

CMDIFrameWndEx::OnShowCustomizePane

Called by the framework when a Quick Customize pane is activated.

virtual BOOL OnShowCustomizePane(
    CMFCPopupMenu* pMenuPane,
    UINT uiToolbarID);

Parameters

pMenuPane
[in] A pointer to the Quick Customize pane.

uiToolbarID
[in] Control ID of the toolbar to customize.

Return value

This method always returns TRUE.

Remarks

The Quick Customize pane is a menu that opens when the user clicks Customize on a toolbar.

Override this method in a derived class to make changes in the Quick Customize pane.

CMDIFrameWndEx::OnShowMDITabContextMenu

Called by the framework before a shortcut menu is displayed on one of the tabs. Valid for MDI Tabbed Groups only.

virtual BOOL OnShowMDITabContextMenu(
    CPoint point,
    DWORD dwAllowedItems,
    BOOL bTabDrop);

Parameters

point
[in] The location of the menu in screen coordinates.

dwAllowedItems
[in] A bitwise "or" (|) combination of flags that indicates what actions are allowed for the current tab:

  • AFX_MDI_CREATE_VERT_GROUP - can create a vertical tab group.
  • AFX_MDI_CREATE_HORZ_GROUP - can create a horizontal tab group.
  • AFX_MDI_CAN_MOVE_PREV - can move a tab to the previous tab group.
  • AFX_MDI_CAN_MOVE_NEXT - can move a tab to the next tab group.
  • AFX_MDI_CAN_BE_DOCKED - switch a tabbed document to docked state (relevant for tabbed documents only).

bTabDrop
[in] TRUE to display the menu as a result of dragging the tab onto another tabbed group. FALSE to display the menu as a shortcut menu on the currently active tab.

Return value

Override this method in a CMDIFrameWndEx-derived class.

Remarks

If you don't process OnShowMDITabContextMenu, the shortcut menu won't be displayed. This function is generated by the MFC Application Wizard when you enable the MDI Tabbed Groups feature.

Example

The following example shows how OnShowMDITabContextMenu is used in the VisualStudioDemo Sample: MFC Visual Studio Application.

BOOL CMainFrame::OnShowMDITabContextMenu(CPoint point, DWORD dwAllowedItems, BOOL bDrop)
{
   CMenu menu;
   VERIFY(menu.LoadMenu(bDrop ? IDR_POPUP_DROP_MDITABS : IDR_POPUP_MDITABS));

   CMenu* pPopup = menu.GetSubMenu(0);
   ASSERT(pPopup != NULL);

   if ((dwAllowedItems & AFX_MDI_CREATE_HORZ_GROUP) == 0)
   {
      pPopup->DeleteMenu(ID_MDI_NEW_HORZ_TAB_GROUP, MF_BYCOMMAND);
   }

   if ((dwAllowedItems & AFX_MDI_CREATE_VERT_GROUP) == 0)
   {
      pPopup->DeleteMenu(ID_MDI_NEW_VERT_GROUP, MF_BYCOMMAND);
   }

   if ((dwAllowedItems & AFX_MDI_CAN_MOVE_NEXT) == 0)
   {
      pPopup->DeleteMenu(ID_MDI_MOVE_TO_NEXT_GROUP, MF_BYCOMMAND);
   }

   if ((dwAllowedItems & AFX_MDI_CAN_MOVE_PREV) == 0)
   {
      pPopup->DeleteMenu(ID_MDI_MOVE_TO_PREV_GROUP, MF_BYCOMMAND);
   }

   if ((dwAllowedItems & AFX_MDI_CAN_BE_DOCKED) == 0)
   {
      pPopup->DeleteMenu(ID_MDI_TABBED_DOCUMENT, MF_BYCOMMAND);
   }

   CMFCPopupMenu* pPopupMenu = new CMFCPopupMenu;
   pPopupMenu->SetAutoDestroy(FALSE);
   pPopupMenu->Create(this, point.x, point.y, pPopup->GetSafeHmenu());

   return TRUE;
}

CMDIFrameWndEx::OnShowPanes

Called by the framework to show or hide panes.

virtual BOOL OnShowPanes(BOOL bShow);

Parameters

bShow
[in] TRUE to show panes, FALSE to hide panes.

Return value

TRUE if the state of the panes changes as a result of calling this method, FALSE if the panes are already in the state specified by bShow. For example, if the panes are hidden and bShow is FALSE, the Return value is FALSE.

Remarks

The default implementation removes the toolbar from the top-level frame window.

If CDockingManager::m_bHideDockingBarsInContainerMode is TRUE (the default), all docking panes will be hidden.

CMDIFrameWndEx::OnShowPopupMenu

Called by the framework when it opens a pop-up menu.

virtual BOOL OnShowPopupMenu(CMFCPopupMenu*);

Return value

TRUE if the pop-up menu is to be displayed. Otherwise, FALSE. The default implementation returns TRUE.

Remarks

Override this method if you want to implement special processing upon pop-up menu activation. For example, if you want to change regular menu items to color menu buttons, set up tear-off bars, and so on.

The default implementation does nothing.

CMDIFrameWndEx::OnSizeMDIClient

Called by the framework when the size of the client MDI window is changing.

virtual void OnSizeMDIClient(
    const CRect& rectOld,
    const CRect& rectNew);

Parameters

rectOld
[in] The current size of the MDI client window.

rectNew
[in] The new size of the MDI client window.

Remarks

CMDIFrameWndEx::OnTearOffMenu

Called by the framework when a menu that has a tear-off bar is activated.

virtual BOOL OnTearOffMenu(
    CMFCPopupMenu* pMenuPopup,
    CPane* pBar);

Parameters

pMenuPopup
[in] A pointer to the pop-up menu.

pBar
[in] A pointer to the tear-off bar.

Return value

TRUE to allow the pop-up menu with the tear-off bar to be made activate; otherwise FALSE. The default is TRUE.

Remarks

Override this function when you want to implement a special setup for the tear-off bar. The default implementation does nothing.

CMDIFrameWndEx::OnUpdateFrameMenu

Called by the framework to update the frame menu.

virtual void OnUpdateFrameMenu(HMENU hMenuAlt);

Parameters

hMenuAlt
[in] A handle to a menu.

CMDIFrameWndEx::PaneFromPoint

Returns the docking pane that contains the specified point.

CBasePane* PaneFromPoint(
    CPoint point,
    int nSensitivity,
    bool bExactBar,
    CRuntimeClass* pRTCBarType) const;

CBasePane* PaneFromPoint(
    CPoint point,
    int nSensitivity,
    DWORD& dwAlignment,
    CRuntimeClass* pRTCBarType) const;

Parameters

point
[in] The point (in screen coordinates).

nSensitivity
[in] The window rectangle of each checked pane is enlarged in all directions by this value.

bExactBar
[in] If TRUE, the nSensitivity parameter is ignored.

pRTCBarType
[in] If non- NULL, the method iterates over only the panes of the specified type.

dwAlignment
[out] If a pane is found, this parameter will specify which side of the pane is closest to the specified point.

Return value

A pointer to a docking pane, or NULL if no control contains the point specified by point.

Remarks

The call is redirected to the CDockingManager class. For more information, see CDockingManager::ControlBarFromPoint.

CMDIFrameWndEx::RecalcLayout

Called by the framework to recalculate the layout of the frame window.

virtual void RecalcLayout(BOOL bNotify = TRUE);

Parameters

bNotify
[in] Determines whether the active in-place item for the frame window receives notification of the layout change. If TRUE, the item is notified; otherwise FALSE.

Remarks

This method overrides CFrameWnd::RecalcLayout.

CMDIFrameWndEx::RemovePaneFromDockManager

Unregisters a pane and removes it from the docking manager.

void RemovePaneFromDockManager(
    CBasePane* pControlBar,
    BOOL bDestroy,
    BOOL bAdjustLayout,
    BOOL bAutoHide,
    CBasePane* pBarReplacement);

Parameters

pControlBar
[in] A pointer to a pane to be removed.

bDestroy
[in] TRUE to destroy the removed pane. FALSE to not destroy it.

bAdjustLayout
[in] TRUE to adjust the docking layout immediately. If FALSE, the adjustment will occur only when a redraw event occurs for other reasons (the user resizes the window, drags the main frame, etc.).

bAutoHide
[in] TRUE to remove the pane from the list of autohide panes. FALSE to remove the pane from the list of regular panes.

pBarReplacement
[in] A pointer to a pane that replaces the removed pane.

Remarks

You must register each pane with the docking manager to take part in the docking layout. Use CMDIFrameWndEx::AddPane or CMDIFrameWndEx::InsertPane to register panes.

Use this method when a pane is no longer a part of the docking layout of the frame window.

CMDIFrameWndEx::SaveMDIState

Saves the current layout of MDI Tabbed Groups and the list of previously opened documents.

virtual BOOL SaveMDIState(LPCTSTR lpszProfileName);

Parameters

lpszProfileName
[in] Specifies the profile name.

Return value

TRUE if the save succeeded; FALSE if the save failed.

Remarks

To load or save the state of MDI tabs and groups and the list of opened documents, do the following:

  • Call SaveMDIState when the main frame is being closed
  • Call CMDIFrameWndEx::LoadMDIState when the main frame is being created. The recommended location for this call is before the main frame is displayed for the first time.
  • Call CWinAppEx::EnableLoadWindowPlacement(FALSE); before pMainFrame->LoadFrame (IDR_MAINFRAME);
  • Call CWinAppEx::ReloadWindowPlacement(pMainFrame) after LoadMDIState to display the main frame at the position that was stored in the registry.
  • Override GetDocumentName in the CMDIChildWndEx- derived class if your application displays documents that aren't stored as files. The returned string will be saved in the registry as a document identifier. For more information, see CMDIChildWndEx::GetDocumentName.
  • Override CMDIFrameWndEx::CreateDocumentWindow to correctly create documents when they're loaded from the registry. The parameter to CreateDocumentWindow is the string that GetDocumentName returned earlier.

Example

The following example shows how SaveMDIState is used in the VisualStudioDemo Sample: MFC Visual Studio Application.

void CMainFrame::OnClose()
{
   SaveMDIState(theApp.GetRegSectionPath());
   CMDIFrameWndEx::OnClose();
}

CMDIFrameWndEx::SetPrintPreviewFrame

Sets the print preview frame window.

void SetPrintPreviewFrame(CFrameWnd* pWnd);

Parameters

pWnd
[in] Pointer to a print preview frame window.

Remarks

CMDIFrameWndEx::SetupToolbarMenu

Modifies a toolbar object by replacing dummy items with user-defined items.

void SetupToolbarMenu(
    CMenu& menu,
    const UINT uiViewUserToolbarCmdFirst,
    const UINT uiViewUserToolbarCmdLast);

Parameters

menu
[in] A reference to a CMenu class object to be modified.

uiViewUserToolbarCmdFirst
[in] Specifies the first user-defined command.

uiViewUserToolbarCmdLast
[in] Specifies the last user-defined command.

CMDIFrameWndEx::ShowFullScreen

Switches the main frame from regular mode to full-screen mode.

void ShowFullScreen();

Remarks

CMDIFrameWndEx::ShowPane

Shows or hides the specified pane.

void ShowPane(
    CBasePane* pBar,
    BOOL bShow,
    BOOL bDelay,
    BOOL bActivate);

Parameters

pBar
[in] Pointer to the pane to be shown or hidden.

bShow
[in] TRUE to show the pane. FALSE to hide the pane.

bDelay
[in] TRUE to delay the recalculation of the docking layout. FALSE to recalculate the docking layout immediately.

bActivate
[in] TRUE to show the pane as active. FALSE to show the pane as inactive.

Remarks

Call this method to show or hide the pane. Don't use ShowWindow for docking panes.

Example

The following example shows how ShowPane is used in the VisualStudioDemo Sample: MFC Visual Studio Application.

void COutputList1::OnViewOutput()
{
   CBasePane* pParentBar = DYNAMIC_DOWNCAST(CBasePane, GetOwner());
   CFrameWndEx* pMainFrame = DYNAMIC_DOWNCAST(CFrameWndEx, GetTopLevelFrame());

   if (pMainFrame != NULL && pParentBar != NULL)
   {
      pMainFrame->SetFocus();
      pMainFrame->ShowPane(pParentBar, FALSE, FALSE, FALSE);
   }
}

CMDIFrameWndEx::ShowWindowsDialog

Creates a CMFCWindowsManagerDialog box and opens it.

void ShowWindowsDialog();

Example

The following example shows how ShowWindowsDialog is used in the VisualStudioDemo Sample: MFC Visual Studio Application.

void CMainFrame::OnWindowManager()
{
   ShowWindowsDialog();
}

CMDIFrameWndEx::TabbedDocumentToControlBar

Converts the specified tabbed document to a docking pane.

virtual BOOL TabbedDocumentToControlBar(CMDIChildWndEx* pMDIChildWnd);

Parameters

pMDIChildWnd
A pointer to MDI child window that contains a docking pane.

Return value

TRUE if the method was successful, FALSE on failure.

Remarks

Use this method to convert a tabbed document to a docking pane. The tabbed document must have been created by using CMDIFrameWndEx::ControlBarToTabbedDocument.

Example

The following example shows how TabbedDocumentToControlBar is used in the VisualStudioDemo Sample: MFC Visual Studio Application.

void CMainFrame::OnMdiTabbedDocument()
{
   CMDIChildWndEx* pMDIChild = DYNAMIC_DOWNCAST(CMDIChildWndEx, MDIGetActive());
   if (pMDIChild == NULL)
   {
      ASSERT(FALSE);
      return;
   }

   TabbedDocumentToControlBar(pMDIChild);
}

CMDIFrameWndEx::UpdateCaption

Called by the framework to update the window frame caption.

void UpdateCaption();

Remarks

CMDIFrameWndEx::UpdateMDITabbedBarsIcons

Sets the icon for each MDI tabbed pane.

void UpdateMDITabbedBarsIcons();

CMDIFrameWndEx::WinHelp

Called by the framework to initiate the WinHelp application or context help.

virtual void WinHelp(
    DWORD dwData,
    UINT nCmd = HELP_CONTEXT);

Parameters

dwData
[in] Specifies data as required for the type of help specified by nCmd.

nCmd
[in] Specifies the type of help requested. For more information about the possible values and how they affect the dwData parameter, see WinHelp.

Remarks

This method overrides CWnd::WinHelp.

See also

Hierarchy Chart
Classes
CMDIFrameWnd class
CMDIChildWndEx class