CFrameWndEx
Class
Implements the functionality of a Windows single document interface (SDI) overlapped or popup frame window, and provides members for managing the window. It extends the CFrameWnd
class.
class CFrameWndEx : public CFrameWnd
Name | Description |
---|---|
CFrameWndEx::ActiveItemRecalcLayout |
Adjusts the layout of the OLE client item and the frame's client area. |
CFrameWndEx::AddDockSite |
This method isn't used. |
CFrameWndEx::AddPane |
Registers a control bar with the docking manager. |
CFrameWndEx::AdjustDockingLayout |
Recalculates the layout of all panes that are docked to the frame window. |
CFrameWndEx::DelayUpdateFrameMenu |
Sets the frame menu and then updates it when command processing is idle. |
CFrameWndEx::DockPane |
Docks the specified pane to the frame window. |
CFrameWndEx::DockPaneLeftOf |
Docks one pane to the left of another pane. |
CFrameWndEx::EnableAutoHidePanes |
Enables the auto-hide mode for the panes when they're docked to the specified sides of the main frame window. |
CFrameWndEx::EnableDocking |
Enables the docking of the panes that belong to the frame window. |
CFrameWndEx::EnableFullScreenMainMenu |
Shows or hides the main menu in a full screen mode. |
CFrameWndEx::EnableFullScreenMode |
Enables the full screen mode for the frame window. |
CFrameWndEx::EnableLoadDockState |
Enables or disables the loading of the docking state. |
CFrameWndEx::EnablePaneMenu |
Enables or disables the automatic handling of the pane menu. |
CFrameWndEx::GetActivePopup |
Returns a pointer to the currently displayed pop-up menu. |
CFrameWndEx::GetDefaultResId |
Returns the resource ID that you specified when the framework loaded the frame window. |
CFrameWndEx::GetDockingManager |
Retrieves the CDockingManager Class object for the frame window. |
CFrameWndEx::GetMenuBar |
Returns a pointer to the menu bar object attached to the frame window. |
CFrameWndEx::GetPane |
Returns a pointer to the pane that has the specified ID. |
CFrameWndEx::GetRibbonBar |
Retrieves the ribbon bar control for the frame. |
CFrameWndEx::GetTearOffBars |
Returns a list of pane objects that are in a tear-off state. |
CFrameWndEx::GetToolbarButtonToolTipText |
Called by the framework when the application displays the tooltip for a toolbar button. |
CFrameWndEx::InsertPane |
Registers a pane with the docking manager. |
CFrameWndEx::IsFullScreen |
Determines whether the frame window is in full screen mode. |
CFrameWndEx::IsMenuBarAvailable |
Determines whether the pointer to the menu bar object is valid. |
CFrameWndEx::IsPointNearDockSite |
Indicates whether the point is located in an alignment zone. |
CFrameWndEx::IsPrintPreview |
Indicates whether the frame window is in print preview mode. |
CFrameWndEx::LoadFrame |
This method is called after construction to create the frame window and load its resources. |
CFrameWndEx::NegotiateBorderSpace |
Implements OLE client border negotiation. |
CFrameWndEx::OnActivate |
The framework calls this method when user input is switched to or away from the frame. |
CFrameWndEx::OnActivateApp |
Called by the framework when the application is either selected or deselected. |
CFrameWndEx::OnChangeVisualManager |
Called by the framework when a change to the frame requires a change to the visual manager. |
CFrameWndEx::OnClose |
The framework calls this method to close the frame. |
CFrameWndEx::OnCloseDockingPane |
Called by the framework when the user clicks the Close button on a docking pane. |
CFrameWndEx::OnCloseMiniFrame |
Called by the framework when the user clicks the Close button on a floating mini frame window. |
CFrameWndEx::OnClosePopupMenu |
Called by the framework when an active pop-up menu processes a WM_DESTROY message. |
CFrameWndEx::OnCmdMsg |
Dispatches command messages. |
CFrameWndEx::OnContextHelp |
Called by the framework to display context related help. |
CFrameWndEx::OnCreate |
Called by the framework after the frame is created. |
CFrameWndEx::OnDestroy |
Called by the framework when the frame is destroyed. |
CFrameWndEx::OnDrawMenuImage |
Called by the framework when the application draws the image associated with a menu item. |
CFrameWndEx::OnDrawMenuLogo |
Called by the framework when a CMFCPopupMenu object processes a WM_PAINT message. |
CFrameWndEx::OnDWMCompositionChanged |
Called by the framework when Desktop Window Manager (DWM) composition has been enabled or disabled. |
CFrameWndEx::OnExitSizeMove |
Called by the framework when the frame stops moving or resizing. |
CFrameWndEx::OnGetMinMaxInfo |
Called by the framework when the frame is resized to set window dimension limits. |
CFrameWndEx::OnIdleUpdateCmdUI |
Called by the framework to update the frame display when command processing is idle. |
CFrameWndEx::OnLButtonDown |
The framework calls this method when the user presses the left mouse button. |
CFrameWndEx::OnLButtonUp |
The framework calls this method when the user releases the left mouse button. |
CFrameWndEx::OnMenuButtonToolHitTest |
Called by the framework when a CMFCToolBarButton object processes a WM_NCHITTEST message. |
CFrameWndEx::OnMenuChar |
Called by the framework when a menu is displayed and the user presses a key that doesn't correspond to a command. |
CFrameWndEx::OnMouseMove |
The framework calls this method when the pointer moves. |
CFrameWndEx::OnMoveMiniFrame |
Called by the framework when a pane window moves. |
CFrameWndEx::OnNcActivate |
Called by the framework when the non-client area of the frame must be redrawn to indicate a change in the active state. |
CFrameWndEx::OnNcCalcSize |
Called by the framework when the size and position of the client area must be calculated. |
CFrameWndEx::OnNcHitTest |
Called by the framework when the pointer moves or when a mouse button is pressed or released. |
CFrameWndEx::OnNcMouseMove |
Called by the framework when the pointer moves in a non-client area. |
CFrameWndEx::OnNcPaint |
Called by the framework when the non-client area must be painted. |
CFrameWndEx::OnPaneCheck |
Called by the framework to control the visibility of a pane. |
CFrameWndEx::OnPostPreviewFrame |
Called by the framework when the user has changed the print preview mode. |
CFrameWndEx::OnPowerBroadcast |
Called by the framework when a power management event occurs. |
CFrameWndEx::OnSetMenu |
Called by the framework to replace the frame window menu. |
CFrameWndEx::OnSetPreviewMode |
Called by the framework to set the print preview mode for the frame. |
CFrameWndEx::OnSetText |
Called by the framework to set the text of a window. |
CFrameWndEx::OnShowCustomizePane |
Called by the framework when a quick customize pane is enabled. |
CFrameWndEx::OnShowPanes |
Called by the framework to show or hide panes. |
CFrameWndEx::OnShowPopupMenu |
Called by the framework when a pop-up menu is enabled. |
CFrameWndEx::OnSize |
The framework calls this method after the frame's size changes. |
CFrameWndEx::OnSizing |
The framework calls this method when the user resizes the frame. |
CFrameWndEx::OnSysColorChange |
Called by the framework when the system colors change. |
CFrameWndEx::OnTearOffMenu |
Called by the framework when a menu that has a tear-off bar is enabled. |
CFrameWndEx::OnToolbarContextMenu |
Called by the framework to build a toolbar context menu. |
CFrameWndEx::OnToolbarCreateNew |
The framework calls this method to create a new toolbar. |
CFrameWndEx::OnToolbarDelete |
Called by the framework when a toolbar is deleted. |
CFrameWndEx::OnUpdateFrameMenu |
Called by the framework to set the frame menu. |
CFrameWndEx::OnUpdateFrameTitle |
The framework calls this method to update the title bar of the frame window. |
CFrameWndEx::OnUpdatePaneMenu |
Called by the framework to update the pane menu. |
CFrameWndEx::OnWindowPosChanged |
Called by the framework when the frame size, position, or z-order has changed because of a call to a window management method. |
CFrameWndEx::PaneFromPoint |
Returns the docking pane that contains the specified point. |
CFrameWndEx::PreTranslateMessage |
Handles specific window messages before they're dispatched. |
CFrameWndEx::RecalcLayout |
Adjusts the layout of the frame and its child windows. |
CFrameWndEx::RemovePaneFromDockManager |
Unregisters a pane and removes it from the internal list in the docking manager. |
CFrameWndEx::SetDockState |
Restores the docking layout to the docking state stored in the registry. |
CFrameWndEx::SetPrintPreviewFrame |
Sets the print preview frame window. |
CFrameWndEx::SetupToolbarMenu |
Inserts user-defined commands into a toolbar menu. |
CFrameWndEx::ShowFullScreen |
Switches the main frame between the full screen and the regular modes. |
CFrameWndEx::ShowPane |
Shows or hides the specified pane. |
CFrameWndEx::UpdateCaption |
Called by the framework to update the window frame caption. |
CFrameWndEx::WinHelp |
Invokes either the WinHelp application or context related help. |
The following example demonstrates how to inherit a class from the CFrameWndEx
class. The example illustrates the method signatures in the subclass, and how to override the OnShowPopupMenu
method. This code snippet is part of the Word Pad sample.
class CMainFrame : public CFrameWndEx
{
protected: // create from serialization only
CMainFrame();
DECLARE_DYNCREATE(CMainFrame)
// Attributes
public:
HICON m_hIconDoc;
HICON m_hIconText;
HICON m_hIconWrite;
HICON GetIcon(int nDocType);
// Operations
public:
void UpdateMRUFilesList()
{
m_wndTaskPane.UpdateMRUFilesList();
}
void OnChangeLook();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame)
public:
virtual void ActivateFrame(int nCmdShow = -1);
virtual BOOL LoadFrame(UINT nIDResource,
DWORD dwDefaultStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE,
CWnd *pParentWnd = NULL,
CCreateContext *pContext = NULL);
protected:
virtual BOOL PreCreateWindow(CREATESTRUCT &cs);
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
//}}AFX_VIRTUAL
virtual BOOL OnShowPopupMenu(CMFCPopupMenu *pMenuPopup);
virtual BOOL OnTearOffMenu(CMFCPopupMenu *pMenuPopup, CPane *pBar);
protected:
void AdjustObjectSubmenu(CMFCPopupMenu *pMenuPopup);
void AdjustColorsMenu(CMFCPopupMenu *pMenuPopup, UINT uiId);
// Implementation
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext &dc) const;
#endif
public:
CMFCMenuBar m_wndMenuBar;
CMFCToolBar m_wndToolBar;
CMFCStatusBar m_wndStatusBar;
CFormatBar m_wndFormatBar;
CRulerBar m_wndRulerBar;
CTaskPane m_wndTaskPane;
protected: // control bar embedded members
BOOL CreateMenuBar();
BOOL CreateToolBar();
BOOL CreateFormatBar();
BOOL CreateStatusBar();
BOOL CreateRulerBar();
BOOL CreateTaskPane();
// Generated message map functions
protected:
//{{AFX_MSG(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSysColorChange();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnMove(int x, int y);
afx_msg void OnHelpFinder();
afx_msg void OnDropFiles(HDROP hDropInfo);
afx_msg void OnFontChange();
afx_msg BOOL OnQueryNewPalette();
afx_msg void OnPaletteChanged(CWnd *pFocusWnd);
afx_msg void OnDevModeChange(LPTSTR lpDeviceName);
afx_msg void OnViewCustomize();
afx_msg void OnViewFullScreen();
//}}AFX_MSG
afx_msg LRESULT OnBarState(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnOpenMsg(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnHelpCustomizeToolbars(WPARAM wp, LPARAM lp);
afx_msg LRESULT OnStartCustomize(WPARAM wp, LPARAM lp);
afx_msg LRESULT OnToolbarCreateNew(WPARAM, LPARAM);
afx_msg LRESULT OnGetDocumentColors(WPARAM, LPARAM);
afx_msg void OnDummy();
afx_msg void OnAskQuestion();
DECLARE_MESSAGE_MAP()
};
// CMainFrame is application-defined object of type CFrameWndEx
BOOL CMainFrame::OnShowPopupMenu(CMFCPopupMenu *pMenuPopup)
{
BOOL bRes = CFrameWndEx::OnShowPopupMenu(pMenuPopup);
if (pMenuPopup != NULL && !pMenuPopup->IsCustomizePane())
{
AdjustObjectSubmenu(pMenuPopup);
AdjustColorsMenu(pMenuPopup, ID_CHAR_COLOR);
}
return bRes;
}
Header: afxframewndex.h
Adjusts the layout of the OLE client item and the frame's client area.
void ActiveItemRecalcLayout();
Registers a control bar with the docking manager.
BOOL AddPane(
CBasePane* pControlBar,
BOOL bTail=TRUE);
pControlBar
[in] A control bar pane to register.
bTail
[in] TRUE
if you want to add the control bar pane to the end of the list; FALSE
otherwise.
TRUE
if the control bar was successfully registered; FALSE
otherwise.
Recalculates the layout of all panes that are docked to the frame window.
virtual void AdjustDockingLayout(HDWP hdwp=NULL);
hdwp
A handle to a structure that contains the positions of multiple windows. .
The hdwp structure is initialized by the BeginDeferWindowPos
method.
Sets the frame menu and then updates it when command processing is idle.
virtual void DelayUpdateFrameMenu(HMENU hMenuAlt);
hMenuAlt
[in] Handle to an alternative menu.
Docks the specified pane to the frame window.
void DockPane(
CBasePane* pBar,
UINT nDockBarID=0,
LPCRECT lpRect=NULL);
pBar
[in] A pointer to the control bar to be docked.
nDockBarID
[in] The ID of the side of the frame window to dock to.
lpRect
[in] A pointer to a constant Rect
structure that specifies the window's screen position and size.
The nDockBarID
parameter can have one of the following values:
AFX_IDW_DOCKBAR_TOP
AFX_IDW_DOCKBAR_BOTTOM
AFX_IDW_DOCKBAR_LEFT
AFX_IDW_DOCKBAR_RIGHT
Docks the specified pane to the left of another pane.
BOOL DockPaneLeftOf(
CPane* pBar,
CPane* pLeftOf);
pBar
[in] A pointer to the pane object to be docked.
pLeftOf
[in] A pointer to the pane to the left of which to dock the pane specified by pBar
.
TRUE
if pBar
is docked successfully. FALSE
otherwise.
The method takes the toolbar specified by the pBar
parameter and docks it at the left side of the toolbar specified by pLeftOf
parameter.
Enables auto-hide mode for the pane when it's docked to the specified side of the main frame window.
BOOL EnableAutoHidePanes(DWORD dwDockStyle);
dwDockStyle
[in] Specifies the side of the main frame window to which to dock the pane.
TRUE
if a bar pane is successfully docked to the frame window side that is specified by dwDockStyle
, FALSE
otherwise.
dwDockStyle
can have one of the following values:
CBRS_ALIGN_TOP
: allows the control bar to be docked to the top of the client area of a frame window.CBRS_ALIGN_BOTTOM
: allows the control bar to be docked to the bottom of the client area of a frame window.CBRS_ALIGN_LEFT
: allows the control bar to be docked to the left side of the client area of a frame window.CBRS_ALIGN_RIGHT
: allows the control bar to be docked to the right side of the client area of a frame window.
Enables the docking of the panes of the frame window.
BOOL EnableDocking(DWORD dwDockStyle);
dwDockStyle
[in] Specifies the side of the main frame window where the pane bar docks.
TRUE
if a bar pane can be successfully docked at the specified side. FALSE
otherwise.
The dwDockStyle
parameter can have one of the following values:
CBRS_ALIGN_TOP
CBRS_ALIGN_BOTTOM
CBRS_ALIGN_LEFT
CBRS_ALIGN_RIGHT
Shows or hides the main menu in a full screen mode.
void EnableFullScreenMainMenu(BOOL bEnableMenu);
bEnableMenu
[in] TRUE
to show the main menu in a full screen mode, FALSE
otherwise.
Enables the full-screen mode for the frame window.
void EnableFullScreenMode(UINT uiFullScreenCmd);
uiFullScreenCmd
[in] The ID of a command that enables and disables the full screen mode.
In the full-screen mode, all docking control bars, toolbars and menu are hidden and the active view is resized to occupy the full-screen.
When you enable the full-screen mode, you must specify an ID of the command that enables or disables the full-screen mode. You can call EnableFullScreenMode
from the main frame's OnCreate
function. When a frame window is being switched to a 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 CFrameWndEx::EnableFullScreenMainMenu
.
Enables or disables the loading of the docking state.
void EnableLoadDockState(BOOL bEnable=TRUE);
bEnable
[in] TRUE
to enable the loading of the docking state, FALSE
to disable the loading of the docking state.
Enables or disables the automatic handling of the pane menu.
void EnablePaneMenu(
BOOL bEnable,
UINT uiCustomizeCmd,
const CString& strCustomizeLabel,
UINT uiViewToolbarsMenuEntryID,
BOOL bContextMenuShowsToolbarsOnly=FALSE,
BOOL bViewMenuShowsToolbarsOnly=FALSE);
bEnable
[in] TRUE
to enable the automatic handling of the control bar pop-up menus; FALSE
to disable the automatic handling of the control bar pop-up menus.
uiCustomizeCmd
[in] The command ID of the Customize menu item.
strCustomizeLabel
[in] The label to be displayed for the Customize menu item
uiViewToolbarsMenuEntryID
[in] The ID of a toolbar menu item that opens the pop-up menu in the control bar.
bContextMenuShowsToolbarsOnly
[in] If TRUE
, the control bar context menu displays the list of toolbars only. If FALSE
, the menu displays the list of the toolbars and the docking bars.
bViewMenuShowsToolbarsOnly
[in] If TRUE
, the control bar menu displays the list of the toolbars only. If FALSE
, the menu displays the list of the toolbars and the docking bars.
Returns a pointer to the currently displayed pop-up menu.
CMFCPopupMenu* GetActivePopup() const;
A pointer to the currently displayed pop-up menu; otherwise NULL
.
Returns the resource ID that you specified when the framework loaded the frame window.
UINT GetDefaultResId() const;
The resource ID value that the user specified when the framework loaded the frame window. Zero if the frame window doesn't have a menu bar.
Retrieves the CDockingManager
Class object for the frame window.
CDockingManager* GetDockingManager();
A pointer to the CDockingManager
Class.
The frame window creates and uses a CDockingManager
Class object to manage child window docking.
Returns a pointer to the menu bar object attached to the frame window.
const CMFCMenuBar* GetMenuBar() const;
A pointer to the menu bar object attached to the frame window.
Returns a pointer to the pane that has the specified ID.
CBasePane* GetPane(UINT nID);
nID
[in] The control ID.
A pointer to the pane that has the specified ID. NULL
if no such pane exists.
Retrieves the ribbon bar control for the frame.
CMFCRibbonBar* GetRibbonBar();
Pointer to the CMFCRibbonBar
Class for the frame.
Returns a list of pane objects that are in a tear-off state.
const CObList& GetTearOffBars() const;
A reference to CObList
object that contains a collection of pointers to the pane objects that are in a tear-off state.
Called by the framework when the application displays the tooltip for a toolbar button.
virtual BOOL GetToolbarButtonToolTipText(
CMFCToolBarButton* pButton,
CString& strTTText);
pButton
[in] A pointer to a toolbar button.
strTTText
[in] The tooltip text to display for the button.
TRUE
if the tooltip has been displayed. FALSE
otherwise.
By default, this method does nothing. Override this method if you want to display the tooltip for the toolbar button.
Inserts a pane into a list of control bars and registers it with the docking manager.
BOOL InsertPane(
CBasePane* pControlBar,
CBasePane* pTarget,
BOOL bAfter=TRUE);
pControlBar
A pointer to a control bar to be inserted into the list of control bars and registered with the docking manager.
pTarget
A pointer to a control bar before or after which to insert the pane.
bAfter
TRUE
if you want to insert pControlBar
after pTarget
, FALSE
otherwise.
TRUE
if the control bar was successfully inserted and registered, FALSE
otherwise.
You must register each control bar by using the CDockingManager
Class to take a part in the docking layout.
Determines whether the frame window is in full screen mode.
BOOL IsFullScreen() const;
TRUE
if the frame window is in full screen mode; otherwise FALSE
.
You can set the full screen mode by calling the CFrameWndEx::EnableFullScreenMode
method.
Determines whether the pointer to the menu bar object is valid.
BOOL IsMenuBarAvailable() const;
TRUE
if the frame window has a menu bar; otherwise FALSE
.
Determines whether the point is located in an alignment zone.
BOOL IsPointNearDockSite(
CPoint point,
DWORD& dwBarAlignment,
BOOL& bOuterEdge) const;
point
[in] The position of the point.
dwBarAlignment
[out] Where the point is aligned. See the table in the Remarks section for possible values.
bOuterEdge
[out] TRUE
if the point is located close to the frame border; FALSE
if the point is located in a client area.
TRUE
if the point is located in an alignment zone; otherwise, FALSE
.
The following table lists the possible values for the dwBarAlignment
parameter.
Value | Description |
---|---|
CBRS_ALIGN_TOP |
Aligned to the top. |
CBRS_ALIGN_RIGHT |
Aligned to the right. |
CBRS_ALIGN_BOTTOM |
Aligned to the bottom. |
CBRS_ALIGN_LEFT |
Aligned to the left. |
Determines whether the frame window is in print preview mode.
BOOL IsPrintPreview();
TRUE
if the frame window is in print preview mode; otherwise, FALSE
.
This method is called after construction to create the frame window and load its resources.
virtual BOOL LoadFrame(
UINT nIDResource,
DWORD dwDefaultStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE,
CWnd* pParentWnd = NULL,
CCreateContext* pContext = NULL);
nIDResource
[in] The resource ID that is used to load all frame resources.
dwDefaultStyle
[in] The default frame window style.
pParentWnd
[in] Pointer to the parent window of the frame.
pContext
[in] Pointer to a CCreateContext
Structure class that is used by the framework during application creation.
TRUE
if the method was successful; otherwise, FALSE
.
Implements OLE client border negotiation.
virtual BOOL NegotiateBorderSpace(
UINT nBorderCmd,
LPRECT lpRectBorder);
nBorderCmd
[in] The border negotiation command. See the Remarks section for possible values.
lpRectBorder
[in, out] Dimensions of the border.
TRUE
if the layout must be recalculated; otherwise, FALSE
.
The following table lists the possible values for the nBorderCmd
parameter.
borderGet
Get available OLE client space.
borderRequest
Request OLE client space.
borderSet
Set OLE client space.
The framework calls this method when user input is switched to or away from the frame.
afx_msg void OnActivate(
UINT nState,
CWnd* pWndOther,
BOOL bMinimized);
nState
[in] Whether the frame is active or inactive. See the table in the Remarks section for possible values.
pWndOther
[in] Pointer to another window that is switching user input with the current one.
bMinimized
[in] The minimized state of the frame. TRUE
if the frame is minimized; otherwise, FALSE
.
The following table lists the possible values for the nState
parameter.
Value | Description |
---|---|
WA_ACTIVE |
The frame is selected by a method other than a mouse click. |
WA_CLICKACTIVE |
The frame is selected by a mouse click. |
WA_INACTIVE |
The frame isn't selected. |
Called by the framework when the application is either selected or deselected.
afx_msg void OnActivateApp(
BOOL bActive,
DWORD dwThreadID);
bActive
[in] TRUE
if the application is selected; FALSE
if the application isn't selected.
dwThreadID
[in] This parameter isn't used.
Called by the framework when a change to the frame requires a change to the visual manager.
afx_msg LRESULT OnChangeVisualManager(
WPARAM wParam,
LPARAM lParam);
wParam
[in] This parameter isn't used.
lParam
[in] This parameter isn't used.
Always returns 0.
The framework calls this method to close the frame.
afx_msg void OnClose();
If the frame is in print preview mode, it sends a Windows message to close the print preview; otherwise, if the frame hosts an OLE client, the client is deactivated.
Called by the framework when the user clicks the Close button on a docking pane.
virtual BOOL OnCloseDockingPane(CDockablePane* pPane);
TRUE
if the docking bar can be closed. FALSE
otherwise
The default implement does nothing. Override this method if you want to handle the hiding of the docking bar.
Called by the framework when the user clicks the Close button on a floating mini frame window.
virtual BOOL OnCloseMiniFrame(CPaneFrameWnd* pWnd);
TRUE
if a floating mini frame window can be closed. FALSE
otherwise.
The default implementation does nothing. Override this method if you want to process the hiding of a floating mini frame window.
Called by the framework when an active pop-up menu processes a WM_DESTROY
message.
virtual void OnClosePopupMenu(CMFCPopupMenu* pMenuPopup);
pMenuPopup
A pointer to a pop-up menu.
The framework sends a WM_DESTROY
message when it's about to close the window. Override this method if you want to handle notifications from CMFCPopupMenu
objects that belong to the frame window when a CMFCPopupMenu
object is processing a WM_DESTROY
message sent by the framework when the window is being closed.
Dispatches command messages.
virtual BOOL OnCmdMsg(
UINT nID,
int nCode,
void* pExtra,
AFX_CMDHANDLERINFO* pHandlerInfo);
nID
[in] The command ID.
nCode
[in] Command message category.
pExtra
[in, out] Pointer to a command object.
pHandlerInfo
[in, out] Pointer to a command handler structure.
TRUE
if the command message was handled; otherwise, FALSE
.
Called by the framework to display context-related help.
afx_msg void OnContextHelp();
Called by the framework after the frame is created.
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
lpCreateStruct
[in] A pointer to the CREATESTRUCT
Structure for the new frame.
0 to continue with the frame creation; -1 to destroy the frame.
Called by the framework when the frame is destroyed.
afx_msg void OnDestroy();
The accelerator table and all windows are destroyed.
Called by the framework when the application draws the image associated with a menu item.
virtual BOOL OnDrawMenuImage(
CDC* pDC,
const CMFCToolBarMenuButton* pMenuButton,
const CRect& rectImage);
pDC
[in] A pointer to a device context.
pMenuButton
[in] A pointer to a menu button whose image is being rendered.
rectImage
[in] A pointer to a Rect
structure that specifies the screen position and size of the image.
TRUE
if the framework successfully renders the image; FALSE
otherwise.
Override this method if you want to customize the image rendering for the menu items that belong to the menu bar owned by the CFrameWndEx
derived object.
Called by the framework when a CMFCPopupMenu
object processes a WM_PAINT
message.
virtual void OnDrawMenuLogo(
CDC* pDC,
CMFCPopupMenu* pMenu,
const CRect& rectLogo);
pDC
[in] A pointer to a device context.
pMenu
[in] A pointer to the menu item.
rectLogo
[in] A reference to a constant CRect
structure that specifies the screen position and size of the menu logo.
Override this function if you want to display a logo on the pop-up menu that belongs to the menu bar owned by the CFrameWndEx
derived object.
Called by the framework when Desktop Window Manager (DWM) composition has been enabled or disabled.
afx_msg LRESULT OnDWMCompositionChanged(
WPARAM wp,
LPARAM lp);
wp
[in] This parameter isn't used.
lp
[in] This parameter isn't used.
Always returns 0.
Called by the framework when the frame stops moving or resizing.
LRESULT OnExitSizeMove(
WPARAM wp,
LPARAM lp);
wp
[in] This parameter isn't used.
lp
[in] This parameter isn't used.
Always returns 0.
Called by the framework when the frame is resized to set window dimension limits.
afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
lpMMI
[in] Pointer to a MINMAXINFO
structure.
Called by the framework to update the frame display when command processing is idle.
afx_msg LRESULT OnIdleUpdateCmdUI(
WPARAM wParam = 0,
LPARAM lParam = 0);
wParam
[in] This parameter isn't used.
lParam
[in] This parameter isn't used.
Always returns 0.
The framework calls this method when the user presses the left mouse button.
afx_msg void OnLButtonDown(
UINT nFlags,
CPoint point);
nFlags
[in] Indicates whether the user pressed modifier keys. For possible values see the parameter wParam
in WM_LBUTTONDOWN
Notification.
point
[in] Specifies the x and y coordinates of the pointer, relative to the upper-left corner of the window.
The framework calls this method when the user releases the left mouse button.
afx_msg void OnLButtonUp(
UINT nFlags,
CPoint point);
nFlags
[in] Indicates whether the user pressed modifier keys. For possible values see the parameter wParam
in WM_LBUTTONUP
Notification.
point
[in] Specifies the x and y coordinates of the pointer, relative to the upper-left corner of the window.
Called by the framework when a CMFCToolBarButton
object processes a WM_NCHITTEST
message.
virtual BOOL OnMenuButtonToolHitTest(
CMFCToolBarButton* pButton,
TOOLINFO* pTI);
pButton
[in] A pointer to the tool bar button.
pTI
[out] A pointer to a tool information structure.
TRUE
if the application fills the pTI
parameter. FALSE
otherwise.
Override this method if you want to provide a tooltip information about a specific menu item.
Called by the framework when a menu is displayed and the user presses a key that doesn't correspond to a command.
afx_msg LRESULT OnMenuChar(
UINT nChar,
UINT nFlags,
CMenu* pMenu);
nChar
[in] Character code of the pressed key.
nFlags
[in] Contains the MF_POPUP
flag if the menu displayed is a submenu; contains the MF_SYSMENU
flag if the menu displayed is a control menu.
pMenu
[in] Pointer to a menu.
The high-order word must be one of the following values.
Value | Description |
---|---|
0 |
The framework should ignore the keystroke. |
1 |
The framework should close the menu. |
2 |
The framework should select one of the items displayed in the menu. The low-order word contains the ID of the command to select. |
The framework calls this method when the pointer moves.
afx_msg void OnMouseMove(
UINT nFlags,
CPoint point);
nFlags
[in] Indicates whether a user pressed modifier keys. For possible values see the parameter wParam
in WM_MOUSEMOVE
Notification.
point
[in] Specifies the x
and y
coordinates of the pointer relative to the upper-left corner of the window.
Called by the framework when a pane window moves.
virtual BOOL OnMoveMiniFrame(CWnd* pFrame);
pFrame
[in] Pointer to the CPaneFrameWnd
Class pane window.
TRUE
if the pane window wasn't docked; FALSE
if the pane window was docked.
Called by the framework when the non-client area of the frame must be redrawn to indicate a change in the active state.
afx_msg BOOL OnNcActivate(BOOL bActive);
bActive
[in] TRUE
to draw the frame active; FALSE
to draw the frame inactive.
Nonzero to continue with default processing; 0 to prevent the non-client area from being deactivated.
Called by the framework when the size and position of the client area must be calculated.
afx_msg void OnNcCalcSize(
BOOL bCalcValidRects,
NCCALCSIZE_PARAMS FAR* lpncsp);
bCalcValidRects
[in] TRUE
when the application must specify a valid client area; otherwise, FALSE
.
lpncsp
[in] Pointer to a NCCALCSIZE_PARAMS
structure that contains frame dimension changes.
Called by the framework when the pointer moves or when a mouse button is pressed or released.
afx_msg LRESULT OnNcHitTest(CPoint point);
point
[in] The location of the pointer in screen coordinates.
A pointer hit enumerated value. For a list of possible values see WM_NCHITTEST
Notification.
Called by the framework when the pointer moves in a non-client area.
afx_msg void OnNcMouseMove(
UINT nHitTest,
CPoint point);
nHitTest
[in] A pointer hit enumerated value. For a list of possible values see WM_NCHITTEST
Notification.
point
[in] The location of the pointer in screen coordinates.
Called by the framework when the non-client area must be painted.
afx_msg void OnNcPaint();
Called by the framework to control the visibility of a pane.
afx_msg BOOL OnPaneCheck(UINT nID);
nID
[in] Control ID of a pane.
TRUE
if the command was handled; FALSE
to continue with command processing.
Called by the framework when the user changes the print preview mode.
afx_msg LRESULT OnPostPreviewFrame(
WPARAM wParam,
LPARAM lParam);
wParam
[in] This parameter isn't used.
lParam
[in] TRUE
when the frame is in print preview mode; FALSE
when print preview mode is off.
Always returns 0.
Called by the framework when a power management event occurs.
afx_msg LRESULT OnPowerBroadcast(
WPARAM wp,
LPARAM lp);
wp
[in] The power management event. For a list of possible values see WM_POWERBROADCAST
Message.
lp
[in] This parameter isn't used.
Result from calling the default window procedure.
Called by the framework to replace the frame window menu.
afx_msg LRESULT OnSetMenu(
WPARAM wp,
LPARAM lp);
BOOL OnSetMenu(HMENU hmenu);
wp
[in] Handle to the new frame window menu.
lp
[in] Handle to the new window menu.
hmenu
[in] Handle to the new frame window menu.
LRESULT
is the result from calling the default window procedure.
BOOL is TRUE
if the event was handled; otherwise, FALSE
.
Called by the framework to set the print preview mode for the frame.
virtual void OnSetPreviewMode(
BOOL bPreview,
CPrintPreviewState* pState);
bPreview
[in] TRUE
to enable print preview; FALSE
to disable print preview.
pState
[in] Pointer to a CPrintPreviewState
frame state structure.
Called by the framework to set the text of a window.
afx_msg LRESULT OnSetText(
WPARAM wParam,
LPARAM lParam);
wParam
[in] This parameter isn't used.
lParam
[in] Pointer to the text for the window.
Return value from a call to DefWindowProc
.
Called by the framework when it displays a QuickCustomizePane
.
virtual BOOL OnShowCustomizePane(
CMFCPopupMenu* pMenuPane,
UINT uiToolbarID);
pMenuPane
[in] A pointer to the quick customize pane.
uiToolbarID
[in] The control ID of the toolbar to customize.
This method always returns TRUE
.
The quick customize menu is a pop-up menu that appears when you click the toolbar's customize button
Called by the framework to show or hide panes.
virtual BOOL OnShowPanes(BOOL bShow);
bShow
[in] TRUE
if the application shows the panes; FALSE
otherwise.
This method always returns FALSE
.
The default implementation shows the panes if bShow
is TRUE
and the panes are hidden or when bShow
is FALSE
and the panes are visible.
The default implementation hides the panes if bShow
is TRUE
and the panes are visible or when bShow
is FALSE
and the panes are hidden.
Override this method in a derived class to execute custom code when the framework shows or hides panes.
Called by the framework when it displays a pop-up menu.
virtual BOOL OnShowPopupMenu(CMFCPopupMenu* pMenu);
pMenu
[in] A pointer to a pop-up menu.
TRUE
if the pop-up menu is visible; otherwise FALSE
.
Override this method in a derived class to execute custom code when the framework displays a pop-up menu. For example, override this method to change the background color of the commands in a pop-up menu.
Called by the framework after the frame's size changes.
afx_msg void OnSize(
UINT nType,
int cx,
int cy);
nType
[in] The type of resizing. For possible values see the parameter wParam
in WM_SIZE Notification.
cx
[in] New width of the frame in pixels.
cy
[in] New height of the frame in pixels.
Called by the framework when the user resizes the frame.
afx_msg void OnSizing(
UINT fwSide,
LPRECT pRect);
fwSide
[in] The edge of the frame that is moved. See the parameter wParam
in WM_SIZING
Notification.
pRect
[in, out] Pointer to a CRect
or RECT
structure that contains the frame's coordinates.
Called by the framework when the system colors change.
void OnSysColorChange();
Called by the framework when the application displays a menu that has a tear-off bar.
virtual BOOL OnTearOffMenu(
CMFCPopupMenu* pMenuPopup,
CPane* pBar);
pMenuPopup
[in] A pointer to a pop-up menu.
pBar
[in] A pointer to a tear-off bar.
TRUE
if the pop-up menu with the tear-off bar is enabled; otherwise FALSE
.
Override this method in a derived class to execute custom code when the framework displays a control bar.
The default implementation does nothing and returns TRUE
.
Called by the framework to build a toolbar pop-up menu.
afx_msg LRESULT OnToolbarContextMenu(
WPARAM wp,
LPARAM lp);
wp
[in] This parameter isn't used.
lp
[in] This parameter isn't used.
Always returns 1.
The framework calls this method to create a new toolbar.
afx_msg LRESULT OnToolbarCreateNew(
WPARAM wp,
LPARAM lp);
wp
[in] This parameter isn't used.
lp
[in] Pointer to the text for the title bar of the toolbar.
Pointer to the new toolbar; or NULL
if a toolbar wasn't created.
Called by the framework when a toolbar is deleted.
afx_msg LRESULT OnToolbarDelete(
WPARAM /* unused */,
LPARAM lp);
unused
[in] This parameter isn't used.
lp
[in] Pointer to a toolbar.
TRUE
if the toolbar was deleted; otherwise, FALSE
.
Called by the framework to set the frame menu.
virtual void OnUpdateFrameMenu(HMENU hMenuAlt);
hMenuAlt
[in] Handle to the alternative menu.
The framework calls this method to update the title bar of the frame window.
virtual void OnUpdateFrameTitle(BOOL bAddToTitle);
bAddToTitle
[in] TRUE
to add the active document title to the frame window title bar; otherwise FALSE
.
Called by the framework to update the pane menu.
afx_msg void OnUpdatePaneMenu(CCmdUI* pCmdUI);
pCmdUI
[in] Pointer to the pane user interface object.
Called by the framework when the frame size, position, or z-order has changed because of a call to a window management method.
afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos);
lpwndpos
[in] Pointer to a WINDOWPOS
structure that contains the new size and position.
Searches each pane for the given point.
CBasePane* PaneFromPoint(
CPoint point,
int nSensitivity,
bool bExactBar,
CRuntimeClass* pRTCBarType) const;
CBasePane* PaneFromPoint(
CPoint point,
int nSensitivity,
DWORD& dwAlignment,
CRuntimeClass* pRTCBarType) const;
point
[in] The screen coordinates of the point to check.
nSensitivity
[in] Expand the bounding rectangle of each control bar by this amount when searching for point.
bExactBar
[in] TRUE
to ignore the nSensitivity
parameter; otherwise, FALSE
.
pRTCBarType
[in] If not NULL
, the method searches only the control bars of the specified type.
dwAlignment
[out] If successful, this parameter contains the side of the control bar that is closest to the specified point. Otherwise, this parameter isn't initialized.
A pointer to a control bar that contains the point
; NULL
if no control is found.
This method searches all the control bars in your application for a point
.
Use nSensitivity
to increase the size of the search area. Use pRTCBarType
to restrict the types of control bars that the method searches.
Handles specific window messages before they're dispatched.
virtual BOOL PreTranslateMessage(MSG* pMsg);
pMsg
[in] A pointer to a MSG
structure that contains the message to process.
Non-zero if the message was handled and shouldn't be dispatched; 0 if the message wasn't handled and should be dispatched.
Adjusts the layout of the frame and its child windows.
virtual void RecalcLayout(BOOL bNotify = TRUE);
bNotify
[in] Specifies whether to notify the OLE client item about the layout change.
This method is called when the size of the frame window has changed or when control bars are displayed or hidden.
Unregisters a pane and removes it from the docking manager.
void RemovePaneFromDockManager(
CBasePane* pControlBar,
BOOL bDestroy,
BOOL bAdjustLayout,
BOOL bAutoHide,
CBasePane* pBarReplacement);
pControlBar
[in] A pointer to the control bar pane to remove.
bDestroy
[in] TRUE
to destroy the control bar after removing it; FALSE
otherwise.
bAdjustLayout
[in] TRUE
to adjust the docking layout; FALSE
otherwise.
bAutoHide
[in] TRUE
if the control bar is in auto-hide mode; FALSE
otherwise.
pBarReplacement
[in] A pointer to a pane that replaces the removed pane.
Use this method to remove a control bar from the docking layout of the frame window.
The CDockingManager
Class handles the layout of control bars. You must register each control bar with the docking manager by using the CFrameWndEx::AddPane
method or the CFrameWndEx::InsertPane
method.
Restores the docking layout to the docking state stored in the registry.
void SetDockState(const CDockState& state);
state
The docking state. This parameter is ignored.
Sets the print preview frame window.
void SetPrintPreviewFrame(CFrameWnd* pWnd);
pWnd
[in] Pointer to a print preview frame window.
Inserts user-defined commands into a toolbar menu.
void SetupToolbarMenu(
CMenu& menu,
const UINT uiViewUserToolbarCmdFirst,
const UINT uiViewUserToolbarCmdLast);
menu
[in] A CMenu
object to be modified.
uiViewUserToolbarCmdFirst
[in] The first user-defined command.
uiViewUserToolbarCmdLast
[in] The last user-defined command.
The framework stores user-defined commands in a list. Use uiViewUserToolbarCmdFirst
and uiViewUserToolbarCmdList
to specify the indexes of the commands to insert.
Switches the main frame between full-screen mode and regular mode.
void ShowFullScreen();
Shows or hides the specified pane.
void ShowPane(
CBasePane* pBar,
BOOL bShow,
BOOL bDelay,
BOOL bActivate);
pBar
[in] A pointer to the control bar to show or hide.
bShow
[in] If TRUE
, the application shows the control bar. Otherwise, the application hides the control bar.
bDelay
[in] If TRUE
, delay the adjustment of the docking layout until the framework calls CFrameWndEx::AdjustDockingLayout
. Otherwise, recalculate the docking layout immediately.
bActivate
[in] If TRUE
, make the control bar active. Otherwise, display the control bar in an inactive state.
Called by the framework to update the window frame caption.
void UpdateCaption();
Invokes either the WinHelp application or context related help.
virtual void WinHelp(
DWORD dwData,
UINT nCmd = HELP_CONTEXT);
dwData
Data that depends on the nCmd
parameter. For a list of possible values see WinHelp
.
nCmd
The help command. For a list of possible values see WinHelp
.