CMFCDropDownFrame Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at CMFCDropDownFrame Class.

Provides drop-down frame window functionality to drop-down toolbars and drop-down toolbar buttons.

class CMFCDropDownFrame : public CMiniFrameWnd  

Public Constructors

NameDescription
CMFCDropDownFrame::CMFCDropDownFrameDefault constructor.
CMFCDropDownFrame::~CMFCDropDownFrameDestructor.

Public Methods

NameDescription
CMFCDropDownFrame::CreateCreates a CMFCDropDownFrame object.
CMFCDropDownFrame::CreateObjectUsed by the framework to create a dynamic instance of this class type.
CMFCDropDownFrame::GetParentMenuBarRetrieves the parent menu bar of the drop-down frame.
CMFCDropDownFrame::GetParentPopupMenuRetrieves the parent pop-up menu of the drop-down frame.
CMFCDropDownFrame::GetThisClassUsed by the framework to obtain a pointer to the CRuntimeClass object that is associated with this class type.
CMFCDropDownFrame::RecalcLayoutRepositions the drop-down frame.
CMFCDropDownFrame::SetAutoDestroySets whether the child drop-down toolbar window is destroyed automatically.

Remarks

This class is not intended to be used directly from your code.

The framework uses this class to provide frame behavior to the CMFCDropDownToolbar and CMFCDropDownToolbarButton classes. For more information about these classes, see CMFCDropDownToolBar Class and CMFCDropDownToolbarButton Class.

The following example demonstrates how to retrieve a pointer to a CMFCDropDownFrame object from a CFrameWnd class, and how to set the child drop-down toolbar window to be destroyed automatically.

	CFrameWnd* pTopFrame = AFXGetParentFrame(this);
	if (pTopFrame == NULL)
	{
		return FALSE;
	}

	CMFCDropDownFrame* pDropFrame = DYNAMIC_DOWNCAST(CMFCDropDownFrame, pTopFrame);
	pDropFrame->SetAutoDestroy(true);

CObject

CCmdTarget

CWnd

CFrameWnd

CMiniFrameWnd

CMFCDropDownFrame

Header: afxdropdowntoolbar.h

Creates a CMFCDropDownFrame object.

virtual BOOL Create(
    CWnd* pWndParent,  
    int x,  
    int y,  
    CMFCDropDownToolBar* pWndOriginToolbar);

Parameters

ParameterDescription
[in] pWndParentThe parent window of the drop-down frame.
[in] xThe horizontal screen coordinate for the location of the down-down frame.
[in] yThe vertical screen coordinate for the location of the down-down frame.
[in] pWndOriginToolbarThe toolbar that has the drop-down buttons that this method uses to populate the new drop-down frame object.

Return Value

TRUE if the drop-down frame was successfully created; otherwise FALSE.

Remarks

This method calls the base CMiniFrameWnd::CreateEx method to create the drop-down frame window with the WS_POPUP style. The drop-down frame window appears at the specified screen coordinates. This method fails if the CMiniFrameWnd::CreateEx method returns FALSE.

The CMFCDropDownFrame class creates a copy of the provided CMFCDropDownToolBar parameter. This method copies the button images and button states from the pWndOriginToolbar parameter to the m_pWndOriginToolbar data member.

Retrieves the parent menu bar of the drop-down frame.

CMFCMenuBar* GetParentMenuBar() const;  

Return Value

A pointer to the parent menu bar of the drop-down frame, or NULL if the frame has no parent.

Remarks

This method retrieves the parent menu bar from the parent button. This method returns NULL if the drop-down frame has no parent button or the parent button has no parent menu bar.

Retrieves the parent pop-up menu of the drop-down frame.

CMFCDropDownFrame* GetParentPopupMenu() const;  

Return Value

A pointer to the parent drop-down menu of the drop-down frame, or NULL if the frame has no parent.

Remarks

This method retrieves the parent menu from the parent button. This method returns NULL if the drop-down frame has no parent button or the parent button has no parent menu.

Repositions the drop-down frame.

virtual void RecalcLayout(BOOL bNotify = TRUE);

Parameters

ParameterDescription
[in] bNotifyUnused.

Remarks

The framework calls this method when the drop-down frame is created or the parent window is resized. This method calculates the position and size of the drop-down frame by using the position and size of the parent window.

Sets whether the child drop-down toolbar window is destroyed automatically.

void SetAutoDestroy(BOOL bAutoDestroy = TRUE);

Parameters

[in] bAutoDestroy
TRUE to automatically destroy the associated drop-down toolbar window; otherwise, FALSE.

Remarks

If bAutoDestroy is TRUE, then the CMFCDropDownFrame destructor destroys the associated drop-down toolbar window. The default value is TRUE.

Hierarchy Chart
Classes
CMFCDropDownToolBar Class
CMFCDropDownToolbarButton Class

Show: